Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Ensure no race condition between page load and waitForRequest set up
Browse files Browse the repository at this point in the history
Fixes element-hq/element-web#27572

Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Oct 1, 2024
1 parent 39a0f6e commit 46120a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion playwright/e2e/oidc/oidc-native.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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",
Expand All @@ -36,6 +37,7 @@ test.describe("OIDC Native", () => {

const deviceId = await page.evaluate<string>(() => 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();
Expand Down

0 comments on commit 46120a7

Please sign in to comment.