Fix playwright modules tests
This commit is contained in:
@@ -208,9 +208,6 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Build modules
|
|
||||||
run: pnpm -r --workspace-concurrency=1 --filter "./modules/**" run build
|
|
||||||
|
|
||||||
- name: Setup playwright
|
- name: Setup playwright
|
||||||
uses: ./.github/actions/setup-playwright
|
uses: ./.github/actions/setup-playwright
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
{
|
{
|
||||||
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
||||||
"projectType": "library",
|
"projectType": "library",
|
||||||
|
"implicitDependencies": ["modules/*"],
|
||||||
"targets": {
|
"targets": {
|
||||||
"test:playwright": {
|
"test:playwright": {
|
||||||
"command": "playwright test",
|
"command": "playwright test",
|
||||||
"options": { "cwd": "modules" },
|
"options": { "cwd": "modules" },
|
||||||
"dependsOn": ["^build:playwright"]
|
"dependsOn": ["^build:playwright", "^build"]
|
||||||
},
|
},
|
||||||
"test:playwright:screenshots": {
|
"test:playwright:screenshots": {
|
||||||
"command": "playwright-screenshots playwright test --update-snapshots --grep @screenshot",
|
"command": "playwright-screenshots playwright test --update-snapshots --grep @screenshot",
|
||||||
"options": { "cwd": "modules" },
|
"options": { "cwd": "modules" },
|
||||||
"dependsOn": ["^build:playwright"]
|
"dependsOn": ["^build:playwright", "^build"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,8 @@ import {
|
|||||||
StartedSynapseContainer,
|
StartedSynapseContainer,
|
||||||
SynapseContainer,
|
SynapseContainer,
|
||||||
} from "@element-hq/element-web-playwright-common/lib/testcontainers/index.js";
|
} from "@element-hq/element-web-playwright-common/lib/testcontainers/index.js";
|
||||||
import path, { dirname } from "node:path";
|
import { Readable } from "node:stream";
|
||||||
import { fileURLToPath } from "node:url";
|
import { GenericContainer, Wait } from "testcontainers";
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
||||||
|
|
||||||
// We use the SynapseContainer as a base to have all of its utilities for config setting
|
// We use the SynapseContainer as a base to have all of its utilities for config setting
|
||||||
export class RestrictedGuestsSynapseContainer extends SynapseContainer {
|
export class RestrictedGuestsSynapseContainer extends SynapseContainer {
|
||||||
@@ -21,14 +19,22 @@ export class RestrictedGuestsSynapseContainer extends SynapseContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override async start(): Promise<StartedSynapseContainer> {
|
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"),
|
tar: Readable.from(tarStream),
|
||||||
target: "/modules/synapse_guest_module/",
|
target: "/",
|
||||||
},
|
},
|
||||||
]).withEnvironment({
|
]).withEnvironment({
|
||||||
PYTHONPATH: "/modules",
|
PYTHONPATH: "/modules",
|
||||||
});
|
});
|
||||||
|
|
||||||
this.config.modules.push({
|
this.config.modules.push({
|
||||||
module: "synapse_guest_module.GuestModule",
|
module: "synapse_guest_module.GuestModule",
|
||||||
config: this.getModuleConfig(),
|
config: this.getModuleConfig(),
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
"@types/react": "catalog:",
|
"@types/react": "catalog:",
|
||||||
"@vitejs/plugin-react": "catalog:",
|
"@vitejs/plugin-react": "catalog:",
|
||||||
"react": "catalog:",
|
"react": "catalog:",
|
||||||
|
"testcontainers": "^12.0.1",
|
||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
"vite": "catalog:",
|
"vite": "catalog:",
|
||||||
"vite-plugin-node-polyfills": "catalog:"
|
"vite-plugin-node-polyfills": "catalog:"
|
||||||
|
|||||||
Generated
+3
@@ -1219,6 +1219,9 @@ importers:
|
|||||||
react:
|
react:
|
||||||
specifier: 'catalog:'
|
specifier: 'catalog:'
|
||||||
version: 19.2.6
|
version: 19.2.6
|
||||||
|
testcontainers:
|
||||||
|
specifier: ^12.0.1
|
||||||
|
version: 12.0.1
|
||||||
typescript:
|
typescript:
|
||||||
specifier: 'catalog:'
|
specifier: 'catalog:'
|
||||||
version: 6.0.3
|
version: 6.0.3
|
||||||
|
|||||||
Reference in New Issue
Block a user