Dismissing the accept cookies dialog

Viewed 18

For the web app that I am automating (cloud.redhat.com/openshift), I am working in a "preserve all cookies" mode:

Cypress.Cookies.defaults({
  preserve: /.*/, // match-all regexp
});

When I run my script - it correctly dismisses the accept cookies dialog that pops up right on the start, and proceeds to feeding in the login credentials. So far so good - but then the accept cookies dialog pops up a 2nd time :(, and this time Cypress doesn't dismiss it and gets stuck because the dialog covers the whole page.

Another peculiarity is that this problem doesn't happen when I run the script from the development environment, when I use "cypress open". It only happens when running the script from the command line, when I use "cypress run". The problem can be recreated in development as well if I switch from Chrome to Firefox. Why is there a difference between the behaviors when using "cypress open" and "cypress run", and when using a different browser? How can I dismiss or prevent the dialog from popping up a 2nd time? We're on Cypress 7.7, but I also tried recreating the problem in Cypress 10 and it happens there too.

0 Answers
Related