From 6d2d17eeba8077e22ea6ae0ee56dea49d4cba764 Mon Sep 17 00:00:00 2001 From: Dennis Li Date: Fri, 27 Sep 2024 16:38:17 -0700 Subject: [PATCH] Adding visual comparison tests for bacom. --- data/bacom/visual/sot.yml | 21 ++++++++++++++ features/visual/bacom/sot.spec.js | 13 +++++++++ tests/visual/bacom/sot.test.js | 46 +++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 data/bacom/visual/sot.yml create mode 100644 features/visual/bacom/sot.spec.js create mode 100644 tests/visual/bacom/sot.test.js diff --git a/data/bacom/visual/sot.yml b/data/bacom/visual/sot.yml new file mode 100644 index 00000000..1054519e --- /dev/null +++ b/data/bacom/visual/sot.yml @@ -0,0 +1,21 @@ +--- +'homepage': 'https://business.stage.adobe.com/' +'de homepage': 'https://business.stage.adobe.com/de/' +'fr homepage': 'https://business.stage.adobe.com/fr/' +'au homepage': 'https://business.stage.adobe.com/au/' +'uk homepage': 'https://business.stage.adobe.com/uk/' +'jp homepage': 'https://business.stage.adobe.com/jp/' +'kr homepage': 'https://business.stage.adobe.com/kr/' +'genstudio': 'https://business.stage.adobe.com/products/genstudio.html' +'genstudio/creation': 'https://business.stage.adobe.com/products/genstudio/creation.html' +'aem-sites': 'https://business.stage.adobe.com/products/experience-manager/sites/aem-sites.html' +'rtcdp': 'https://business.stage.adobe.com/products/real-time-customer-data-platform/rtcdp.html' +'ai-assistant': 'https://business.stage.adobe.com/products/sensei/ai-assistant.html' +'resources': 'https://business.stage.adobe.com/resources/main.html' +'holiday-shopping-report': 'https://business.stage.adobe.com/resources/holiday-shopping-report.html' +'experience-cloud': 'https://business.stage.adobe.com/request-consultation/experience-cloud.html' +'experience-magento-compare': 'https://business.stage.adobe.com/resources/experience-magento-compare.html' +'customer-success-stories': 'https://business.stage.adobe.com/customer-success-stories.html' +'pricing': 'https://business.stage.adobe.com/products/pricing.html' +'real-time-customer-data-platform/pricing': 'https://business.stage.adobe.com/products/real-time-customer-data-platform/pricing.html' +'marketo-measure': 'https://business.stage.adobe.com/products/marketo/marketo-measure.html' diff --git a/features/visual/bacom/sot.spec.js b/features/visual/bacom/sot.spec.js new file mode 100644 index 00000000..ec49a7e8 --- /dev/null +++ b/features/visual/bacom/sot.spec.js @@ -0,0 +1,13 @@ +module.exports = { + name: 'BACOM SOT Visual Comparison', + features: [ + { + tcid: '0', + name: 'BACOM Visual Comparison', + stable: '@bacom_prod', + beta: '@bacom_stage', + tags: '@bacom-visual @visual @bacom-screenshots', + data: 'data/bacom/visual/sot.yml', + }, + ], +}; diff --git a/tests/visual/bacom/sot.test.js b/tests/visual/bacom/sot.test.js new file mode 100644 index 00000000..e2c2266d --- /dev/null +++ b/tests/visual/bacom/sot.test.js @@ -0,0 +1,46 @@ +import { test } from '@playwright/test'; +import { features } from '../../../features/visual/bacom/sot.spec.js'; +import { takeTwo } from '../../../libs/screenshot/take.js'; +import { writeResultsToFile } from '../../../libs/screenshot/utils.js'; + +const { WebUtil } = require('../../../libs/webutil.js'); + +const folderPath = 'screenshots/bacom'; +const results = {}; +const MILO_LIBS = '?milolibs=stage'; + +test.describe('BACOM SOT visual comparison 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 }, testInfo) => { + const testdata = await WebUtil.loadTestData(`${feature.data}`); + + for (const key of Object.keys(testdata)) { + const stableURL = testdata[key].replace('.stage.', '.'); + console.info(stableURL); + const betaURL = testdata[key] + MILO_LIBS; + console.info(betaURL); + + const name = `${feature.name}-${key}-${testInfo.project.name}`; + const result = await takeTwo( + page, + stableURL, + async () => { + await page.waitForTimeout(3000); + }, + betaURL, + async () => { + await page.waitForTimeout(3000); + }, + folderPath, + name, + { fullPage: true }, + ); + results[name] = [result]; + } + writeResultsToFile(folderPath, testInfo, results); + }); + } +});