Merge pull request #181 from element-hq/robin/axe-no-container

Avoid starting a homeserver when using just the axe fixture
This commit is contained in:
Robin 2026-01-16 12:10:51 +01:00 committed by GitHub
commit 1bd24aeb27
3 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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";

View File

@ -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