I am getting the error "(page load)--waiting for new page to load--" when I click on any button in the application I am testing.
Given("I navigate to the Test page", () => {
cy.visit(
"https://tempurl.test"
);
cy.log("Before the @works");
cy.intercept("GET", "/api/works/*", { fixture: "work.json" }).as(
"mocks.work"
);
cy.get(
'[title="Title 1"] > [data-test="card-primary-action"]'
).click();
cy.get(
"#main > article.sc-Hyuyeu.hueuP > section:nth-child(1) > header > h2",
{ timeout: 10000 }
).should("be.visible");
});
This is my e2e.js:
import "./commands";
import "cypress-cucumber-attach-screenshots-to-failed-steps";
// Cypress.on("window:before:load", (win) => {
// win.document.__cypressIgnorePageLoadErrors = true;
// });
Cypress.on("window:load", (win) => {
win.document.__cypressIgnorePageLoadErrors = true;
});
Cypress.on('window:before:load', (win) => {
const original = win.EventTarget.prototype.addEventListener;
win.EventTarget.prototype.addEventListener = function (type, listener, options) {
if (type === 'DOMContentLoaded') {
return;
}
return original.apply(this, [type, listener, options]);
};
});
// Alternatively you can use CommonJS syntax:
// require('./commands')
require("@cypress/xpath");
I could see the new page, butting getting the error. Appreciate your help, thanks
I am expecting the date in work.json to be displayed in the page