Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CON-2957 Tests(DPxAI): upload test for quest02 first-wink #2693

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions dom/first-wink_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
export const tests = []

tests.push(async ({ eq, page }) => {
// check the initial class name of the eye left
const eyeLeft = await page.$eval('#eye-left', (node) => node.className)
eq(eyeLeft, 'eye')

// check that the text of the button says 'close'
const buttonText = await page.$eval('button', (node) => node.textContent)
eq(buttonText, 'Click to close the left eye')
})

tests.push(async ({ eq, page }) => {
// click the button to close the left eye
const button = await page.$('button')
button.click()

// check that the class has been added
await page.waitForSelector('#eye-left.eye.eye-closed', { timeout: 150 })

// check the background color has changed
await eq.$('#eye-left.eye.eye-closed', {
style: { backgroundColor: 'black' },
})

// check that the text of the button changed to 'open'
await eq.$('button', { textContent: 'Click to open the left eye' })
})

tests.push(async ({ eq, page }) => {
// click the button a second time to open the left eye
const button = await page.$('button')
button.click()

// check that the class has been removed
await page.waitForSelector('#eye-left.eye:not(.eye-closed)', { timeout: 150 })

// check the background color has changed
await eq.$('#eye-left.eye:not(.eye-closed)', {
style: { backgroundColor: 'red' },
})

// check that the text of the button changed to 'close'
await eq.$('button', { textContent: 'Click to close the left eye' })
})
Loading