-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix 'Testcafe hungs if the window closed immediately after opening' (c…
- Loading branch information
1 parent
a37788a
commit 32005b2
Showing
10 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...un-options/allow-multiple-windows/pages/close-window-immediately-after-opening/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Index page</title> | ||
</head> | ||
<body> | ||
<button id="openPopUp">Open pop-up window</button> | ||
<div> | ||
<span id="openWndResult"></span> | ||
</div> | ||
<script> | ||
var openPopUpBtn = document.getElementById('openPopUp'); | ||
var openWndResultSpan = document.getElementById('openWndResult'); | ||
|
||
openPopUpBtn.addEventListener('click', function () { | ||
var wnd = window.open('about:blank', '', "left=9999, top=9999, height=100,width=100"); | ||
|
||
wnd.focus(); | ||
wnd.blur(); | ||
wnd.close(); | ||
|
||
openWndResultSpan.textContent = 'The window was closed.'; | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...ptions/allow-multiple-windows/testcafe-fixtures/close-window-immediately-after-opeping.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Selector } from 'testcafe'; | ||
|
||
fixture `Close window immediately after opening` | ||
.page('http://localhost:3000/fixtures/run-options/allow-multiple-windows/pages/close-window-immediately-after-opening/index.html'); | ||
|
||
test('test', async t => { | ||
await t | ||
.click('#openPopUp') | ||
.expect(Selector('#openWndResult').textContent).eql('The window was closed.'); | ||
}); |
19 changes: 19 additions & 0 deletions
19
test/server/data/expected-test-run-errors/child-window-closed-before-switching-error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
The child window was closed before TestCafe could switch to it. | ||
|
||
Browser: Chrome 15.0.874.120 / macOS 10.15 | ||
Screenshot: /unix/path/with/<tag> | ||
|
||
18 |function func1 () { | ||
19 | record = createCallsiteRecord({ byFunctionName: 'func1' }); | ||
20 |} | ||
21 | | ||
22 |(function func2 () { | ||
> 23 | func1(); | ||
24 |})(); | ||
25 | | ||
26 |stackTrace.filter.deattach(stackFilter); | ||
27 | | ||
28 |module.exports = record; | ||
|
||
at func2 (testfile.js:23:5) | ||
at Object.<anonymous> (testfile.js:24:3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters