DevExpress / testcafe

A Node.js tool to automate end-to-end web testing.
https://testcafe.io
MIT License
9.82k stars 673 forks source link

SwitchToIFrame hangs on 1.20.1 and 2.0.1 , but worked OK on 1.19.0 #7331

Closed fmancardi closed 1 year ago

fmancardi commented 2 years ago

What is your Scenario?

I have to fill a form that is openen in a iFrame,

What is the Current behavior?

switchToIframe hangs forever

What is the Expected behavior?

switch to the iframe

What is your public website URL? (or attach your complete example)

test is too complicated to provide here

What is your TestCafe test code?

-

Your complete configuration file

-

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

create a sample page with a button to open an iframe

TestCafe version

1.20.1 and 2.0.1

Node.js version

v18.4.0

Command-line arguments

testcafe 'chrome --start-fullscreen' --test-meta WKFSTATUS=ready,7.0=yes --cfg=at-7.0.json ./test/product-tree/PT.05.TMS.Planning/Multiappuntamento/PPT-7490-Conf-creaTrasp-outb-singAppun-Fascia.js

Browser name(s) and version(s)

chrome

Platform(s) and version(s)

windows 11

Other

No response

github-actions[bot] commented 2 years ago

Thank you for submitting this issue. We would love to assist you and diagnose it. However, we need a simple sample that we can easily run on our side in order to replicate the issue and research its cause. Without a sample, we are not able to figure out what's going on and why this issue occurs. Refer to this article to create the best example: How To: Create a Minimal Working Example When You Submit an Issue. We look forward to your response.

fmancardi commented 2 years ago

iFrameIssue.zip

Here the example, testcafe version 2.0.1

Aleksey28 commented 2 years ago

Hi @fmancardi,

Thank you for the example. I managed to reproduce the issue. I understand why this behavior occurs but it will take some time to fix it. At the moment, as a workaround, you need to set a timeout approximately to 500ms before switching to the iframe.

await t.wait(500)
aflalves commented 1 year ago

I have the same issue (or very similar) after updating testcafe version. I was on v1.19.0 and the issue started after v2 update. I've spend a lot of time debugging today, the provided workaround doesn't help, here are some details:

When the element that loads the iFrame is clicked, testcafe hangs and the await t.click() promise is never resolved, so I don't even get a chance to call switchToIframe after the click, chaining also doesn't work. Basically its stuck forever:

console.log('this is logged');
await t.click(selectorThatTriggersTheIframe);
console.log('this is never reached');

Interesting thing, if I add a debug() before, remove the click(), unlock the page and click on it myself and resume, it works.

@Aleksey28 You mentioned you understand why the original issue happens, do you believe its the same? Are there any other workaround? Is it possible somehow to have a timeout for click()?

Thank you

aleks-pro commented 1 year ago

Hi @aflalves ,

to make sure that the issue you have encountered and the issue from the original post are the same, we need to examine your usage scenario. Could you share your project sample and a test with which we can reproduce the problematic behavior?

miherlosev commented 1 year ago

Hi @fmancardi,

If I run the example from https://github.com/DevExpress/testcafe/issues/7331#issuecomment-1279004344 with the experimental-proxyless option, the test doesn't hang on the switchToIframe action. It fails with the Selector not found error. Please try to fix the test and run it with experimental-proxyless.

fmancardi commented 1 year ago

Thanks, I'm going to try (with latest test cafe version) and provide feedback.

have a nice week end

fmancardi commented 1 year ago

Hi I've done a couple of runs in TestCafe Studio 1.8.2, that uses TestCafe framework 2.1.0, without adding the experimental-proxyless option and it seems to work OK.
Going to provide more feedback in the next weeks

regards

miherlosev commented 1 year ago

Hi @fmancardi,

This issue is not reproduced with combination of testcafe@3.0.1 and the Google Chrome browser. Feel free to reopen this issue if you encounter it in other browsers.