Fix: cypress toasts/analytics-toast.spec.ts failures (#11153)

* Revert "skip broken analytics tests (#11144)"

This reverts commit 83ee1946ea.

* reset window notification permission between tets
This commit is contained in:
Kerry 2023-06-29 09:02:58 +12:00 committed by GitHub
parent ac9dd8307f
commit 3de2bcdc1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View file

@ -25,7 +25,7 @@ describe("Security user settings tab", () => {
cy.stopHomeserver(homeserver); cy.stopHomeserver(homeserver);
}); });
describe.skip("with posthog enabled", () => { describe("with posthog enabled", () => {
beforeEach(() => { beforeEach(() => {
// Enable posthog // Enable posthog
cy.intercept("/config.json?cachebuster=*", (req) => { cy.intercept("/config.json?cachebuster=*", (req) => {

View file

@ -39,7 +39,7 @@ function rejectToast(expectedTitle: string): void {
}); });
} }
describe.skip("Analytics Toast", () => { describe("Analytics Toast", () => {
let homeserver: HomeserverInstance; let homeserver: HomeserverInstance;
afterEach(() => { afterEach(() => {

View file

@ -137,7 +137,14 @@ Cypress.Commands.add(
prelaunchFn?.(); prelaunchFn?.();
return cy return cy
.visit("/") .visit("/", {
onBeforeLoad(win) {
// reset notification permissions so we have predictable behaviour
// of notifications toast
// @ts-ignore allow setting default
cy.stub(win.Notification, "permission", "default");
},
})
.then(() => { .then(() => {
// wait for the app to load // wait for the app to load
return cy.get(".mx_MatrixChat", { timeout: 30000 }); return cy.get(".mx_MatrixChat", { timeout: 30000 });