Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix browser hanging when the test switches between windows after swit…
- Loading branch information
1 parent
5268f54
commit 5596a58
Showing
10 changed files
with
93 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import hammerhead from './deps/hammerhead'; | ||
import testCafeCore from './deps/testcafe-core'; | ||
import { initializeAdapter } from '../../shared/adapter/index'; | ||
import { ScrollOptions } from '../../test-run/commands/options'; | ||
import { getOffsetOptions } from './utils/offsets'; | ||
|
||
const { nativeMethods, Promise } = hammerhead; | ||
const { domUtils, ScrollAutomation } = testCafeCore; | ||
|
||
|
||
initializeAdapter({ | ||
PromiseCtor: Promise, | ||
nativeMethods: nativeMethods, | ||
scroll: (el: any, scrollOptions: ScrollOptions) => new ScrollAutomation(el, scrollOptions).run(), | ||
|
||
getOffsetOptions: getOffsetOptions, | ||
isDomElement: domUtils.isDomElement, | ||
}); |
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
7 changes: 7 additions & 0 deletions
7
test/functional/fixtures/multiple-windows/pages/i6085/iframe.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,7 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<h1>iframe</h1> | ||
</body> | ||
</html> |
11 changes: 11 additions & 0 deletions
11
test/functional/fixtures/multiple-windows/pages/i6085/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,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>gh-6085</title> | ||
</head> | ||
<body> | ||
gh-6085 | ||
<iframe src="http://localhost:3000/fixtures/multiple-windows/pages/i6085/iframe.html"></iframe> | ||
</body> | ||
</html> |
7 changes: 7 additions & 0 deletions
7
test/functional/fixtures/multiple-windows/pages/i6085/window.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,7 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<h1>window</h1> | ||
</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
13 changes: 13 additions & 0 deletions
13
test/functional/fixtures/multiple-windows/testcafe-fixtures/i6085.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,13 @@ | ||
const newWindowUrl = 'http://localhost:3000/fixtures/multiple-windows/pages/i6085/window.html'; | ||
|
||
fixture `Should not hang if switching to a window from iframe` | ||
.page `http://localhost:3000/fixtures/multiple-windows/pages/i6085/index.html`; | ||
|
||
test('Should not hang if switching to a window from iframe', async t => { | ||
const newWindow = await t.openWindow(newWindowUrl); | ||
|
||
await t.switchToParentWindow(); | ||
await t.switchToIframe('iframe'); | ||
await t.switchToWindow(newWindow); | ||
await t.click('h1'); | ||
}); |