-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add screenshot for UAR stable and beta (#216)
* 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 --------- Co-authored-by: xiasun <[email protected]> Co-authored-by: Aaron Mauchley <[email protected]>
- Loading branch information
1 parent
1eb7132
commit bbbcec7
Showing
7 changed files
with
156 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = { | ||
name: 'UAR Visual Comparison', | ||
features: [ | ||
{ | ||
tcid: '0', | ||
name: '@quiz screenshots', | ||
path: '/drafts/quiz/quiz-2/', | ||
stable: '@milo_live', | ||
beta: '@uar_live', | ||
tags: '@cc @uar-quiz-stable-vs-beta @uar-quiz-static', | ||
data: 'data/uar/quiz/quiz-basic.yml', | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const fs = require('fs'); | ||
|
||
fs.writeFileSync( | ||
'timestamp.json', | ||
JSON.stringify([(new Date()).toLocaleString()], null, 2), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* eslint-disable no-await-in-loop */ | ||
/* eslint-disable no-loop-func */ | ||
/* eslint-disable no-restricted-syntax */ | ||
import { expect, test } from '@playwright/test'; | ||
import Quiz from '../../selectors/uar/quiz.page.js'; | ||
|
||
const { features } = require('../../features/visual-compare/uar/quiz.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 }) => { | ||
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}`); | ||
|
||
let keyNumber = 0; | ||
|
||
for (const key of Object.keys(testdata)) { | ||
console.log(key); | ||
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 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 betaPage.clickEachAnswer(betaURL, key, keyNumber, 'beta', true); | ||
}); | ||
|
||
await test.step('New: Check results on test page', async () => { | ||
betaProduct = await betaPage.checkResultPage(testdata[key], key, keyNumber, 'beta', true); | ||
}); | ||
|
||
betaProductScreenshots = betaPage.screenshots.slice(); | ||
betaPage.screenshots = []; | ||
|
||
WebUtil.compareScreenshots(stableProductScreenshots, betaProductScreenshots, 'screenshots/uar'); | ||
|
||
expect.soft(betaProduct).toContain(stableProduct); | ||
} | ||
}, | ||
); | ||
} | ||
}); |