Testcafe: unusual { code: 'E44', isTestCafeError: true, callsite: null } crashes the process

Created on 31 Jul 2019  ·  10Comments  ·  Source: DevExpress/testcafe

https://github.com/DevExpress/testcafe/issues/4087#issuecomment-517202770

What is your Test Scenario?

Clicking an element within an iframe

What is the current behavior?

everything works fine and test passes! but then after like 5 seconds, I get that error and the process crashes, it is a show blocker! maybe I am wrong, but if I remove withText it does not crash.

to be more assured, you could see we added an assertion to check if iframe exists and obviously it passes.

we have tried on multiple developers machines, and browsers. with no success

to reiterate, the test passes and the behavior we expect in the browser is correct. so we have no issue with that. but if we did not test in live mode, we would not have detected that.

What is the Expected behavior?

test passes without that error in live mode

What is your web application and your TestCafe test code?

Your website URL (or attach your complete example):


Your complete test code (or attach your test files):

 fixture `test1`

test('New Test', async t => {
    await t
         .typeText('#txtUserID',`recruiter@tgb`)
         .typeText('#txtPassword',`Rules123!`)
         .click('#sub')

    const caseLink = Selector('a').withExactText('C-96');

    await t
        .switchToIframe(Selector('#PegaGadget0Ifr'))
        .expect(Selector(`body`).exists)
        .ok()
        .click(caseLink);
});


Your complete configuration file (if any):

createTestCafe('localhost', 1337, 1338)
    .then(tc => {
        testcafe = tc;
        const runner = testcafe.createLiveModeRunner();

        return runner
            .src(['myFixture1.js'])
            .browsers(['chrome'])
            .run();
    })
    .then(failedCount => {
        console.log('Tests failed: ' + failedCount);
        te


Your complete test report:

Live mode is enabled.
TestCafe now watches source files and reruns
the tests once the changes are saved.

You can use the following keys in the terminal:
'Ctrl+S' - stops the test run;
'Ctrl+R' - restarts the test run;
'Ctrl+W' - enables/disables watching files;
'Ctrl+C' - quits live mode and closes the browsers.


Watching the following files:
  C:\projects\test\myFixture1.js
 Running tests in:
 - Chrome 75.0.3770 / Windows 10.0.0

 test1
 √ New Test


 1 passed (19s)

Make changes to the source files or press Ctrl+R to restart the test r
un.
{ code: 'E44', isTestCafeError: true, callsite: null }

in fireox, the error is little more detailed

code: 'E1', isTestCafeError: true, callsite: null, errStack: '\'get
    length\' called on an object that does not implement interface HTMLCol
    lection.:\ngetter@http://localhost:1337/hammerhead.js:10:485\nchkInlin
    eJSExists


Screenshots:


Steps to Reproduce:

  1. Go to my website ...
  2. Execute this command...
  3. See the error...

Your Environment details:

  • testcafe version: latest
  • node.js version: 10.16.0
  • command-line arguments:
  • browser name and version: Chrome 75.0.3770
  • platform and version: Windows 10 64 bit
  • other:
level 1 HAS WORKAROUND live mode bug

All 10 comments

even if i purly do it inclient function same result :(

        const getCaseLink = ClientFunction(() => {
            const clickEvent = new MouseEvent('click', {
                view: window,
                bubbles: true,
                cancelable: false,
            });

            for (const a of document.querySelectorAll('#bodyTbl_right a')) {
                if (a.textContent === `C-96`) a.dispatchEvent(clickEvent);
            }
        });

        await getCaseLink();

this works!
```js
const viewCase = ClientFunction(() => {
const table = document.getElementById('PegaGadget0Ifr').contentWindow.document.getElementById('bodyTbl_right');
const clickEvent = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: false,
});

        for (const a of table.querySelectorAll('a')) {
            if (a.textContent === `C-96`) a.dispatchEvent(clickEvent);
        }
    });

    await t
        .expect(Selector('#PegaGadget0Ifr').visible)
        .ok()
        .wait(5000);

    await viewCase();

@devmondo

Hello,

It looks like a bug.

I tried to reproduce the E44 error that occurs on successful tests completion, but everything works fine.

Could you please provide us with your sample page (or the public URL) to reproduce the issue?

@Farfurix , thanks for the reply,

it is private, could you tell me please where i can send link after i get concent from the company?

@devmondo

Sure, you can send it to [email protected].

@Farfurix email sent, please confirm received, it is really urgent matter for us and thanks a lot in advance.

@devmondo

We received your email and need some time to examine your project. Please stay tuned for updates in this thread.

@devmondo

I've reproduced the issue.
While we are working on it, I suggest you use the following "switchToMainWindow" workaround:

    await t
        .switchToIframe(Selector('#PegaGadget0Ifr'))
        .expect(Selector(`body`).exists)
        .ok()
        .click(caseLink)
+       .switchToMainWindow()
        ...

At present, we have all required information about this bug. You can block access to your project.

For team:
I have created a simple project to reproduce the E44 (currentIframeIsInvisibleError) issue.
run-simple-page.js:

const createTestCafe = require('testcafe');
let runner           = null;

createTestCafe('localhost', 1337, 1338)
    .then(tc => {
        testcafe = tc;
        const runner = testcafe.createLiveModeRunner();

        return runner
            .src(['.\\simple-page\\test.js'])
            .browsers(['chrome'])
            .run();
    })
    .then(failedCount => {
        console.log('Tests failed: ' + failedCount);
    });

./simple-page/index.html:

<html>
<head></head>
<body>
<iframe id="iframe1"></iframe>
<script>
    var iframe = document.getElementById('iframe1');
    var contentDocument = iframe.contentDocument;

    contentDocument.open();
    contentDocument.write('<div id="div1"><button id="b1" onclick="window.parent.fn()">button</button></div>');
    contentDocument.close();

    // [!]
    window.fn = function setDisplayToNone () {
        var iframe = document.getElementById('iframe1');

        iframe.style.height = 0;
        iframe.style.width = 0;
        iframe.tabIndex = -1;
        iframe.style.display = 'none';
    };
</script>
</body>
</html>

./simple-page/test.js:

import { Selector } from 'testcafe';

fixture `test1`
    .page('http://localhost:8080');

test('New Test', async t => {
    const buttonInIframe = Selector('button').withExactText('button');

    await t
        .switchToIframe(Selector('#iframe1'))
        .click(buttonInIframe)
        // .switchToMainWindow(); // workaround
});

Result:

 Running tests in:
 - Chrome 75.0.3770 / Windows 10.0.0

 test1
 √ New Test


 1 passed (1s)

Make changes to the source files or press Ctrl+R to restart the test run.
{ code: 'E44', isTestCafeError: true, callsite: null }
(node:18636) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@Farfurix , such a great quick response, thank you very much.

i confirm the workaround you suggested works without the error.

@devmondo

You are welcome.
I'm glad to hear that the workaround I provided was helpful for you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

madroneropaulo picture madroneropaulo  ·  3Comments

fnlctrl picture fnlctrl  ·  3Comments

jvanoostveen picture jvanoostveen  ·  4Comments

inikulin picture inikulin  ·  3Comments

calisven picture calisven  ·  3Comments