Created
September 26, 2021 17:51
-
-
Save riccardogiorato/46dad7ddc78bc3fe43e6d2f515eb3507 to your computer and use it in GitHub Desktop.
This file contains 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 urlHttp = "http://tesla.com"; | |
it(urlHttp + " end location", () => { | |
cy.visit(urlHttp); | |
cy.url().should("eq", baseUrlTesla); | |
}); | |
it(urlHttp + " redirect", () => { | |
cy.request({ | |
url: urlHttp, | |
followRedirect: false, // turn off following redirects | |
}).then((resp) => { | |
// redirect status code is 301 | |
expect(resp.status).to.eq(301); | |
expect(resp.redirectedToUrl).to.eq(baseUrlTesla); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment