diff --git a/playwright.config.ts b/playwright.config.ts index 5844443427..4c5c2bdfa5 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -14,11 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -import type { PlaywrightTestConfig } from "@playwright/test"; +import { defineConfig } from "@playwright/test"; + +import { TestOptions } from "./playwright/element-web-test"; const baseURL = process.env["BASE_URL"] ?? "http://localhost:8080"; -const config: PlaywrightTestConfig = { +export default defineConfig({ use: { headless: false, viewport: { width: 1280, height: 720 }, @@ -35,5 +37,14 @@ const config: PlaywrightTestConfig = { outputDir: "playwright/test-results", workers: 1, reporter: process.env.CI ? "blob" : [["html", { outputFolder: "playwright/html-report" }]], -}; -export default config; + projects: [ + { + name: "Legacy Crypto", + use: { crypto: "legacy" }, + }, + { + name: "Rust Crypto", + use: { crypto: "rust" }, + }, + ], +}); diff --git a/playwright/element-web-test.ts b/playwright/element-web-test.ts index 28b97199dc..cd163e1072 100644 --- a/playwright/element-web-test.ts +++ b/playwright/element-web-test.ts @@ -35,15 +35,30 @@ const CONFIG_JSON = { map_style_url: "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx", }; -export const test = base.extend<{ - startHomeserverOpts: StartHomeserverOpts | string; - homeserver: HomeserverInstance; -}>({ - page: async ({ context, page }, use) => { - await context.route(`http://localhost:8080/config.json*`, async (route) => { - await route.fulfill({ json: CONFIG_JSON }); - }); +export type TestOptions = { + crypto: "legacy" | "rust"; +}; +export const test = base.extend< + TestOptions & { + config: typeof CONFIG_JSON; + startHomeserverOpts: StartHomeserverOpts | string; + homeserver: HomeserverInstance; + } +>({ + crypto: ["legacy", { option: true }], + config: CONFIG_JSON, + page: async ({ context, page, config, crypto }, use) => { + await context.route(`http://localhost:8080/config.json*`, async (route) => { + const json = { ...config }; + if (crypto === "rust") { + json["features"] = { + ...json["features"], + feature_rust_crypto: true, + }; + } + await route.fulfill({ json }); + }); await use(page); },