26 lines
1011 B
JavaScript
26 lines
1011 B
JavaScript
const { test, expect } = require('@playwright/test');
|
|
const AxeBuilder = require('@axe-core/playwright').default;
|
|
|
|
test.use({ viewport: { width: 1920, height: 1080 } });
|
|
|
|
test.describe('archive-projects', () => {
|
|
test('project archive renders grid or empty + zero axe violations', async ({ page }, testInfo) => {
|
|
await page.goto('/projects/');
|
|
await page.screenshot({ path: 'test-results/archive.png', fullPage: true });
|
|
|
|
await expect(page.locator('.archive-projects__head h1')).toBeVisible();
|
|
const grid = page.locator('.archive-projects__grid');
|
|
const empty = page.locator('.archive-projects__empty');
|
|
await expect(grid.or(empty)).toBeVisible();
|
|
|
|
const results = await new AxeBuilder({ page })
|
|
.withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22a', 'wcag22aa'])
|
|
.analyze();
|
|
await testInfo.attach('axe', {
|
|
body: JSON.stringify(results, null, 2),
|
|
contentType: 'application/json',
|
|
});
|
|
expect(results.violations).toEqual([]);
|
|
});
|
|
});
|