cypress icon indicating copy to clipboard operation
cypress copied to clipboard

Cypress crash after submitting in iframe

Open SimonGiraudMVMS opened this issue 2 years ago • 4 comments

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...

SimonGiraudMVMS avatar Jul 10 '23 14:07 SimonGiraudMVMS

@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?).

MikeMcC399 avatar Jul 10 '23 15:07 MikeMcC399

@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?

nagash77 avatar Jul 10 '23 16:07 nagash77

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

SimonGiraudMVMS avatar Jul 11 '23 07:07 SimonGiraudMVMS

@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)

MikeMcC399 avatar Jul 11 '23 07:07 MikeMcC399

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

sandeepkuri avatar Jul 19 '23 18:07 sandeepkuri

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.

nagash77 avatar Jul 19 '23 20:07 nagash77

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.

SimonGiraudMVMS avatar Jul 20 '23 06:07 SimonGiraudMVMS

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.

nagash77 avatar Jul 25 '23 13:07 nagash77

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?

ManuC84 avatar Sep 11 '23 19:09 ManuC84

@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.

jennifer-shehane avatar Oct 05 '23 14:10 jennifer-shehane

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 avatar Jan 22 '24 11:01 DobQA

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

DobQA avatar Jan 22 '24 11:01 DobQA

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 avatar Jul 21 '24 01:07 cypress-app-bot

This issue has been closed due to inactivity.

cypress-app-bot avatar Aug 04 '24 01:08 cypress-app-bot