===== EXISTING BROWSER TEST =====
'use strict';
const fs = require('fs');
const path = require('path');
const puppeteer = require(
'/var/www/vhosts/aiwebpageseo.com/site-audit/node_modules/puppeteer'
);
const stage = process.env.STAGE;
const site = process.env.SITE;
const sources = {
axe: fs.readFileSync(
path.join(site, 'public/a11y-axe/axe.min.js'), 'utf8'
),
run: fs.readFileSync(
path.join(stage, 'public/a11y-axe/run.js'), 'utf8'
),
spacing: fs.readFileSync(
path.join(stage, 'public/a11y-axe/text-spacing.js'), 'utf8'
)
};
const audit = fs.readFileSync(
path.join(stage, 'public/accessibility-audit.js'), 'utf8'
);
const chrome =
'/var/www/vhosts/aiwebpageseo.com/.cache/puppeteer/chrome/linux-148.0.7778.97/chrome-linux64/chrome';
const fixture = `
ACT frame regression
ACT frame regression
Several visible words for text spacing.
`;
(async () => {
const browser = await puppeteer.launch({
executablePath: chrome,
headless: true,
args: ['--no-sandbox', '--disable-dev-shm-usage']
});
try {
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 900 });
await page.setContent(`
ACT frame test
`);
await page.evaluate(source => {
window.SEOGate = { check() {}, close() {} };
(0, eval)(source);
}, audit);
const results = [];
for (const cssOk of [true, false]) {
const result = await page.evaluate(
async ({ fixture, sources, cssOk }) => {
window.__a11yAxeSrc = sources;
window.__a11yAxeSrcP = null;
return await a11yAxe(fixture, '', cssOk);
},
{ fixture, sources, cssOk }
);
if (!result.ok) {
throw Error(
'Frame failed: ' + JSON.stringify(result)
);
}
const violations = result.violations || [];
const act = result.actResults || [];
if (act.length !== 2) {
throw Error(
'Expected two ACT results, got ' + act.length
);
}
if (cssOk) {
for (const id of ['9e45ec', '24afc2']) {
if (!violations.some(v => v.id === 'act-' + id)) {
throw Error('Missing ACT violation ' + id);
}
}
} else {
if (violations.some(v => /^act-/.test(v.id))) {
throw Error(
'ACT violations should be suppressed when CSS is incomplete'
);
}
if (act.some(v => v.outcome !== 'unavailable')) {
throw Error(
'Expected unavailable ACT results for incomplete CSS'
);
}
}
const summary = {
cssOk,
act,
violationIds: violations.map(v => v.id)
};
results.push(summary);
console.log(
'PASS: actual a11yAxe() iframe, cssOk=' + cssOk
);
console.log(JSON.stringify(summary, null, 2));
}
const output = path.join(
process.env.BASE,
'regression/actual-axe-frame-results.json'
);
fs.writeFileSync(
output,
JSON.stringify(results, null, 2)
);
console.log('\n=== FRAME TEST PASSED ===');
console.log('Saved: ' + output);
console.log('Production changed: NO');
console.log('PM2 restarted: NO');
} finally {
await browser.close();
}
})().catch(error => {
console.error('TEST FAILED:', error.stack || error);
process.exitCode = 1;
});
===== PRODUCTION FILE HASHES =====
88422ce140ee30ffa1c972ff306e2595a7dff6408be0b64cf9567148b4230b60 /var/www/vhosts/aiwebpageseo.com/site-audit/public/accessibility-audit.js
bb62d2c9e747507641b676c5faf26b9794905acb39129d736356c4b5501d9958 /var/www/vhosts/aiwebpageseo.com/site-audit/public/a11y-axe/run.js
a63abfcdc28fab7516d895933e0f2457411d0d922d9eb942a06d2e71fad039f9 /var/www/vhosts/aiwebpageseo.com/site-audit/public/a11y-axe/text-spacing.js
305032a77f4ca61e8fd7b4d7aa4b1acab320038900d9393a2b99c5a0be77725b /var/www/vhosts/aiwebpageseo.com/site-audit/lib/a11y-rendered.js