Skip to content

Commit

Permalink
Fixed cursor moving out from iframe in move automation (closes DevExp…
Browse files Browse the repository at this point in the history
  • Loading branch information
georgiy-abbasov authored and kirovboris committed Dec 18, 2019
1 parent 8e7c3ba commit 8dcd98a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/client/automation/playback/move.js
Expand Up @@ -142,7 +142,10 @@ export default class MoveAutomation {
var clientX = startX - iframeRectangle.left;
var clientY = startY - iframeRectangle.top;

eventSimulator.mouseout(lastHoveredElement, { clientX, clientY, relatedTarget: null });
// NOTE: We should not emulate mouseout if iframe was reloaded.
if (lastHoveredElement)
eventSimulator.mouseout(lastHoveredElement, { clientX, clientY, relatedTarget: null });

messageSandbox.sendServiceMsg({ cmd: MOVE_RESPONSE_CMD }, parentWin);

return;
Expand Down
23 changes: 23 additions & 0 deletions test/functional/fixtures/regression/gh-1140/pages/iframe.html
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>GH-1140 iframe</title>
<style>
#target {
width:200px;
height:200px;
background: grey;
}
</style>
</head>
<body>
<div id="target"></div>
<script>
document
.querySelector('#target')
.addEventListener('click', function () {
window.location.reload();
});
</script>
</body>
</html>
24 changes: 24 additions & 0 deletions test/functional/fixtures/regression/gh-1140/pages/index.html
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>GH-1140 index</title>
<style>
#iframe {
position:absolute;
top:1200px;
width:250px;
height:250px;
}

#target {
width:50px;
height:50px;
background: grey;
}
</style>
</head>
<body>
<div id="target"></div>
<iframe id="iframe" src="iframe.html"></iframe>
</body>
</html>
7 changes: 7 additions & 0 deletions test/functional/fixtures/regression/gh-1140/test.js
@@ -0,0 +1,7 @@
describe('[Regression](GH-1140)', function () {
it('Test should not hang while iframe is reloaded and it is not under cursor', function () {
// NOTE: we set selectorTimeout to a large value to wait for an iframe to load
// on the farm (it is fast locally but can take some time on the farm)
return runTests('testcafe-fixtures/index.test.js', 'Perform an action after iframe reloaded', { selectorTimeout: 10000 });
});
});
@@ -0,0 +1,10 @@
fixture `gh-1140`
.page('http://localhost:3000/fixtures/regression/gh-1140/pages/index.html');

test('Perform an action after iframe reloaded', async t => {
await t
.switchToIframe('#iframe')
.click('#target')
.switchToMainWindow()
.click('#target');
});

0 comments on commit 8dcd98a

Please sign in to comment.