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-3107 Tests(DPxAI): upload test for quest02 colorful-legs #2700

Merged
merged 2 commits 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
34 changes: 34 additions & 0 deletions dom/colorful-legs_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
export const tests = []

tests.push(async ({ eq, page }) => {
// Click on the button to change the robot's leg colors
const button = await page.$('button#leg-color')
await button.click()

// Get the new colors of both legs
const legLeftColor = await page.$eval('#leg-left', (node) => getComputedStyle(node).backgroundColor)
const legRightColor = await page.$eval('#leg-right', (node) => getComputedStyle(node).backgroundColor)

// Check if both legs have been assigned the same new color
eq(legLeftColor, legRightColor)
})

tests.push(async ({ eq, page }) => {
// Get the initial colors of the legs before clicking the button
const initialLegLeftColor = await page.$eval('#leg-left', (node) => getComputedStyle(node).backgroundColor)
const initialLegRightColor = await page.$eval('#leg-right', (node) => getComputedStyle(node).backgroundColor)

// Click on the button to change the robot's leg colors
const button = await page.$('button#leg-color')
await button.click()

// Get the new colors of both legs
const newLegLeftColor = await page.$eval('#leg-left', (node) => getComputedStyle(node).backgroundColor)
const newLegRightColor = await page.$eval('#leg-right', (node) => getComputedStyle(node).backgroundColor)

// Check if both legs have been assigned the same new color
eq(newLegLeftColor, newLegRightColor)

// Ensure the new color is different from the initial color
eq(newLegLeftColor !== initialLegLeftColor, true, 'The color of the legs should be different from the initial color')
})
Loading