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
@@ -5,6 +5,8 @@
* Please see LICENSE files in the repository root for full details.
*/
import { rejectToast } from "@element-hq/element-web-playwright-common";
import { test, expect } from "../../../element-web-test";
import type { Locator, Page } from "playwright-core";
@@ -14,8 +16,8 @@ test.describe("Collapsible Room list", () => {
});
test.beforeEach(async ({ page, app, user }) => {
await app.closeVerifyToast();
await app.closeNotificationToast();
await rejectToast(page, "Verify this device");
await rejectToast(page, "Notifications");
for (let i = 0; i < 10; i++) {
await app.client.createRoom({ name: `room${i}` });
}
@@ -6,6 +6,7 @@
*/
import { type Page } from "@playwright/test";
import { rejectToast } from "@element-hq/element-web-playwright-common";
import { expect, test } from "../../../element-web-test";
import { assertRoomInSection, getRoomList, getRoomListHeader, getSectionHeader } from "./utils";
@@ -41,9 +42,9 @@ test.describe("Room list custom sections", () => {
}
test.beforeEach(async ({ page, app, user }) => {
// The notification toast is displayed above the search section
await app.closeNotificationToast();
await app.closeVerifyToast();
// The toasts are displayed above the search section
await rejectToast(page, "Notifications");
await rejectToast(page, "Verify this device");
// Focus the user menu to avoid hover decoration
await page.getByRole("button", { name: "User menu" }).focus();
@@ -7,6 +7,7 @@
import { type Visibility } from "matrix-js-sdk/src/matrix";
import { type Page } from "@playwright/test";
import { rejectToast } from "@element-hq/element-web-playwright-common";
import { expect, test } from "../../../element-web-test";
import { SettingLevel } from "../../../../src/settings/SettingLevel";
@@ -32,8 +33,8 @@ test.describe("Room list filters and sort", () => {
test.beforeEach(async ({ page, app, bot, user }) => {
// The toasts are displayed above the search section
await app.closeVerifyToast();
await app.closeNotificationToast();
await rejectToast(page, "Verify this device");
await rejectToast(page, "Notifications");
});
test("Tombstoned rooms are not shown even when they receive updates", async ({ page, app, bot }) => {
@@ -5,6 +5,8 @@
* Please see LICENSE files in the repository root for full details.
*/
import { rejectToast } from "@element-hq/element-web-playwright-common";
import { test, expect } from "../../../element-web-test";
import { getHeaderSection } from "./utils";
@@ -15,8 +17,8 @@ test.describe("Header section of the room list", () => {
test.beforeEach(async ({ page, app, user }) => {
// The toasts are displayed above the search section
await app.closeVerifyToast();
await app.closeNotificationToast();
await rejectToast(page, "Verify this device");
await rejectToast(page, "Notifications");
});
test("should render the header section", { tag: "@screenshot" }, async ({ page, app, user }) => {
@@ -5,6 +5,8 @@
* Please see LICENSE files in the repository root for full details.
*/
import { rejectToast } from "@element-hq/element-web-playwright-common";
import { test, expect } from "../../../element-web-test";
import { getRoomListView } from "./utils";
@@ -15,8 +17,8 @@ test.describe("Room list panel", () => {
test.beforeEach(async ({ page, app, user }) => {
// The toasts are displayed above the search section
await app.closeVerifyToast();
await app.closeNotificationToast();
await rejectToast(page, "Verify this device");
await rejectToast(page, "Notifications");
// Populate the room list
for (let i = 0; i < 20; i++) {
@@ -5,6 +5,8 @@
* Please see LICENSE files in the repository root for full details.
*/
import { rejectToast } from "@element-hq/element-web-playwright-common";
import { test, expect } from "../../../element-web-test";
import { getSearchSection } from "./utils";
@@ -15,8 +17,8 @@ test.describe("Search section of the room list", () => {
test.beforeEach(async ({ page, app, user }) => {
// The toasts are displayed above the search section
await app.closeVerifyToast();
await app.closeNotificationToast();
await rejectToast(page, "Verify this device");
await rejectToast(page, "Notifications");
});
test("should render the search section", { tag: "@screenshot" }, async ({ page, app, user }) => {
@@ -5,6 +5,8 @@
* Please see LICENSE files in the repository root for full details.
*/
import { rejectToast } from "@element-hq/element-web-playwright-common";
import { expect, test } from "../../../element-web-test";
import { assertRoomInSection, dragRoomToSection, getPrimaryFilters, getRoomList, getSectionHeader } from "./utils";
@@ -20,8 +22,8 @@ test.describe("Room list sections", () => {
test.beforeEach(async ({ page, app, user }) => {
// The toasts are displayed above the search section
await app.closeVerifyToast();
await app.closeNotificationToast();
await rejectToast(page, "Verify this device");
await rejectToast(page, "Notifications");
// focus the user menu to avoid to have hover decoration
await page.getByRole("button", { name: "User menu" }).focus();
@@ -6,6 +6,7 @@
*/
import { type Page } from "@playwright/test";
import { rejectToast } from "@element-hq/element-web-playwright-common";
import { expect, test } from "../../../element-web-test";
import { type Bot } from "../../../pages/bot";
@@ -23,8 +24,8 @@ test.describe("Room list", () => {
test.beforeEach(async ({ page, app, user }) => {
// The toasts are displayed above the search section
await app.closeVerifyToast();
await app.closeNotificationToast();
await rejectToast(page, "Verify this device");
await rejectToast(page, "Notifications");
// focus the user menu to avoid to have hover decoration
await page.getByRole("button", { name: "User menu" }).focus();