Fix playwright modules tests

This commit is contained in:
Michael Telatynski
2026-06-09 18:17:37 +01:00
parent a16b72732e
commit bb2c6d68ff
5 changed files with 20 additions and 12 deletions
-3
View File
@@ -208,9 +208,6 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build modules
run: pnpm -r --workspace-concurrency=1 --filter "./modules/**" run build
- name: Setup playwright
uses: ./.github/actions/setup-playwright
with:
+3 -2
View File
@@ -1,16 +1,17 @@
{
"$schema": "../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"implicitDependencies": ["modules/*"],
"targets": {
"test:playwright": {
"command": "playwright test",
"options": { "cwd": "modules" },
"dependsOn": ["^build:playwright"]
"dependsOn": ["^build:playwright", "^build"]
},
"test:playwright:screenshots": {
"command": "playwright-screenshots playwright test --update-snapshots --grep @screenshot",
"options": { "cwd": "modules" },
"dependsOn": ["^build:playwright"]
"dependsOn": ["^build:playwright", "^build"]
}
}
}
+13 -7
View File
@@ -9,10 +9,8 @@ import {
StartedSynapseContainer,
SynapseContainer,
} from "@element-hq/element-web-playwright-common/lib/testcontainers/index.js";
import path, { dirname } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
import { Readable } from "node:stream";
import { GenericContainer, Wait } from "testcontainers";
// We use the SynapseContainer as a base to have all of its utilities for config setting
export class RestrictedGuestsSynapseContainer extends SynapseContainer {
@@ -21,14 +19,22 @@ export class RestrictedGuestsSynapseContainer extends SynapseContainer {
}
public override async start(): Promise<StartedSynapseContainer> {
this.withCopyDirectoriesToContainer([
// Download the synapse module
const initContainer = await new GenericContainer("ghcr.io/element-hq/synapse-guest-module:861f7ee")
.withWaitStrategy(Wait.forOneShotStartup())
.start();
const tarStream = await initContainer.copyArchiveFromContainer(`/src/synapse_guest_module`);
await initContainer.stop();
this.withCopyArchivesToContainer([
{
source: path.resolve(__dirname, "..", "..", "synapse", "synapse_guest_module"),
target: "/modules/synapse_guest_module/",
tar: Readable.from(tarStream),
target: "/",
},
]).withEnvironment({
PYTHONPATH: "/modules",
});
this.config.modules.push({
module: "synapse_guest_module.GuestModule",
config: this.getModuleConfig(),
+1
View File
@@ -16,6 +16,7 @@
"@types/react": "catalog:",
"@vitejs/plugin-react": "catalog:",
"react": "catalog:",
"testcontainers": "^12.0.1",
"typescript": "catalog:",
"vite": "catalog:",
"vite-plugin-node-polyfills": "catalog:"
+3
View File
@@ -1219,6 +1219,9 @@ importers:
react:
specifier: 'catalog:'
version: 19.2.6
testcontainers:
specifier: ^12.0.1
version: 12.0.1
typescript:
specifier: 'catalog:'
version: 6.0.3