- pass environment variables using the
e2e.env
config key, and access them using Cypress.env('key')
- if testing across origins (for example, with a redirect), wrap any code that needs to access the secondary origin in
cy.origin
- all arguments must be passed into the callback manually using the
args
option
it('should redirect to the login page on another origin`, () => {
// base url http://example.com/
cy.visit('/login')
const loginDomain = Cypress.env('AUTH_DOMAIN')
cy.origin(loginDomain, { args: { loginDomain } }, ({ loginDomain }) => {
cy.url().should('include', loginDomain)
})
})