|
|
|
@ -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' }) |
|
|
|
|
}) |
|
|
|
|