Created
September 26, 2021 17:54
-
-
Save riccardogiorato/e123e3d1bd30aea94869a62cf96b145e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const baseUrlTesla = "https://www.tesla.com/"; | |
const url404test = "https://www.tesla.com/not-a-real-page"; | |
it("404 'not found' response", () => { | |
cy.request({ | |
url: url404test, | |
followRedirect: false, | |
failOnStatusCode: false, | |
}).then((resp) => { | |
expect(resp.status).to.eq(404); | |
expect(resp.redirectedToUrl).to.eq(undefined); | |
}); | |
cy.visit(url404test, { failOnStatusCode: false }); | |
cy.get(".error-code").should("contain", "404"); | |
cy.get(".error-text").should("contain", "Page not found"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment