Skip to content

Commit

Permalink
Update CC UAR to hlx.live vs stage (#243)
Browse files Browse the repository at this point in the history
* 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

---------

Co-authored-by: xiasun <[email protected]>
Co-authored-by: Aaron Mauchley <[email protected]>
Co-authored-by: xiasun <[email protected]>
  • Loading branch information
4 people committed Jan 18, 2024
1 parent 5311c94 commit 74f6751
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
2 changes: 2 additions & 0 deletions features/cc/quiz.screenshots.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module.exports = {
tcid: '0',
name: '@quiz screenshots',
path: '/creativecloud/plan-recommender/quiz',
stable: '@adobe_stage',
beta: '@cc_live',
tags: '@cc @uar-quiz-screenshots @uar-quiz-static',
data: 'data/cc/quiz/quiz-basic.yml',
},
Expand Down
54 changes: 32 additions & 22 deletions tests/cc/quiz.screenshots.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
/* 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/cc/quiz.screenshots.spec.js');

const { features } = QuizSpec;
const { features } = require('../../features/cc/quiz.screenshots.spec.js');
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
test.setTimeout(10 * 60 * 1000);
for (const feature of features) {
test(
`${feature.name}, ${feature.tags}`,
async ({ page, baseURL }) => {
const quiz = new Quiz(page);
const quizOldPage = new QuizOldPage(page);
const url = `${baseURL}${feature.path}`;
console.info(url);
async ({ page }) => {
const stablePage = new Quiz(page);
const betaPage = new Quiz(page);
const stableURL = `${envs[feature.stable]}${feature.path}`;
console.info(stableURL);
const betaURL = `${envs[feature.beta]}${feature.path}`;
console.info(betaURL);

// load test data from static files
const testdata = await WebUtil.loadTestData(`${feature.data}`);
Expand All @@ -29,17 +29,11 @@ test.describe('Quiz flow test suite', () => {

for (let key of Object.keys(testdata)) {
console.log(key);
let oldProduct = '';
let newProduct = '';
let stableProduct = '';
let betaProduct = '';
let stableProductScreenshots = [];
let betaProductScreenshots = [];
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, true);
});

await test.step('Old: Check results on test page', async () => {
oldProduct = await quizOldPage.checkResultPage(testdata[key], key, keyNumber, true);
});

if (key.includes('PDFs > Edit quickly')) {
// eslint-disable-next-line no-continue
continue;
Expand All @@ -49,15 +43,31 @@ test.describe('Quiz flow test suite', () => {
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 stablePage.clickEachAnswer(stableURL, key, keyNumber, 'stable', true);
});

await test.step('Old: Check results on test page', async () => {
stableProduct = await stablePage.checkResultPage(testdata[key], key, keyNumber, 'stable', true);
});

stableProductScreenshots = stablePage.screenshots.slice();
stablePage.screenshots = [];

await test.step(`New: Select each answer on test page according to ${key}`, async () => {
await quiz.clickEachAnswer(url, key, keyNumber, 'new', true);
await betaPage.clickEachAnswer(betaURL, key, keyNumber, 'beta', true);
});

await test.step('New: Check results on test page', async () => {
newProduct = await quiz.checkResultPage(testdata[key], key, keyNumber, 'new', true);
betaProduct = await betaPage.checkResultPage(testdata[key], key, keyNumber, 'beta', true);
});

// expect.soft(newProduct).toContain(oldProduct);
betaProductScreenshots = betaPage.screenshots.slice();
betaPage.screenshots = [];

WebUtil.compareScreenshots(stableProductScreenshots, betaProductScreenshots, 'screenshots/uar');

expect.soft(betaProduct).toContain(stableProduct);
}
},
);
Expand Down

0 comments on commit 74f6751

Please sign in to comment.