Change all toast rejection code to use the rejectToast utility (#33025)

This commit is contained in:
Andy Balaam
2026-05-18 16:31:52 +00:00
committed by GitHub
parent d40fe81616
commit 5be0b778db
29 changed files with 150 additions and 107 deletions
@@ -6,6 +6,8 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import { rejectToast } from "@element-hq/element-web-playwright-common";
import type { Locator, Page } from "@playwright/test";
import { test, expect } from "../../element-web-test";
import type { Preset, ICreateRoomOpts } from "matrix-js-sdk/src/matrix";
@@ -68,7 +70,7 @@ test.describe("Spaces", () => {
"should allow user to create public space",
{ tag: ["@screenshot", "@no-webkit"] },
async ({ page, app, user }) => {
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
const contextMenu = await openSpaceCreateMenu(page);
await expect(contextMenu).toMatchScreenshot("space-create-menu.png");
@@ -105,7 +107,7 @@ test.describe("Spaces", () => {
);
test("should allow user to create private space", { tag: "@screenshot" }, async ({ page, app, user }) => {
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
const menu = await openSpaceCreateMenu(page);
await menu.getByRole("button", { name: "Private" }).click();
@@ -152,7 +154,7 @@ test.describe("Spaces", () => {
name: "Sample Room",
});
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
const menu = await openSpaceCreateMenu(page);
await menu.getByRole("button", { name: "Private" }).click();
@@ -187,7 +189,7 @@ test.describe("Spaces", () => {
name: "A Room that will not be selected",
});
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
const menu = await openSpaceCreateMenu(page);
await menu.getByRole("button", { name: "Private" }).click();
@@ -287,7 +289,7 @@ test.describe("Spaces", () => {
"should render subspaces in the space panel only when expanded",
{ tag: "@screenshot" },
async ({ page, app, user, axe }) => {
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
axe.disableRules([
// Disable this check as it triggers on nested roving tab index elements which are in practice fine
@@ -413,7 +415,7 @@ test.describe("Spaces", () => {
});
test("should disallow creating public rooms", { tag: "@screenshot" }, async ({ page, user, app }) => {
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
const menu = await openSpaceCreateMenu(page);
await menu
.locator('.mx_SpaceBasicSettings_avatarContainer input[type="file"]')