You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have recently created a couple of tests for a new functionality we are working on, and realized that the cookies are not being cleared between my two spec files only when I run them headlessly.
So, my set up is of this kind
SpecFile1:
- before hook including cy.visit() and google OAuth login
- it('test case 1', () => {})
SpecFile2:
- beforeEach hook including cy.visit() and google OAuth login
- it('test case 1', () => {})
- it('test case 2', () => {})
- it('test case 3', () => {})
If I run this in interactive mode, everything passes; but when running from command line, I get an error in the beforeEach hook of the second spec file. The failure says that it cannot find the Login button, and that is because the user is already logged in (checked it in the video).
If I add a before hook in the second spec file including a cy.clearCookies() statement, it will work in both interactive and headless mode.
Desired behavior:
Cypress clears all cookies upon running a new spec file in both interactive and headless mode.
Steps to reproduce:
Two spec files performing a login in the beforeEach hook (I used OAuth against Google)
Do not clear cookies manually after the test in SpecFile1 or before the test in SpecFile2
Run headlessly
Versions
Cypress 3.1.0
Electron browser
Ubuntu Linux 16.04
The text was updated successfully, but these errors were encountered:
davidzambrana
changed the title
Cypress not clearing cookies between different spec files
Cypress not clearing cookies between different spec files when running headlessly
Aug 23, 2018
Current behavior:
I have recently created a couple of tests for a new functionality we are working on, and realized that the cookies are not being cleared between my two spec files only when I run them headlessly.
So, my set up is of this kind
If I run this in interactive mode, everything passes; but when running from command line, I get an error in the beforeEach hook of the second spec file. The failure says that it cannot find the Login button, and that is because the user is already logged in (checked it in the video).
If I add a
before
hook in the second spec file including acy.clearCookies()
statement, it will work in both interactive and headless mode.Desired behavior:
Cypress clears all cookies upon running a new spec file in both interactive and headless mode.
Steps to reproduce:
beforeEach
hook (I used OAuth against Google)Versions
Cypress 3.1.0
Electron browser
Ubuntu Linux 16.04
The text was updated successfully, but these errors were encountered: