Use the rejectToast function from utils instead of a fixture

This commit is contained in:
Andy Balaam
2026-05-15 13:08:10 +01:00
parent 35537968c3
commit 746a022a95
@@ -6,6 +6,7 @@ Please see LICENSE files in the repository root for full details.
*/ */
import { type SynapseContainer } from "@element-hq/element-web-playwright-common/lib/testcontainers/index.js"; import { type SynapseContainer } from "@element-hq/element-web-playwright-common/lib/testcontainers/index.js";
import { rejectToastIfExists } from "@element-hq/element-web-playwright-common";
import { test, expect } from "../../../../playwright/element-web-test.ts"; import { test, expect } from "../../../../playwright/element-web-test.ts";
@@ -63,8 +64,8 @@ test.describe("Widget Lifecycle", () => {
}, },
}); });
test("auto-approves preload and identity", async ({ page, user, homeserver, toasts }, testInfo) => { test("auto-approves preload and identity", async ({ page, user, homeserver }, testInfo) => {
toasts.rejectToastIfExists("Verify this device"); rejectToastIfExists(page, "Verify this device");
// A bot creates a room with the widget pinned to the top panel, then invites the test user. // A bot creates a room with the widget pinned to the top panel, then invites the test user.
// Because the widget was added by a different user (the bot), Element would normally show a // Because the widget was added by a different user (the bot), Element would normally show a
@@ -121,8 +122,8 @@ test.describe("Widget Lifecycle", () => {
).toBeVisible(); ).toBeVisible();
}); });
test("prompts for capabilities not in the allowlist", async ({ page, user, homeserver, toasts }, testInfo) => { test("prompts for capabilities not in the allowlist", async ({ page, user, homeserver }, testInfo) => {
toasts.rejectToastIfExists("Verify this device"); rejectToastIfExists(page, "Verify this device");
const bot = await homeserver.registerUser(`bot_${testInfo.testId}`, "password", "Bot"); const bot = await homeserver.registerUser(`bot_${testInfo.testId}`, "password", "Bot");
const { room_id: roomId } = await homeserver.csApi.request<{ room_id: string }>( const { room_id: roomId } = await homeserver.csApi.request<{ room_id: string }>(
@@ -184,9 +185,8 @@ test.describe("Widget Lifecycle", () => {
page, page,
user, user,
homeserver, homeserver,
toasts,
}, testInfo) => { }, testInfo) => {
toasts.rejectToastIfExists("Verify this device"); rejectToastIfExists(page, "Verify this device");
const bot = await homeserver.registerUser(`bot_${testInfo.testId}`, "password", "Bot"); const bot = await homeserver.registerUser(`bot_${testInfo.testId}`, "password", "Bot");
const { room_id: roomId } = await homeserver.csApi.request<{ room_id: string }>( const { room_id: roomId } = await homeserver.csApi.request<{ room_id: string }>(