This commit is contained in:
Michael Telatynski
2025-03-12 11:31:38 +00:00
parent c9288b846e
commit 2fa2805b8d
@@ -27,6 +27,7 @@ export interface Config extends BaseConfig {
server_name?: string; server_name?: string;
}; };
}; };
enable_presence_by_hs_url?: Record<string, boolean>;
setting_defaults: Record<string, unknown>; setting_defaults: Record<string, unknown>;
map_style_url?: string; map_style_url?: string;
features: Record<string, boolean>; features: Record<string, boolean>;
@@ -58,12 +59,15 @@ export interface TestFixtures {
config: Partial<typeof CONFIG_JSON>; config: Partial<typeof CONFIG_JSON>;
labsFlags: string[]; labsFlags: string[];
disablePresence: boolean;
} }
export const test = base.extend<TestFixtures>({ export const test = base.extend<TestFixtures>({
config: {}, // We merge this atop the default CONFIG_JSON in the page fixture to make extending it easier // We merge this atop the default CONFIG_JSON in the page fixture to make extending it easier
labsFlags: [], config: async ({}, use) => use({}),
page: async ({ homeserver, context, page, config, labsFlags }, 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) => { await context.route(`http://localhost:8080/config.json*`, async (route) => {
const json = { const json = {
...CONFIG_JSON, ...CONFIG_JSON,
@@ -83,6 +87,11 @@ export const test = base.extend<TestFixtures>({
return obj; return obj;
}, {}), }, {}),
}; };
if (disablePresence) {
json["enable_presence_by_hs_url"] = {
[homeserver.baseUrl]: false,
};
}
await route.fulfill({ json }); await route.fulfill({ json });
}); });
await use(page); await use(page);