Skip to content
Discussion options

You must be logged in to vote

@diogormendes This likely how your test is written given how this value is resolving at the time these commands are being queued.

If you have:

.then(() => {
  Cypress.env('token', 'val')
})

cy.log(Cypress.env('token'))

The Cypress.env('token') value at the time cy.log() is added indeed undefined.

If you were add the cy.log() in a then callback, it would be be queued after the env value has been set, it will be defined:

.then(() => {
  Cypress.env('token', 'val')
})
.then(() => {
  cy.log(Cypress.env('token'))
})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by diogormendes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants