Google Funding Choices popup in Cypress

562 views Asked by At

Our application uses Google Funding Choices. When the page is opened manually, the cookie consent dialog appears almost immediately after page load. When running the same scenario in Cypress, the consent dialog pops up only after certain interaction (clicking, typing) - completly undeterministic. It takes about 20 seconds for it to appear. The second problem is, I can´t click any of those buttons inside the popup. It is covering not only the page itself, but the whole Cypress runner: enter image description here

The test is being run through CLI, browser is set to Chrome with --headed flag.

I´m trying to close the popup using:

cy.get('.fc-primary-button', { timeout: 30000 }).click()

but it fails to find the element (or any of the elements related to this popup).

What I tried so far with no use:

  • change the browser,
  • change to headless,
  • create the FCCDCF and FCNEC cookie
  • put cy.wait(8000) between cy.visit() and other stuff
  • intercept any request to https://fundingchoicesmessages.google.com and destroy it

It would be ideal for me to be able to completly bypass this popup, but we cannot turn it off on a live project.

Any thoughts or tips?

0

There are 0 answers