From e032c18d3db59c21d7aabd858cffb4b72b3d5133 Mon Sep 17 00:00:00 2001 From: Jacky Sun <67350368+JackySun9@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:25:25 -0800 Subject: [PATCH] Fix test failures for Mile Stage (#280) * add test for quiz and result pages * add test for quiz and result pages * add test for quiz and result pages * add POC for analytics test * update analytics tests and envs * result envs * update analytics only on firefox * add dynamic tests * add dynamic test for quiz page * update quiz test * update test structure * add test for quiz and result pages * add POC for analytics test * update analytics tests and envs * result envs * update analytics only on firefox * add dynamic tests * add dynamic test for quiz page * update quiz test * update test structure * update uar tests to new format * update uar tests * move everything to uar folder * add dependency for js-yaml * update test according to latest comments * update test according to latest comments * update tests according to the latest comments * add uar config * add analytics for uar * update according to feedbacks * update tags * add @cc tag * update according to feedbacks * add dynamic tests for uar * update according to review comments * fix some typos * update according to review comments * merge console log info * add UI screenshots for UAR * move view point to test * update according to feedback * add analytics test for UAR * update validation and uar libs * update libs * update by feedback * update some config and tests * update some config and tests * update test content path to common path * update analytics tests * fix test failures caused by test code * fix test failures * fix test failures * add visual test for CAAS with two pages * update according to feedbacks * update report in config file * add screenshot for milo main live vs uar-integration live * add timestamp js for time stampe recording * add screenshot diff for uar stable and beta * move uar screenshots into visual compare folder * add UI screenshots for DX Quiz * build a function to get screenshots * update locator * udate uar to only run basic tests * update according to feedback * add screenshot for UAR in CC which will go live * update final path for UAR in CC * update the final CC path * update cc uar screenshots to hlx.live vs stage * update test * update screenshot test * update uar analytics to run on STAGE * update tests to run on different envs after go live * Fix test failures for MWPW-143444 * update urls --------- Co-authored-by: xiasun Co-authored-by: Aaron Mauchley Co-authored-by: xiasun --- configs/uar.config.js | 7 +++++++ data/uar/quiz/quiz-basic.yml | 1 - envs/envs.js | 1 + tests/uar/quiz.dynamic.test.js | 15 +++------------ tests/uar/quiz.screenshots.test.js | 27 +++++++++------------------ tests/uar/quiz.test.js | 6 +++--- 6 files changed, 23 insertions(+), 34 deletions(-) diff --git a/configs/uar.config.js b/configs/uar.config.js index 40ad38f7..eae44af0 100644 --- a/configs/uar.config.js +++ b/configs/uar.config.js @@ -71,6 +71,13 @@ const config = { baseURL: envs['@adobe_stage'], }, }, + { + name: 'milo-stage-firefox', + use: { + ...devices['Desktop Firefox'], + baseURL: envs['@milo_stage'], + }, + }, ], }; module.exports = config; diff --git a/data/uar/quiz/quiz-basic.yml b/data/uar/quiz/quiz-basic.yml index 0957d743..f4747d09 100644 --- a/data/uar/quiz/quiz-basic.yml +++ b/data/uar/quiz/quiz-basic.yml @@ -14,4 +14,3 @@ '3D/AR > Assemble, stage, and render 3D scenes > Neither apply': '3D single > Substance 3D Stager' 'Photography + 3D/AR > Get them sorted and organized > Create 3D models with digital clay > A student or teacher discount': '3D double > Lightroom,Substance 3D Modeler' -'Photography + Video + 3D/AR > Get them sorted and organized > Create, edit, and share on social > Texture 3D assets in real time > Licenses and business features for teams': '3D triple > Lightroom,Premiere Pro,Substance 3D Painter' diff --git a/envs/envs.js b/envs/envs.js index 15708a7d..fa66298c 100644 --- a/envs/envs.js +++ b/envs/envs.js @@ -1,6 +1,7 @@ module.exports = { '@milo_live': 'https://main--milo--adobecom.hlx.live', '@milo_prod': 'https://milo.adobe.com', + '@milo_stage': 'https://stage--milo--adobecom.hlx.live', '@feds_live': 'https://gnav--milo--adobecom.hlx.live', '@stock_live': 'https://main--stock--adobecom.hlx.live', '@adobestock_live': 'https://main--adobestock--adobecom.hlx.live', diff --git a/tests/uar/quiz.dynamic.test.js b/tests/uar/quiz.dynamic.test.js index 75e995d7..cbb2a1af 100644 --- a/tests/uar/quiz.dynamic.test.js +++ b/tests/uar/quiz.dynamic.test.js @@ -2,13 +2,13 @@ /* eslint-disable no-restricted-syntax */ import { expect, test } from '@playwright/test'; import { buildTestData } from '../../data/uar/quiz/uar.js'; -import QuizOldPage from '../../selectors/uar/quiz.old.page.js'; import Quiz from '../../selectors/uar/quiz.page.js'; const QuizSpec = require('../../features/uar/quiz.dynamic.spec.js'); const { features } = QuizSpec; const { WebUtil } = require('../../libs/webutil.js'); +const envs = require('../../envs/envs.js'); test.describe('Quiz flow test suite', () => { // reset timeout because we use this to run all test data @@ -30,22 +30,13 @@ test.describe('Quiz flow test suite', () => { testdata = testdata.sort(() => 0.5 - Math.random()).slice(0, 20); } - for (let key of testdata) { + for (const key of testdata) { console.log(key); let oldProduct = ''; let newProduct = ''; - if (key.includes('PDFs > Edit quickly')) { - // eslint-disable-next-line no-continue - continue; - } - - if (key.includes('PDFs > Take the time to control')) { - key = key.replace('PDFs > Take the time to control every detail', 'PDFs'); - } - await test.step(`Old: Select each answer on test page according to ${key}`, async () => { - await quizOldPage.clickEachAnswer('https://www.stage.adobe.com/creativecloud/plan-recommender/quiz.html', key); + await quizOldPage.clickEachAnswer(`${envs['@milo_stage']}${feature.path}`, key); }); await test.step('Old: Check results on test page', async () => { diff --git a/tests/uar/quiz.screenshots.test.js b/tests/uar/quiz.screenshots.test.js index f6fcc67b..558191eb 100644 --- a/tests/uar/quiz.screenshots.test.js +++ b/tests/uar/quiz.screenshots.test.js @@ -3,12 +3,12 @@ /* eslint-disable no-restricted-syntax */ import { expect, test } from '@playwright/test'; import Quiz from '../../selectors/uar/quiz.page.js'; -import QuizOldPage from '../../selectors/uar/quiz.old.page.js'; const QuizSpec = require('../../features/uar/quiz.screenshots.spec.js'); const { features } = QuizSpec; const { WebUtil } = require('../../libs/webutil.js'); +const envs = require('../../envs/envs.js'); test.describe('Quiz flow test suite', () => { // reset timeout because we use this to run all test data @@ -33,32 +33,23 @@ test.describe('Quiz flow test suite', () => { let newProduct = ''; keyNumber += 1; - if (key.includes('PDFs > Edit quickly')) { - // eslint-disable-next-line no-continue - continue; - } - - if (key.includes('PDFs > Take the time to control')) { - key = key.replace('PDFs > Take the time to control every detail', 'PDFs'); - } - - await test.step(`Prod: Select each answer on test page according to ${key}`, async () => { - await quizOldPage.clickEachAnswer('https://www.adobe.com/creativecloud/plan-recommender/quiz.html', key, keyNumber, 'prod', true); + await test.step(`Stage: Select each answer on test page according to ${key}`, async () => { + await quizOldPage.clickEachAnswer(`${envs['@milo_stage']}${feature.path}`, key, keyNumber, 'stage', true); }); - await test.step('Prod: Check results on test page', async () => { - oldProduct = await quizOldPage.checkResultPage(testdata[key], key, keyNumber, true); + await test.step('Stage: Check results on test page', async () => { + oldProduct = await quizOldPage.checkResultPage(testdata[key], key, keyNumber, 'stage', true); }); - await test.step(`Stage: Select each answer on test page according to ${key}`, async () => { - await quiz.clickEachAnswer('https://www.stage.adobe.com/creativecloud/plan-recommender/quiz.html', key, keyNumber, 'stage', true); + await test.step(`New: Select each answer on test page according to ${key}`, async () => { + await quiz.clickEachAnswer(url, key, keyNumber, 'new', true); }); - await test.step('Stage: Check results on test page', async () => { + await test.step('New: Check results on test page', async () => { newProduct = await quiz.checkResultPage(testdata[key], key, keyNumber, 'new', true); }); - // expect.soft(oldProduct).toContain(newProduct); + expect.soft(oldProduct).toContain(newProduct); } }, ); diff --git a/tests/uar/quiz.test.js b/tests/uar/quiz.test.js index 8cc532e6..6d7e69e6 100644 --- a/tests/uar/quiz.test.js +++ b/tests/uar/quiz.test.js @@ -3,12 +3,12 @@ /* eslint-disable no-restricted-syntax */ import { expect, test } from '@playwright/test'; import Quiz from '../../selectors/uar/quiz.page.js'; -import QuizOldPage from '../../selectors/uar/quiz.old.page.js'; const QuizSpec = require('../../features/uar/quiz.spec.js'); const { features } = QuizSpec; const { WebUtil } = require('../../libs/webutil.js'); +const envs = require('../../envs/envs.js'); test.describe('Quiz flow test suite', () => { // reset timeout because we use this to run all test data @@ -18,7 +18,7 @@ test.describe('Quiz flow test suite', () => { `${feature.name}, ${feature.tags}`, async ({ page, baseURL }) => { const quiz = new Quiz(page); - const quizOldPage = new QuizOldPage(page); + const quizOldPage = new Quiz(page); const url = `${baseURL}${feature.path}`; console.info(url); @@ -33,7 +33,7 @@ test.describe('Quiz flow test suite', () => { let newProduct = ''; keyNumber += 1; await test.step(`Old: Select each answer on test page according to ${key}`, async () => { - await quizOldPage.clickEachAnswer('https://www.adobe.com/creativecloud/quiz-recommender.html', key, keyNumber, false); + await quizOldPage.clickEachAnswer(`${envs['@milo_stage']}${feature.path}`, key, keyNumber, false); }); await test.step('Old: Check results on test page', async () => {