Skip to content

Commit

Permalink
test: add an additional input element in execute script Nodelist check
Browse files Browse the repository at this point in the history
  • Loading branch information
poftadeh committed Dec 18, 2019
1 parent 5f3a35a commit 49a8045
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/jest/e2e/execute-script-sync.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Execute Script Sync', () => {
</head>
<body>
<input type="text" value='baz' />
<input type="password" />
<p id="foo">bar</p>
<button onclick="clickAction(this)">
not clicked
Expand All @@ -29,8 +30,8 @@ describe('Execute Script Sync', () => {
}
</script>
<script>
function getInputValue() {
return document.querySelector('input').value;
function getTextInputValue() {
return document.querySelector('input[type="text"]').value;
}
function getParagraphElement() {
Expand Down Expand Up @@ -155,7 +156,7 @@ describe('Execute Script Sync', () => {
});

it('handles global functions', async () => {
expect(await executeScript('return getInputValue()')).toBe('baz');
expect(await executeScript('return getTextInputValue()')).toBe('baz');
expect(await executeScript('return getParagraphElement();')).toHaveProperty(
[ELEMENT],
expect.any(String),
Expand All @@ -165,7 +166,10 @@ describe('Execute Script Sync', () => {
it('handles NodeList and HTMLCollection', async () => {
expect(
await executeScript('return document.querySelectorAll("input")'),
).toStrictEqual([{ [ELEMENT]: expect.any(String) }]);
).toStrictEqual([
{ [ELEMENT]: expect.any(String) },
{ [ELEMENT]: expect.any(String) },
]);

expect(
await executeScript('return document.getElementsByTagName("body")'),
Expand Down

0 comments on commit 49a8045

Please sign in to comment.