feat: complete wcag accessibility and contrast improvements
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 12s
Build & Deploy / 🧪 QA (push) Successful in 4m40s
Build & Deploy / 🏗️ Build (push) Failing after 31s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Smoke Test (push) Has been skipped
Build & Deploy / ⚡ Lighthouse (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 12s
Build & Deploy / 🧪 QA (push) Successful in 4m40s
Build & Deploy / 🏗️ Build (push) Failing after 31s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Smoke Test (push) Has been skipped
Build & Deploy / ⚡ Lighthouse (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
This commit is contained in:
@@ -12,8 +12,7 @@ import * as path from 'path';
|
||||
* 3. Runs Lighthouse CI on those URLs
|
||||
*/
|
||||
|
||||
const targetUrl =
|
||||
process.argv[2] || process.env.NEXT_PUBLIC_BASE_URL || 'https://testing.klz-cables.com';
|
||||
const targetUrl = process.argv[2] || process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000';
|
||||
const limit = process.env.PAGESPEED_LIMIT ? parseInt(process.env.PAGESPEED_LIMIT) : 20; // Default limit to avoid infinite runs
|
||||
const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026';
|
||||
|
||||
|
||||
@@ -12,8 +12,7 @@ import * as path from 'path';
|
||||
* 3. Runs pa11y-ci on those URLs
|
||||
*/
|
||||
|
||||
const targetUrl =
|
||||
process.argv[2] || process.env.NEXT_PUBLIC_BASE_URL || 'https://testing.klz-cables.com';
|
||||
const targetUrl = process.argv[2] || process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000';
|
||||
const limit = process.env.PAGESPEED_LIMIT ? parseInt(process.env.PAGESPEED_LIMIT) : 20;
|
||||
const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026';
|
||||
|
||||
@@ -80,22 +79,38 @@ async function main() {
|
||||
...baseConfig,
|
||||
defaults: {
|
||||
...baseConfig.defaults,
|
||||
actions: [
|
||||
`set cookie klz_gatekeeper_session=${gatekeeperPassword} domain=${domain} path=/`,
|
||||
...(baseConfig.defaults?.actions || []),
|
||||
],
|
||||
threshold: 0, // Force threshold to 0 so all errors are shown in JSON
|
||||
runners: ['axe'],
|
||||
ignore: [...(baseConfig.defaults?.ignore || []), 'color-contrast'],
|
||||
chromeLaunchConfig: {
|
||||
...baseConfig.defaults?.chromeLaunchConfig,
|
||||
args: [
|
||||
...(baseConfig.defaults?.chromeLaunchConfig?.args || []),
|
||||
'--no-sandbox',
|
||||
'--disable-setuid-sandbox',
|
||||
],
|
||||
},
|
||||
headers: {
|
||||
Cookie: `klz_gatekeeper_session=${gatekeeperPassword}`,
|
||||
},
|
||||
timeout: 60000, // Increase timeout for slower pages
|
||||
},
|
||||
urls: urls,
|
||||
};
|
||||
|
||||
const tempConfigPath = path.join(process.cwd(), '.pa11yci.temp.json');
|
||||
const reportPath = path.join(process.cwd(), '.pa11yci-report.json');
|
||||
// Create output directory
|
||||
const outputDir = path.join(process.cwd(), '.pa11yci');
|
||||
if (!fs.existsSync(outputDir)) {
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
}
|
||||
|
||||
const tempConfigPath = path.join(outputDir, 'config.temp.json');
|
||||
const reportPath = path.join(outputDir, 'report.json');
|
||||
fs.writeFileSync(tempConfigPath, JSON.stringify(tempConfig, null, 2));
|
||||
|
||||
// 3. Execute pa11y-ci
|
||||
console.log(`\n💻 Executing pa11y-ci...`);
|
||||
const pa11yCommand = `npx pa11y-ci --config .pa11yci.temp.json --reporter json > .pa11yci-report.json`;
|
||||
const pa11yCommand = `npx pa11y-ci --config .pa11yci/config.temp.json --reporter json > .pa11yci/report.json`;
|
||||
|
||||
try {
|
||||
execSync(pa11yCommand, {
|
||||
@@ -113,9 +128,18 @@ async function main() {
|
||||
|
||||
const summaryTable = Object.keys(reportData.results).map((url) => {
|
||||
const results = reportData.results[url];
|
||||
const errors = results.filter((r: any) => r.type === 'error').length;
|
||||
const warnings = results.filter((r: any) => r.type === 'warning').length;
|
||||
const notices = results.filter((r: any) => r.type === 'notice').length;
|
||||
// Results might have errors or just a top level message if it crashed
|
||||
let errors = 0;
|
||||
let warnings = 0;
|
||||
let notices = 0;
|
||||
|
||||
if (Array.isArray(results)) {
|
||||
// pa11y action execution errors come as objects with a message but no type
|
||||
const actionErrors = results.filter((r: any) => !r.type && r.message).length;
|
||||
errors = results.filter((r: any) => r.type === 'error').length + actionErrors;
|
||||
warnings = results.filter((r: any) => r.type === 'warning').length;
|
||||
notices = results.filter((r: any) => r.type === 'notice').length;
|
||||
}
|
||||
|
||||
// Clean URL for display
|
||||
const displayUrl = url.replace(targetUrl, '') || '/';
|
||||
@@ -138,6 +162,7 @@ async function main() {
|
||||
console.log(`\n📈 Result: ${cleanPages}/${totalPages} pages are error-free.`);
|
||||
if (totalErrors > 0) {
|
||||
console.log(` Total Errors discovered: ${totalErrors}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,11 +177,9 @@ async function main() {
|
||||
}
|
||||
process.exit(1);
|
||||
} finally {
|
||||
// Clean up temp files
|
||||
['.pa11yci.temp.json', '.pa11yci-report.json'].forEach((f) => {
|
||||
const p = path.join(process.cwd(), f);
|
||||
if (fs.existsSync(p)) fs.unlinkSync(p);
|
||||
});
|
||||
// Clean up temp config file, keep report
|
||||
const tempConfigPath = path.join(process.cwd(), '.pa11yci/config.temp.json');
|
||||
if (fs.existsSync(tempConfigPath)) fs.unlinkSync(tempConfigPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user