'Cypress never finish load url
After fill out a form and clicking the submit button the url stays loaded, I think it may be a problem with the cypress browser
test.spect.js
describe("Fly search test", () => {
it("search a fly", () => {
const date= "25032022"
cy.visit(
"https://www.iberia.com/es/?_gl=1*1ayp8fc*_up*MQ..&gclid=Cj0KCQiAmKiQBhClARIsAKtSj-neqDTv4PYhWOYpXRBEoBkm7XiUJxp7UVTNYyN9JTWIZbVH8RD05AcaAlt9EALw_wcB"
);
cy.findByText("Aceptar todas las cookies").click();
cy.selectCity('flight_origin',"MAD",/\(MAD\)/i);
cy.selectCity('flight_destiny',"BCN",/\(BCN\)/i);
cy.get('[id="ticketops-seeker-button"]').click();
cy.findByRole('option', {
name: /solo ida/i
}).click()
cy.findByText(/fecha id/i).click().type(date);
cy.get('[id="buttonSubmit1"]').click();
});
});
cypress.json
{
"ignoreTestFiles": "**/examples/*",
"viewportHeight": 1080,
"viewportWidth": 1920,
"chromeWebSecurity": false
}
commands.js
import "@testing-library/cypress/add-commands";
Cypress.Commands.add("selectCity", (place,departureCity,regex)=>{
cy.get(`[name='${place}']`).click({force:true}).type(departureCity)
cy.get(`[title]`).contains(regex).click()
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
