-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Inspired from cypress-io/cypress#27050
Current behavior
If my Web app uses the hash router, I cannot seem to be able to visit the same url twice.
If I have Cypress.env("baseUrl") = "https://my-example-app.com/"
I cannot have cy.visit("#/login")
or cy.visit("https://my-example-app.com/#/login")
in the first and the second it()
.
I cannot have it in a beforeEach()
hook with two tests either.
However cy.visit("")
and cy.visit("https://my-example-app.com/")
work well, even though I am redirected by the page to #/login
immediately.
Desired behavior
The cy.visit("#/login")
in the second it()
or second trigger of beforeEach()
should load the page correctly.
Test code to reproduce
describe("Visit login page", () => {
it("Working", () => {
cy.visit("#/login"); // loads page correctly
cy.get("img.logo").should("be.visible"); // finds the logo image
});
it("Page is blank", () => {
cy.visit("#/login"); // loads a blank page
cy.get("img.logo").should("be.visible"); // does not find the logo image
});
});
Pivot point
I have this behaviour when cypress\support\e2e.(ts|js)
contains import "@bahmutov/cy-api";
.
This problem is gone when I comment it out.
Cypress Version
v12.14.0
Node version
v18.16.0
Operating System
Windows 11 Pro 22H2 Build 22621.1702
Debug Logs
No response
Other
No response