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 { expect, test } from ".";
test.describe("Appearance user settings tab", () => {
@@ -14,7 +16,7 @@ test.describe("Appearance user settings tab", () => {
});
test("should be rendered properly", { tag: "@screenshot" }, async ({ page, user, app, axe }) => {
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
const tab = await app.settings.openUserSettings("Appearance");
// Click "Show advanced" link button
@@ -32,7 +34,7 @@ test.describe("Appearance user settings tab", () => {
"should support changing font size by using the font size dropdown",
{ tag: "@screenshot" },
async ({ page, app, user }) => {
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
await app.settings.openUserSettings("Appearance");
const tab = page.getByTestId("mx_AppearanceUserSettingsTab");
@@ -48,7 +50,7 @@ test.describe("Appearance user settings tab", () => {
);
test("should support enabling system font", async ({ page, app, user }) => {
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
await app.settings.openUserSettings("Appearance");
const tab = page.getByTestId("mx_AppearanceUserSettingsTab");
@@ -66,7 +68,7 @@ test.describe("Appearance user settings tab", () => {
"should keep same font and emoji when switching theme",
{ tag: "@screenshot" },
async ({ page, app, user, util }) => {
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
const roomId = await util.createAndDisplayRoom();
@@ -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 { expect, test } from ".";
test.describe("Appearance user settings tab", () => {
@@ -14,10 +16,10 @@ test.describe("Appearance user settings tab", () => {
});
test.describe("Theme Choice Panel", () => {
test.beforeEach(async ({ app, user, util }) => {
test.beforeEach(async ({ app, page, user, util }) => {
// Disable the default theme for consistency in case ThemeWatcher automatically chooses it
await util.disableSystemTheme();
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
await util.openAppearanceTab();
});
@@ -104,7 +106,7 @@ test.describe("Appearance user settings tab", () => {
await expect(page).toMatchScreenshot("window-custom-theme.png");
await page.reload();
await app.closeVerifyToast();
await rejectToast(page, "Verify this device");
await util.openAppearanceTab();
// Assert that the custom theme is still selected after reloading the page
@@ -5,7 +5,7 @@
* Please see LICENSE files in the repository root for full details.
*/
import { createNewInstance } from "@element-hq/element-web-playwright-common";
import { createNewInstance, rejectToast } from "@element-hq/element-web-playwright-common";
import { type StartedHomeserverContainer } from "@element-hq/element-web-playwright-common/lib/testcontainers";
import { type Page, type Browser, type TestInfo } from "@playwright/test";
@@ -99,7 +99,7 @@ test.describe("Other people's devices section in Encryption tab", () => {
// Create the room and invite bob
await inviteBobToNewRoom(alicePage, aliceElementApp, bobCredentials, bobPage);
await bobElementApp.closeNotificationToast();
await rejectToast(alicePage, "Notifications");
// Perform verification.
await verifyApp("alice", aliceElementApp, "bob", bobElementApp);
@@ -7,6 +7,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 { test, expect } from "../../element-web-test";
const IntegrationManager = "scalar.vector.im";
@@ -27,8 +29,8 @@ test.describe("Security user settings tab", () => {
test.beforeEach(async ({ page, app, user }) => {
// Dismiss toasts
await app.closeVerifyToast();
await app.closeNotificationToast();
await rejectToast(page, "Verify this device");
await rejectToast(page, "Notifications");
await page.locator(".mx_Toast_buttons").getByRole("button", { name: "Yes" }).click(); // Allow analytics
});