Browse Source

Merge pull request #1047 from 01-edu/improve-pick-and-click-01-822

Fixing the pick-and-clik test
pull/1050/head
MSilva95 2 years ago committed by GitHub
parent
commit
3f57c327a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      dom/pick-and-click_test.js

13
dom/pick-and-click_test.js

@ -76,14 +76,13 @@ tests.push(async ({ page, eq, bodyBgRgb, random }) => {
tests.push(async ({ page, eq, bodyBgRgb, random }) => {
// check that the hsl value is copied in the clipboard on click
// Override readText if writeText is used due to a puppeteer bug
await page.evaluate(() => {
window.navigator.clipboard.writeText = async (text) => {
window.navigator.clipboard.readText = async () => text
}
})
for (const move of generateCoords(random)) {
await page.evaluate(() => {
let clipboardText = null
window.navigator.clipboard.readText = async () => clipboardText
window.navigator.clipboard.writeText = async (text) => {
clipboardText = text
}
})
await page.mouse.click(...move)
const clipboard = await page.evaluate(() =>
window.navigator.clipboard.readText()

Loading…
Cancel
Save