Skip to content

egorshantur/testcafe-callsite-issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

The issue occurs when the previously clicked element, or its parent, is an <a> or <area> element and is removed from the DOM. TestCafe test fails with error:

  1) Uncaught object

   "{"callsite":{"filename":"C:\\testcafe-callsite-issue\\test.js","lineNum":6,"callsiteFrameIdx":5,"stackFrames":[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}],"isV8Frames":true}}"
      was thrown. Throw Error instead.

Follow the steps below to reproduce the issue:

  • Clone/download the repository.
  • Run the following command: npm install
  • Run the test: npm run test

Issue is not reproducible in native automation mode.

Additional details about the issue:

TestCafe (proxy mode) fails with 'Uncaught object' error on leaveElement when the prevElement is removed from the DOM, and it (or its parent, which is also removed) is an <a> or <area> element. The issue happens because subsequent getParent hammerhead's code returns "host", which is a string representing the host in case of <a> and <area> elements, not an element. This causes a failure when attempting to get its parent again using nativeMethods.nodeParentNodeGetter.call(el).

Tests running in proxy mode began failing after upgrading to version 3.4.0 or higher. The last version without this issue was 3.3.0. The issue is reproducible after the following change: DevExpress/testcafe#7995

If you add removed code back, then test does not fail

        const prevElementInDocument = prevElement && domUtils.isElementInDocument(prevElement);

        const prevElementInRemovedIframe = prevElement && domUtils.isElementInIframe(prevElement) &&
                                         !domUtils.getIframeByElement(prevElement);

        if (!prevElementInDocument || prevElementInRemovedIframe)
            prevElement = null;

Based on the description "removed IE leftovers from src\client\automation," it should not affect tests running in Chrome. However, it did affect them, so I reviewed the code that was originally executed for all browsers but was removed in that commit, and identified the issue.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published