I have the following simple test:
describe("smoke test", () => {
it("visit site", async () => {
cy.visit(SITE_URL);
return new Promise((resolve) => cy.contains("banner text").should("be.visible").then(resolve));
});
});
Cypress warns me that it is not necessary to return a promise. But if I remove it the test passes immediately, even if the site is not up:
describe("smoke test", () => {
it("visit site", async () => {
cy.visit(SITE_URL);
cy.contains("banner text").should("be.visible");
});
});
Is there a better way of fixing this test; is Cypress' warning wrong or is it something in my code?