mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-04 19:56:45 +02:00
Avoid starting a homeserver when using just the axe fixture
Since 4c928d28543b18eec14334e217fc24df8b598065 importing the axe fixture would cause your test to pull in the entire world of Synapse and Postgres services. For Compound Web tests, we want to be able to use axe in isolation without all the extra fixtures. Inverting the fixture hierarchy ought to do the trick.
This commit is contained in:
parent
0561301d98
commit
48e262d8f1
@ -6,12 +6,11 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { test as base } from "@playwright/test";
|
||||
import AxeBuilder from "@axe-core/playwright";
|
||||
|
||||
import { test as base } from "./user.js";
|
||||
|
||||
// We want to avoid using `mergeTests` because it drops useful type information about the fixtures. Instead, we extend
|
||||
// the definition of `test` from `user.ts`, so that there is a linear hierarchy.
|
||||
// This fixture is useful for simple component library tests that won't want any extra services like a homeserver, so we
|
||||
// explicitly avoid pulling anything more than playwright's base fixtures in.
|
||||
export const test = base.extend<{
|
||||
/**
|
||||
* AxeBuilder instance for the current page
|
||||
|
||||
@ -8,5 +8,5 @@ Please see LICENSE files in the repository root for full details.
|
||||
export { type Services, type WorkerOptions } from "./services.js";
|
||||
|
||||
// We avoid using `mergeTests` because it drops useful type information about the fixtures.
|
||||
// `axe` is the top of our stack of extensions (it extends `user`, etc), so it's the one we want to use.
|
||||
export { test } from "./axe.js";
|
||||
// `user` is the top of our stack of extensions (it extends services, axe, etc), so it includes everything.
|
||||
export { test } from "./user.js";
|
||||
|
||||
@ -5,7 +5,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { test as base } from "@playwright/test";
|
||||
import { type MailpitClient } from "mailpit-api";
|
||||
import { Network, type StartedNetwork } from "testcontainers";
|
||||
import { PostgreSqlContainer, type StartedPostgreSqlContainer } from "@testcontainers/postgresql";
|
||||
@ -20,6 +19,9 @@ import {
|
||||
type StartedMailpitContainer,
|
||||
} from "../testcontainers/index.js";
|
||||
import { Logger } from "../utils/logger.js";
|
||||
// We want to avoid using `mergeTests` in index.ts because it drops useful type information about the fixtures. Instead,
|
||||
// we add `axe` into our fixture suite by using its `test` as a base, so that there is a linear hierarchy.
|
||||
import { test as base } from "./axe.js";
|
||||
|
||||
/**
|
||||
* Test-scoped fixtures available in the test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user