action-reaction: update test

This commit is contained in:
Marie Malarme 2021-03-03 15:47:23 +00:00 committed by Clément
parent e218615d8d
commit 4c08ac50c4
1 changed files with 8 additions and 14 deletions

View File

@ -19,15 +19,12 @@ tests.push(async ({ eq, page }) => {
await page.waitForSelector('#eye-left.eye.eye-closed', { timeout: 150 })
// check the background color has changed
const eyeLeft = await page.$eval(
'#eye-left.eye.eye-closed',
(node) => node.style.backgroundColor,
)
eq(eyeLeft, 'black')
await eq.$('#eye-left.eye.eye-closed', {
style: { backgroundColor: 'black' },
})
// check that the text of the button changed to 'open'
const buttonText = await page.$eval('button', (node) => node.textContent)
eq(buttonText, 'Click to open the left eye')
await eq.$('button', { textContent: 'Click to open the left eye' })
})
tests.push(async ({ eq, page }) => {
@ -39,13 +36,10 @@ tests.push(async ({ eq, page }) => {
await page.waitForSelector('#eye-left.eye:not(.eye-closed)', { timeout: 150 })
// check the background color has changed
const eyeLeft = await page.$eval(
'#eye-left.eye:not(.eye-closed)',
(node) => node.style.backgroundColor,
)
eq(eyeLeft, 'red')
await eq.$('#eye-left.eye:not(.eye-closed)', {
style: { backgroundColor: 'red' },
})
// check that the text of the button changed to 'close'
const buttonText = await page.$eval('button', (node) => node.textContent)
eq(buttonText, 'Click to close the left eye')
await eq.$('button', { textContent: 'Click to close the left eye' })
})