Skip to content

Commit

Permalink
Add screenshots test for graybox dc (#454)
Browse files Browse the repository at this point in the history
* add tests for graybox-bacom

* just use chrome

* add more waiting time

* add merch card

* add 404 checker for graxybox-bacom

* update gitignore and file name

* add screenshots for graybox-dc
  • Loading branch information
JackySun9 authored Oct 17, 2024
1 parent f934187 commit a443888
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
10 changes: 10 additions & 0 deletions data/graybox/sot-dc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'not-found': 'https://www.stage.adobe.com/not-found.html'
'Homepage': 'https://www.stage.adobe.com/acrobat/business.html'
'AcrobatPro': 'https://www.stage.adobe.com/acrobat/business/acrobat-pro.html'
'Pricing': 'https://www.stage.adobe.com/acrobat/pricing.html'
'Word2PDF': 'https://www.stage.adobe.com/acrobat/online/word-to-pdf.html'
'AIChatPDF': 'https://www.stage.adobe.com/acrobat/online/ai-chat-pdf.html'
'PDFtoWord': 'https://www.stage.adobe.com/acrobat/online/pdf-to-word.html'
'Sign': 'https://www.stage.adobe.com/acrobat/acrobat/business/sign.html'
'AdobeSign': 'https://www.stage.adobe.com/acrobat/business/online-signature.html'
3 changes: 2 additions & 1 deletion envs/envs.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ module.exports = {
'@dme_stage': 'https://stage--dme-partners--adobecom.hlx.live',
'@express_stage': 'https://stage--express--adobecom.hlx.live/express',
'@express_live': 'https://main--express--adobecom.hlx.live/express',
'@bacom_graybox': 'https://test.business-graybox.adobe.com',
'@graybox_bacom': 'https://test.business-graybox.adobe.com',
'@graybox_dc': 'https://test.graybox.adobe.com',
};
13 changes: 13 additions & 0 deletions features/visual/graybox/sot.dc.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
name: 'Graybox DC SOT Visual Comparison',
features: [
{
tcid: '0',
name: '@graybox-dc-visual',
stable: '@adobe_stage',
beta: '@graybox_dc',
tags: '@graybox-dc-visual @visual @graybox-dc-screenshots',
data: 'data/graybox/sot-dc.yml',
},
],
};
45 changes: 45 additions & 0 deletions tests/visual/graybox/sot.dc.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* eslint-disable no-restricted-syntax */
/* eslint-disable import/named */
import { test } from '@playwright/test';
import { features } from '../../../features/visual/graybox/sot.dc.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/graybox-dc';
const results = {};

test.describe('Graybox DC SOT visual comparison test suite', () => {
// reset timeout because we use this to run all test data
test.setTimeout(20 * 60 * 1000);
for (const feature of features) {
// eslint-disable-next-line no-loop-func
test(`${feature.name},${feature.tags}`, async ({ page }, testInfo) => {
// load test data from static files
const testdata = await WebUtil.loadTestData(`${feature.data}`);

for (const key of Object.keys(testdata)) {
const stableURL = testdata[key];
console.info(stableURL);
const betaURL = testdata[key].replace('www.stage', 'test.graybox');
console.info(betaURL);

const name = `${feature.name}-${key}-${testInfo.project.name}`;
// eslint-disable-next-line no-await-in-loop
const result = await takeTwo(
page,
stableURL,
async () => { await page.waitForTimeout(10000); },
betaURL,
async () => { await page.waitForTimeout(15000); },
folderPath,
name,
{ fullPage: true },
);
results[name] = [result];
}
writeResultsToFile(folderPath, testInfo, results);
});
}
});

0 comments on commit a443888

Please sign in to comment.