2

Testcafe v 1.9.4 When run test locally everything ok Wneh run via GitLab:

1) Content of the iframe to which you are switching did not load.
      Browser: Chrome 86.0.4240.111 / Linux 0.0
      
         119 |
         120 |
         121 |        await t.expect(this.cke1.exists).ok({timeout:60000})
         122 |        await
      t.expect(this.cke1.visible).ok({timeout:60000})
         123 |
       > 124 |        await t.switchToIframe(this.cke1);

I add : await t.eval(() => location.reload(true)); But it is not helpful This issue appeared around one week ago. Before it was ok too. Code did not change long time What could be the reason?

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
didi
  • 51
  • 3

1 Answers1

2

This error may be caused by the fact that the loading of an iframe document takes too much time. I suppose that the CI machine has not much CPU and memory resources, so the test may be unstable. I suggest you increase the iframe selector timeout: Wait Until an Is Loaded. Also, you can try implementing a ClientFunction with the workaround described at How to check if iframe is loaded or it has a content? to wait while iframe content is loading.

Dmitry Ostashev
  • 2,305
  • 1
  • 5
  • 21
  • I think the problem is in Testcafe v 1.10.1. Because before I used locally prev version of Testcafe and it worked fine. Today I've update and now test fails locally too with same issue – didi Jan 05 '21 at 13:50
  • How did you set the timeout? Your code snippet does not illustrate it. Did you implement the ClientFunction that is waiting for the iFrame? How? – Alex Skorkin Jan 06 '21 at 17:30
  • In Gitlab now last version: Executing "step_script" stage of the job script $ node --version v14.15.3 $ testcafe --version 1.10.1 $ /opt/testcafe/docker/testcafe-docker.sh chromium:headless tests/announceTest.js --skip-js-errors Running tests in: - Chrome 86.0.4240.111 / Linux 0.0 Smoke tests - Announcements tests ✖ 001 | Add Announce Template 1) Content of the iframe to which you are switching did not load. – didi Jan 08 '21 at 09:01
  • Install prev vers of Testcafe and test passed: Executing "step_script" stage of the job script 02:42 $ node --version v14.15.3 $ testcafe --version 1.10.1 $ npm i testcafe@1.9.4 $ testcafe --version 1.9.4 $ /opt/testcafe/docker/testcafe-docker.sh chromium:headless tests/announceTest.js --skip-js-errors Using locally installed version of TestCafe. Running tests in: - Chrome 86.0.4240.111 / Linux 0.0 Smoke tests - Announcements tests Fill name Of Announce test_dcm1/5/2021 Fill subject Of Announce test_dcm1/5/2021 Fill cte of Announce test_dcm1/5/2021 Template is created – didi Jan 08 '21 at 09:05
  • cke1 = Selector('#cke_1_contents > iframe',{timeout:120000}) ; I don't now how to add screenshot, where you can see that iframe is loaded really. But Tetscafe v1.10 fails on it and Testcafe1.9.4 passes – didi Jan 08 '21 at 09:07
  • It looks like an issue with TestCafe. Could you please share a simple example so I can reproduce the issue locally? – mlosev Jan 08 '21 at 09:22
  • I don't know how can I share intranet page: "" cke1 = Selector('#cke_1_contents > iframe',{timeout:120000}) ; await t.expect(this.cke1.exists).ok({timeout:60000}) await t.switchToIframe(this.cke1); await t.typeText(Selector('body'), cteText[0], { replace: true, speed: 0.5}); await t.switchToMainWindow(); – didi Jan 08 '21 at 13:53
  • Since this problem looks like a TestCafe bug, I suggest you [create an issue](https://github.com/DevExpress/testcafe/issues/new?assignees=&labels=&template=bug-report.md) in a testcafe github repository. Please try to create a simple example based on your web site code, which demonstrates the problematic behavior and send it to support@devexpress.com or attach to the issue. – aleks-pro Jan 11 '21 at 09:11