Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle target elements that are inside Shadow DOM; hammerhead@10.6.1 (c…
…loses #1312)
- Loading branch information
1 parent
5df1cbe
commit 5ddd92d
Showing
5 changed files
with
66 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
22 changes: 22 additions & 0 deletions
22
test/functional/fixtures/regression/gh-1312/pages/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,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title></title> | ||
</head> | ||
<body> | ||
<div id="host">Shadow DOM</div> | ||
<script> | ||
var host = document.querySelector('#host'); | ||
var root = host.createShadowRoot(); | ||
var header = document.createElement('h1'); | ||
var input = document.createElement('input'); | ||
|
||
header.textContent = 'Test Me!'; | ||
|
||
header.addEventListener('click', () => header.textContent = 'Test passed'); | ||
|
||
root.appendChild(header); | ||
root.appendChild(input); | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
describe('[Regression](GH-1312)', function () { | ||
it('Should preform a click action on the element inside shadow DOM', function () { | ||
return runTests('testcafe-fixtures/index-test.js', 'click', { | ||
// NOTE: Currently supported in Chrome only: http://caniuse.com/#feat=shadowdom | ||
only: 'chrome' | ||
}); | ||
}); | ||
|
||
it('Should preform a typeText action on the element inside shadow DOM', function () { | ||
return runTests('testcafe-fixtures/index-test.js', 'typeText', { | ||
// NOTE: Currently supported in Chrome only: http://caniuse.com/#feat=shadowdom | ||
only: 'chrome' | ||
}); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
test/functional/fixtures/regression/gh-1312/testcafe-fixtures/index-test.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,19 @@ | ||
import { Selector } from 'testcafe'; | ||
|
||
fixture `gh-1312` | ||
.page `http://localhost:3000/fixtures/regression/gh-1312/pages/index.html`; | ||
|
||
const shadowHeader = Selector(() => document.querySelector('#host').shadowRoot.querySelector('h1')); | ||
const shadowInput = Selector(() => document.querySelector('#host').shadowRoot.querySelector('input')); | ||
|
||
test('click', async t => { | ||
await t | ||
.click(shadowHeader) | ||
.expect(shadowHeader.innerText).eql('Test passed'); | ||
}); | ||
|
||
test('typeText', async t => { | ||
await t | ||
.typeText(shadowInput, 'Test passed') | ||
.expect(shadowInput.value).eql('Test passed'); | ||
}); |