From 34fa7bf4b73ebe8d3ec0fdb07ebee840d2f8dc74 Mon Sep 17 00:00:00 2001 From: Louis TOUSSAINT Date: Wed, 21 Aug 2024 01:29:59 +0200 Subject: [PATCH 1/2] Tests(DPxAI): upload test for quest02 colorful-legs --- dom/colorful-legs_test.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 dom/colorful-legs_test.js diff --git a/dom/colorful-legs_test.js b/dom/colorful-legs_test.js new file mode 100644 index 000000000..7fb6da1fe --- /dev/null +++ b/dom/colorful-legs_test.js @@ -0,0 +1,37 @@ +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) + + // Ensure the new color is not black + eq(legLeftColor !== 'rgb(0, 0, 0)', true, 'The color of the legs should not be black') +}) + +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') +}) From 4a294951cf4bad663d77fe45258b95833cac0caf Mon Sep 17 00:00:00 2001 From: Louis TOUSSAINT Date: Wed, 21 Aug 2024 16:05:58 +0200 Subject: [PATCH 2/2] Tests(DPxAI): update test for quest02 colorful-legs --- dom/colorful-legs_test.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/dom/colorful-legs_test.js b/dom/colorful-legs_test.js index 7fb6da1fe..13e815e90 100644 --- a/dom/colorful-legs_test.js +++ b/dom/colorful-legs_test.js @@ -11,9 +11,6 @@ tests.push(async ({ eq, page }) => { // Check if both legs have been assigned the same new color eq(legLeftColor, legRightColor) - - // Ensure the new color is not black - eq(legLeftColor !== 'rgb(0, 0, 0)', true, 'The color of the legs should not be black') }) tests.push(async ({ eq, page }) => {