From 2a183c76c919558bec5c56f5fb1993a83d67a195 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 2 Oct 2024 11:21:44 +0100 Subject: [PATCH] Ensure no race condition between page load and waitForRequest set up (#109) Fixes https://github.com/element-hq/element-web/issues/27572 Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- playwright/e2e/oidc/oidc-native.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/playwright/e2e/oidc/oidc-native.spec.ts b/playwright/e2e/oidc/oidc-native.spec.ts index 0990f11d35..3309826b63 100644 --- a/playwright/e2e/oidc/oidc-native.spec.ts +++ b/playwright/e2e/oidc/oidc-native.spec.ts @@ -8,6 +8,7 @@ Please see LICENSE files in the repository root for full details. import { test, expect, registerAccountMas } from "."; import { isDendrite } from "../../plugins/homeserver/dendrite"; +import { ElementAppPage } from "../../pages/ElementAppPage.ts"; test.describe("OIDC Native", () => { test.skip(isDendrite, "does not yet support MAS"); @@ -17,7 +18,7 @@ test.describe("OIDC Native", () => { labsFlags: ["feature_oidc_native_flow"], }); - test("can register the oauth2 client and an account", async ({ context, page, homeserver, mailhog, app, mas }) => { + test("can register the oauth2 client and an account", async ({ context, page, homeserver, mailhog, mas }) => { const tokenUri = `http://localhost:${mas.port}/oauth2/token`; const tokenApiPromise = page.waitForRequest( (request) => request.url() === tokenUri && request.postDataJSON()["grant_type"] === "authorization_code", @@ -36,6 +37,7 @@ test.describe("OIDC Native", () => { const deviceId = await page.evaluate(() => window.localStorage.mx_device_id); + const app = new ElementAppPage(page); await app.settings.openUserSettings("Account"); const newPagePromise = context.waitForEvent("page"); await page.getByRole("button", { name: "Manage account" }).click();