Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions e2e/verify/base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ test.describe('Verify - base functionality', () => {
test('zero state loads', async ({ page }) => {
const verify = new VerifyPage(page);
await verify.goto();
await verify.testAccessibility();
await verify.takeSnapshot(`zero state`);
});

Expand All @@ -36,6 +37,7 @@ test.describe('Verify - base functionality', () => {
const verify = new VerifyPage(page);
const source = VerifyPage.getFixtureUrl('CAICAI.jpg', 'file');
await verify.goto(source);
await verify.testAccessibility();
await verify.takeTallSnapshot(`result for CAICAI.jpg via source`);
});

Expand Down
11 changes: 10 additions & 1 deletion e2e/verify/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

/// <reference lib="dom"/>

import AxeBuilder from '@axe-core/playwright';
import type { SnapshotOptions } from '@percy/core';
import percySnapshot from '@percy/playwright';
import { type Locator, type Page } from '@playwright/test';
import { expect, type Locator, type Page } from '@playwright/test';
import { mkdirp } from 'mkdirp';
import { writeFile } from 'node:fs/promises';
import { resolve } from 'node:path';
Expand Down Expand Up @@ -79,6 +80,14 @@ export class VerifyPage {
});
}

async testAccessibility() {
const accessibilityScanResults = await new AxeBuilder({
page: this.page,
}).analyze();

expect(accessibilityScanResults.violations).toEqual([]);
}

async takeDebugSnapshot(name: string, options: SnapshotOptions = {}) {
const type = 'jpeg';
const height = options.minHeight ?? percyConfig.snapshot['min-height'];
Expand Down
Loading