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

This commit is contained in:
Andy Balaam
2026-05-18 17:31:52 +01: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