goudj
goudj

Reputation: 11

How to delete cookies from all domain after running tests of a single Feature File using cypress

I'm working on a web project. I use cypress to do my tests.

_  Cypress version 3.8.2
_  Cypress preprocessor : 2.0.1 (use Gherkin cucumber)
_ OS Mac book 8 Go
_ Node version: 10.7.0

I have the following features:

So I am able to run the tests in a file (.feature).

For example: when I run the tests which is in 01TestCaseprofileAdminRightAccess.feature The scenarios are executed without problem.

And then if I want to launch the tests which are in 02TestCaseprofileAdminRightAccess.feature the browser is displayed and crashes (no test scenario is executed).

So I have to delete cookies by hand so that cypress can run the tests.

I delete the List of cookies as describe in the link below:

https://www.allaboutcookies.org/manage-cookies/google-chrome.html

So my question is: Is there a way to tell Cypress to delete all cookies from the domains auth0, SSO, .com?

I have seen clearCookies () and even clearCookies ({domain: null}) and I added them each at the end of the scenario believing that it would solve the problem but nothing.

Upvotes: 1

Views: 2346

Answers (2)

I have used cy.clearAllCookies(), but it cannot clear all cookie of manage cookies and site data on chrome browser, it just clear all cookie of Application-> cookies in devtool

Upvotes: 0

voy
voy

Reputation: 717

Well, this issue is quite old and still not fixed, sadly. In the link I've provided you will find some solutions, but none of them works 100%.

Upvotes: 1

Related Questions