From fd4bb50a14c38592b58a05394fb3918281813bca Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 3 Mar 2026 18:25:22 +0000 Subject: [PATCH] Tests galore --- .../src/testcontainers/mas.ts | 3 +++ .../src/testcontainers/synapse.ts | 25 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/packages/element-web-playwright-common/src/testcontainers/mas.ts b/packages/element-web-playwright-common/src/testcontainers/mas.ts index 294afb7343..430875797b 100644 --- a/packages/element-web-playwright-common/src/testcontainers/mas.ts +++ b/packages/element-web-playwright-common/src/testcontainers/mas.ts @@ -156,6 +156,7 @@ export class MatrixAuthenticationServiceContainer extends GenericContainer { super(image); const initialConfig = deepCopy(DEFAULT_CONFIG); + initialConfig.database.host = db.getHostname(); initialConfig.database.username = db.getUsername(); initialConfig.database.password = db.getPassword(); @@ -205,6 +206,7 @@ export class MatrixAuthenticationServiceContainer extends GenericContainer { await super.start(), `http://localhost:${port}`, this.args, + this.config.matrix.secret, ); } } @@ -219,6 +221,7 @@ export class StartedMatrixAuthenticationServiceContainer extends AbstractStarted container: StartedTestContainer, public readonly baseUrl: string, private readonly args: string[], + public readonly sharedSecret: string, ) { super(container); } diff --git a/packages/element-web-playwright-common/src/testcontainers/synapse.ts b/packages/element-web-playwright-common/src/testcontainers/synapse.ts index bec34aa433..65d92c0ab9 100644 --- a/packages/element-web-playwright-common/src/testcontainers/synapse.ts +++ b/packages/element-web-playwright-common/src/testcontainers/synapse.ts @@ -184,6 +184,14 @@ const DEFAULT_CONFIG = { }, room_list_publication_rules: [{ action: "allow" }], modules: [] as Array<{ module: string; config?: Record }>, + matrix_authentication_service: undefined as + | undefined + | { + enabled?: boolean; + endpoint?: string; + secret?: string | null; + secret_path?: string | null; + }, }; /** @@ -278,7 +286,22 @@ export class SynapseContainer extends GenericContainer implements HomeserverCont } public withMatrixAuthenticationService(mas?: StartedMatrixAuthenticationServiceContainer): this { - this.mas = mas; + if (mas) { + this.mas = mas; + this.withConfig({ + matrix_authentication_service: { + enabled: true, + endpoint: `http://${mas.getHostname()}:8080/`, + secret: mas.sharedSecret, + }, + // Must be disabled when using MAS. + password_config: { + enabled: false, + }, + // Must be disabled when using MAS. + enable_registration: false, + }); + } return this; }