mirror of https://github.com/01-edu/public.git
Fixing the pick-and-clik test
This commit is contained in:
parent
fba136f70f
commit
a08836e68f
|
@ -76,14 +76,13 @@ tests.push(async ({ page, eq, bodyBgRgb, random }) => {
|
||||||
|
|
||||||
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
|
// 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)) {
|
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)
|
await page.mouse.click(...move)
|
||||||
const clipboard = await page.evaluate(() =>
|
const clipboard = await page.evaluate(() =>
|
||||||
window.navigator.clipboard.readText()
|
window.navigator.clipboard.readText()
|
||||||
|
|
Loading…
Reference in New Issue