diff --git a/packages/element-web-playwright-common/src/index.ts b/packages/element-web-playwright-common/src/index.ts index 59df040324..4f13e8be2d 100644 --- a/packages/element-web-playwright-common/src/index.ts +++ b/packages/element-web-playwright-common/src/index.ts @@ -27,6 +27,7 @@ export interface Config extends BaseConfig { server_name?: string; }; }; + enable_presence_by_hs_url?: Record; setting_defaults: Record; map_style_url?: string; features: Record; @@ -58,12 +59,15 @@ export interface TestFixtures { config: Partial; labsFlags: string[]; + disablePresence: boolean; } export const test = base.extend({ - config: {}, // We merge this atop the default CONFIG_JSON in the page fixture to make extending it easier - labsFlags: [], - page: async ({ homeserver, context, page, config, labsFlags }, use) => { + // We merge this atop the default CONFIG_JSON in the page fixture to make extending it easier + config: async ({}, use) => use({}), + labsFlags: async ({}, use) => use([]), + disablePresence: async ({}, use) => use(false), + page: async ({ homeserver, context, page, config, labsFlags, disablePresence }, use) => { await context.route(`http://localhost:8080/config.json*`, async (route) => { const json = { ...CONFIG_JSON, @@ -83,6 +87,11 @@ export const test = base.extend({ return obj; }, {}), }; + if (disablePresence) { + json["enable_presence_by_hs_url"] = { + [homeserver.baseUrl]: false, + }; + } await route.fulfill({ json }); }); await use(page);