-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add pointer events to schema. * Add tests
- Loading branch information
1 parent
1682639
commit e76d828
Showing
12 changed files
with
2,031 additions
and
484 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
exports[ | ||
'PuppeteerStringifyExtension should print the correct script for a click step 1' | ||
] = ` | ||
{ | ||
const targetPage = page; | ||
const element = await waitForSelectors(["aria/Test"], targetPage, { timeout, visible: true }); | ||
await scrollIntoViewIfNeeded(element, timeout); | ||
await element.click({ | ||
offset: { | ||
x: 1, | ||
y: 1, | ||
}, | ||
}); | ||
} | ||
`; | ||
|
||
exports[ | ||
'PuppeteerStringifyExtension should print the correct script for asserted events 1' | ||
] = ` | ||
{ | ||
const targetPage = page; | ||
const promises = []; | ||
promises.push(targetPage.waitForNavigation()); | ||
const element = await waitForSelectors(["aria/Test"], targetPage, { timeout, visible: true }); | ||
await scrollIntoViewIfNeeded(element, timeout); | ||
await element.click({ | ||
offset: { | ||
x: 1, | ||
y: 1, | ||
}, | ||
}); | ||
await Promise.all(promises); | ||
} | ||
`; | ||
|
||
exports[ | ||
'PuppeteerStringifyExtension should print the correct script with a chain selector 1' | ||
] = ` | ||
{ | ||
const targetPage = page; | ||
const element = await waitForSelectors([["aria/Test","aria/Test2"]], targetPage, { timeout, visible: true }); | ||
await scrollIntoViewIfNeeded(element, timeout); | ||
await element.click({ | ||
offset: { | ||
x: 1, | ||
y: 1, | ||
}, | ||
}); | ||
} | ||
`; | ||
|
||
exports[ | ||
'PuppeteerStringifyExtension should print the correct script for a change step 1' | ||
] = ` | ||
{ | ||
const targetPage = page; | ||
const element = await waitForSelectors(["aria/Test"], targetPage, { timeout, visible: true }); | ||
await scrollIntoViewIfNeeded(element, timeout); | ||
const type = await element.evaluate(el => el.type); | ||
if (["select-one"].includes(type)) { | ||
await element.select("Hello World"); | ||
} else if (["textarea","text","url","tel","search","password","number","email"].includes(type)) { | ||
await element.type("Hello World"); | ||
} else { | ||
await element.focus(); | ||
await element.evaluate((el, value) => { | ||
el.value = value; | ||
el.dispatchEvent(new Event('input', { bubbles: true })); | ||
el.dispatchEvent(new Event('change', { bubbles: true })); | ||
}, "Hello World"); | ||
} | ||
} | ||
`; | ||
|
||
exports[ | ||
'PuppeteerStringifyExtension should print the correct script for a change step for non-text inputs 1' | ||
] = ` | ||
{ | ||
const targetPage = page; | ||
const element = await waitForSelectors(["aria/Test"], targetPage, { timeout, visible: true }); | ||
await scrollIntoViewIfNeeded(element, timeout); | ||
const type = await element.evaluate(el => el.type); | ||
if (["select-one"].includes(type)) { | ||
await element.select("#333333"); | ||
} else if (["textarea","text","url","tel","search","password","number","email"].includes(type)) { | ||
await element.type("#333333"); | ||
} else { | ||
await element.focus(); | ||
await element.evaluate((el, value) => { | ||
el.value = value; | ||
el.dispatchEvent(new Event('input', { bubbles: true })); | ||
el.dispatchEvent(new Event('change', { bubbles: true })); | ||
}, "#333333"); | ||
} | ||
} | ||
`; |
Oops, something went wrong.