Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors originating on cy.origin domain have started leaking out into main domain #30482

Open
Helveg opened this issue Oct 29, 2024 · 1 comment
Labels
stage: needs information Not enough info to reproduce the issue

Comments

@Helveg
Copy link

Helveg commented Oct 29, 2024

Current behavior

I used to disable Discord and Stripe errors inside of a cy.origin block like so:

      cy.origin(
        'https://checkout.stripe.com',
        { args: { expiryDate: format(addMonths(new Date(), 2), 'MMyy') } },
        ({ expiryDate }: { expiryDate: string }) => {
          cy.on('uncaught:exception', (err) => {
            // Allow any error to occur on the Stripe page, hope for the best.
            return false;
          });

This worked with 100% reliability across easily a thousand test samples, for months. Now, on the latest version (I haven't checked which version reverting to might work), I need to also add the same cy.on('uncaught:exception', ...) error silencer outside of the origin block or Stripe's uncaught exceptions are raised after returning back from the Stripe page:

      cy.on('uncaught:exception', (err) => {
        // Allow any error to occur on the Stripe page, hope for the best.
        return false;
      });

      cy.origin(
        'https://checkout.stripe.com',
        { args: { expiryDate: format(addMonths(new Date(), 2), 'MMyy') } },
        ({ expiryDate }: { expiryDate: string }) => {
          cy.on('uncaught:exception', (err) => {
            // Allow any error to occur on the Stripe page, hope for the best.
            return false;
          });
         // Stripe testing code
         // ...
         // Stripe redirects back to my web app
       })

Intuitively it seems like the still running Stripe code, or Stripe launched promises, cause errors after Cypress has already returned out of the origin block to my web app's page.

Desired behavior

All errors originating from inside an origin block should be caught there and not interfere with my web app's testing code.

Test code to reproduce

Stripe throws a lot of errors by default, any cy.origin to a valid Stripe Checkout URL should exhibit this behaviour. Please note that I have the experimental obstructive third party code flag enabled.

Cypress Version

13.13.0

Node version

20

Operating System

Windows 11

Debug Logs

No response

Other

No response

@jennifer-shehane
Copy link
Member

@Helveg It'd be helpful to narrow down the release this was introduced in. We made a change in 13.9.0 around unhandled errors: #29454 to handled undefined errors, but I'm not sure why that would impact this situation.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: needs information Not enough info to reproduce the issue
Projects
None yet
Development

No branches or pull requests

2 participants