Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed cursor moving out from iframe in move automation (closes #1140) #1144

Merged
merged 1 commit into from Jan 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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');
});