Use the toasts utils instead of the toasts fixture in playwright tests (#33495)
This commit is contained in:
@@ -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 { acceptToast, assertNoToasts, rejectToast } from "@element-hq/element-web-playwright-common";
|
||||
|
||||
import { test } from "../../element-web-test";
|
||||
|
||||
test.describe("Analytics Toast", () => {
|
||||
@@ -13,10 +15,10 @@ test.describe("Analytics Toast", () => {
|
||||
displayName: "Tod",
|
||||
});
|
||||
|
||||
test("should not show an analytics toast if config has nothing about posthog", async ({ user, toasts }) => {
|
||||
await toasts.rejectToast("Verify this device");
|
||||
await toasts.rejectToast("Notifications");
|
||||
await toasts.assertNoToasts();
|
||||
test("should not show an analytics toast if config has nothing about posthog", async ({ user, page }) => {
|
||||
await rejectToast(page, "Verify this device");
|
||||
await rejectToast(page, "Notifications");
|
||||
await assertNoToasts(page);
|
||||
});
|
||||
|
||||
test.describe("with posthog enabled", () => {
|
||||
@@ -29,19 +31,19 @@ test.describe("Analytics Toast", () => {
|
||||
},
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ user, toasts }) => {
|
||||
await toasts.rejectToast("Verify this device");
|
||||
await toasts.rejectToast("Notifications");
|
||||
test.beforeEach(async ({ user, page }) => {
|
||||
await rejectToast(page, "Verify this device");
|
||||
await rejectToast(page, "Notifications");
|
||||
});
|
||||
|
||||
test("should show an analytics toast which can be accepted", async ({ user, toasts }) => {
|
||||
await toasts.acceptToast("Help improve Element");
|
||||
await toasts.assertNoToasts();
|
||||
test("should show an analytics toast which can be accepted", async ({ user, page }) => {
|
||||
await acceptToast(page, "Help improve Element");
|
||||
await assertNoToasts(page);
|
||||
});
|
||||
|
||||
test("should show an analytics toast which can be rejected", async ({ user, toasts }) => {
|
||||
await toasts.rejectToast("Help improve Element");
|
||||
await toasts.assertNoToasts();
|
||||
test("should show an analytics toast which can be rejected", async ({ user, page }) => {
|
||||
await rejectToast(page, "Help improve Element");
|
||||
await assertNoToasts(page);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user