cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.53k stars 3.2k forks source link

Cypress redirects outside of AUT and into main runner URL after submitting in iframe #27249

Closed SimonGiraudMVMS closed 4 months ago

SimonGiraudMVMS commented 1 year ago

Current behavior

When I run a Cypress test that involves making a payment within an IFRAME, the Cypress window closes and the test does not complete.

I know cypress does not support testing within an iframe, but I can type in my inputs, I just want to know why the widow crash/shutdown

Desired behavior

When I run a Cypress test that involves making a payment within an IFRAME, the Cypress test works and I have results

I know cypress does not support testing within an iframe, but I can type in my inputs, I just want to know why the widow crash/shutdown

Test code to reproduce

    cy.get('.__PrivateStripeElement > iframe').then(($iframe) => {

      const iframeContent = $iframe.contents();

      const cardNumberInput = iframeContent.find('[id="Field-numberInput"]');
      const expiryInput = iframeContent.find('[id="Field-expiryInput"]');
      const cvcInput = iframeContent.find('[id="Field-cvcInput"]');

      cy.get(cardNumberInput).type('4242424242424242');
      cy.get(expiryInput).type('1224');
      cy.get(cvcInput).type('123');

      cy.sleep(5000)

      cy.get(BUTTON_SUBMIT).click()

https://github.com/cypress-io/cypress/assets/97966610/f2b44ab7-621e-48ab-9f8e-8bc216fe628d

Cypress Version

v11.2.0

Node version

v18.13.0

Operating System

macOS 12.6.1

Debug Logs

none

Other

I know cypress does not support testing within an iframe, but I can type in my inputs, I just want to know why the widow crash/shutdown, so stop closing my thread whitout give me a reel response...

MikeMcC399 commented 1 year ago

@SimonGiraudMVMS

You wrote that you are using Node.js 6.9.0. Could you double-check with node -v? The lowest supported version of Node.js according to the Release Schedule is Node.js 16.

Have you also checked with the latest version of Cypress (12.17.0) to see if it also crashes? The version of Cypress in your issue is 11.2.0 which was released last year. If your expectation is that the crash should be fixed, then it would need to be reproducible in the latest version.

(I'm not saying here that the Cypress team will follow up, since they already closed your previous issue https://github.com/cypress-io/cypress/issues/27244 because Cypress doesn't currently support testing in iframes - See FAQ How do I test elements inside an iframe?).

nagash77 commented 1 year ago

@SimonGiraudMVMS Do you see the same behavior using the latest version of Cypress? Can you run with debug logs on and see what error message is being printed there?

SimonGiraudMVMS commented 1 year ago

Yes I see the same behavior using the lastest version... And i cannot run with debug log because the window close itself :(

MikeMcC399 commented 1 year ago

@SimonGiraudMVMS

i cannot run with debug log because the window close itself

Do you see a log in the Terminal window you used to start Cypress?

You may also be able to run Cypress without using the Cypress app, for instance:

export DEBUG=cypress:*
npx cypress run

(instead of using npx cypress open)

sandeepkuri commented 1 year ago

Hello, I'm also having the same issue in Open mode, Cypress test is stopping itself and I'm directed to the Specs page. I'm trying to click on a model popup

nagash77 commented 1 year ago

Right now there doesn't seem to be enough information to reproduce the problem on our end. Unless we receive a reliable reproduction, we'll eventually have to close this issue until we can reproduce it. This does not mean that your issue is not happening - it just means that we do not have a path to move forward.

Can anyone on this thread provide a reproducible example of the issue you're encountering. Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide.

Forking Cypress Test Tiny makes sharing a reproducible example easier to share and easier for our engineers to replicate your issues. This method also keeps the reproduction as simple as possible, which helps us eliminate potential causes and noise from the investigation.

SimonGiraudMVMS commented 1 year ago

I gave you code, and a video of what happen, what can i do more ? @nagash77 We are many to have this issue, its not the first thread on this issue...

I tried "the export DEBUG=cypress:*" @MikeMcC399 but it seen to make my terminal crazy and i havnt no more information... Maybe I don't know how to use it.

nagash77 commented 1 year ago

Hi @SimonGiraudMVMS sorry for the confusion, I was replying to the commenter who was saying they were also seeing this problem. Have you tried running Cypress in run mode as @MikeMcC399 suggested? And then attach the relevant portion of your debug logs.

If you are having issues figuring out how to run with debug logs turned on please check out the Cypress Discord Community Discord chat, it can be helpful for debugging or answering questions on how to use Cypress.

ManuC84 commented 1 year ago

This issue is happening to many users. We cannot test our Stripe Elements flow due to this issue. Should we move to playwright or is there any hope for this to be solved in the short term?

jennifer-shehane commented 1 year ago

@ManuC84 We want to help and fix issues that are happening. Can you provide a reproducible example? There is no code in this thread that we can run and reproduce the issue. There's a large amount of reasons this could be happening. Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide.

DobQA commented 10 months ago

Hi all, we are facing same issue with a different payment provider, exact same thing happens as in video, debug logs do not seem to be helping us, in fact this issue seems not related to payment itself but any iFrame @jennifer-shehane not to sound rude but I think I posted before on other threads, the expectation is that user submit in code/repo this is not always possible due to number reasons. I dont understand why a member of the QA team on your side cannot investigate this. To reproduce error, download latest Cypress, latest node, latest Chrome, pick a site that as a iFrame popup (payment site) and includes a redirect. Test to see if Cypress crash.

DobQA commented 10 months ago

@SimonGiraudMVMS Did you manage to solve this issue in the end?

cypress-app-bot commented 4 months ago

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

cypress-app-bot commented 4 months ago

This issue has been closed due to inactivity.