Skip to content
Discussion options

You must be logged in to vote

@roydekleijn cy.session() will preserve the cookies for you so using the command similar to the following will persist these cookies for you:

beforeEach(() => {
  cy.session('unique_id', () => {
    // logic to establish the cookies you need to preserver
  })
})

it('', () => {
  // cookies have been applied from saved session in before-each hook
  cy.visit('url_to_test')
  // ....
})

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@roydekleijn
Comment options

@jozso39
Comment options

Answer selected by emilyrohrbough
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: session Issues when using session command
3 participants