fix discarding pop ups
This commit is contained in:
@@ -98,10 +98,8 @@ export class TestHelpers {
|
|||||||
timeout: 15_000,
|
timeout: 15_000,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Clean up any toasts that may block the screen
|
await this.maybeDismissBrowserNotSupportedToast(page);
|
||||||
await TestHelpers.closeNotificationToast(page);
|
await this.maybeDismissServiceWorkerWarningToast(page);
|
||||||
// focus the user menu to avoid having hover decoration
|
|
||||||
await page.getByRole("button", { name: "User menu" }).focus();
|
|
||||||
|
|
||||||
await TestHelpers.setDevToolElementCallDevUrl(page);
|
await TestHelpers.setDevToolElementCallDevUrl(page);
|
||||||
|
|
||||||
@@ -116,15 +114,42 @@ export class TestHelpers {
|
|||||||
return { page, clientHandle, mxId };
|
return { page, clientHandle, mxId };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private static async maybeDismissBrowserNotSupportedToast(
|
||||||
* Close the notification toast
|
page: Page,
|
||||||
*/
|
): Promise<void> {
|
||||||
public static async closeNotificationToast(page: Page): Promise<void> {
|
const browserUnsupportedToast = page
|
||||||
// Dismiss "Notification" toast
|
.getByText("Element does not support this browser")
|
||||||
return page
|
.locator("..")
|
||||||
.locator(".mx_Toast_toast", { hasText: "Notifications" })
|
.locator("..");
|
||||||
.getByRole("button", { name: "Dismiss" })
|
|
||||||
.click();
|
// Dismiss incompatible browser toast
|
||||||
|
const dismissButton = browserUnsupportedToast.getByRole("button", {
|
||||||
|
name: "Dismiss",
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
await expect(dismissButton).toBeVisible({ timeout: 700 });
|
||||||
|
await dismissButton.click();
|
||||||
|
} catch {
|
||||||
|
// dismissButton not visible, continue as normal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async maybeDismissServiceWorkerWarningToast(
|
||||||
|
page: Page,
|
||||||
|
): Promise<void> {
|
||||||
|
const toast = page
|
||||||
|
.locator(".mx_Toast_toast")
|
||||||
|
.getByText("Failed to load service worker");
|
||||||
|
|
||||||
|
try {
|
||||||
|
await expect(toast).toBeVisible({ timeout: 700 });
|
||||||
|
await page
|
||||||
|
.locator(".mx_Toast_toast")
|
||||||
|
.getByRole("button", { name: "OK" })
|
||||||
|
.click();
|
||||||
|
} catch {
|
||||||
|
// toast not visible, continue as normal
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async createRoom(
|
public static async createRoom(
|
||||||
|
|||||||
Reference in New Issue
Block a user