mirror of https://github.com/vector-im/riot-web
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>pull/28192/head
parent
2da5d9b1c1
commit
2a183c76c9
|
@ -8,6 +8,7 @@ Please see LICENSE files in the repository root for full details.
|
||||||
|
|
||||||
import { test, expect, registerAccountMas } from ".";
|
import { test, expect, registerAccountMas } from ".";
|
||||||
import { isDendrite } from "../../plugins/homeserver/dendrite";
|
import { isDendrite } from "../../plugins/homeserver/dendrite";
|
||||||
|
import { ElementAppPage } from "../../pages/ElementAppPage.ts";
|
||||||
|
|
||||||
test.describe("OIDC Native", () => {
|
test.describe("OIDC Native", () => {
|
||||||
test.skip(isDendrite, "does not yet support MAS");
|
test.skip(isDendrite, "does not yet support MAS");
|
||||||
|
@ -17,7 +18,7 @@ test.describe("OIDC Native", () => {
|
||||||
labsFlags: ["feature_oidc_native_flow"],
|
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 tokenUri = `http://localhost:${mas.port}/oauth2/token`;
|
||||||
const tokenApiPromise = page.waitForRequest(
|
const tokenApiPromise = page.waitForRequest(
|
||||||
(request) => request.url() === tokenUri && request.postDataJSON()["grant_type"] === "authorization_code",
|
(request) => request.url() === tokenUri && request.postDataJSON()["grant_type"] === "authorization_code",
|
||||||
|
@ -36,6 +37,7 @@ test.describe("OIDC Native", () => {
|
||||||
|
|
||||||
const deviceId = await page.evaluate<string>(() => window.localStorage.mx_device_id);
|
const deviceId = await page.evaluate<string>(() => window.localStorage.mx_device_id);
|
||||||
|
|
||||||
|
const app = new ElementAppPage(page);
|
||||||
await app.settings.openUserSettings("Account");
|
await app.settings.openUserSettings("Account");
|
||||||
const newPagePromise = context.waitForEvent("page");
|
const newPagePromise = context.waitForEvent("page");
|
||||||
await page.getByRole("button", { name: "Manage account" }).click();
|
await page.getByRole("button", { name: "Manage account" }).click();
|
||||||
|
|
Loading…
Reference in New Issue