Skip to content

Commit e28ed11

Browse files
committed
Updates site-with-errors test
1 parent b150539 commit e28ed11

2 files changed

Lines changed: 48 additions & 17 deletions

File tree

tests/site-with-errors.test.ts

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,61 +17,91 @@ describe("site-with-errors", () => {
1717

1818
it("cache has expected results", () => {
1919
const actual = results.map(({ issue: { url: issueUrl }, pullRequest: { url: pullRequestUrl }, findings }) => {
20-
const { problemUrl, solutionLong, ...finding } = findings[0];
20+
const { problemUrl, solutionLong, screenshotId, ...finding } =
21+
findings[0];
2122
// Check volatile fields for existence only
2223
expect(issueUrl).toBeDefined();
2324
expect(pullRequestUrl).toBeDefined();
2425
expect(problemUrl).toBeDefined();
2526
expect(solutionLong).toBeDefined();
27+
expect(screenshotId).toBeDefined();
2628
// Check `problemUrl`, ignoring axe version
27-
expect(problemUrl.startsWith("https://dequeuniversity.com/rules/axe/")).toBe(true);
28-
expect(problemUrl.endsWith(`/${finding.ruleId}?application=playwright`)).toBe(true);
29+
expect(
30+
problemUrl.startsWith("https://dequeuniversity.com/rules/axe/"),
31+
).toBe(true);
32+
expect(
33+
problemUrl.endsWith(`/${finding.ruleId}?application=playwright`),
34+
).toBe(true);
35+
// Check `screenshotId` is a valid UUID
36+
expect(screenshotId).toMatch(
37+
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
38+
);
2939
return finding;
3040
});
3141
const expected = [
3242
{
3343
scannerType: "axe",
3444
url: "http://127.0.0.1:4000/",
3545
html: '<span class="post-meta">Jul 30, 2025</span>',
36-
problemShort: "elements must meet minimum color contrast ratio thresholds",
46+
problemShort:
47+
"elements must meet minimum color contrast ratio thresholds",
3748
ruleId: "color-contrast",
38-
solutionShort: "ensure the contrast between foreground and background colors meets wcag 2 aa minimum contrast ratio thresholds"
39-
}, {
49+
solutionShort:
50+
"ensure the contrast between foreground and background colors meets wcag 2 aa minimum contrast ratio thresholds",
51+
screenshotId: "12345678-1234-1234-1234-123456789012",
52+
},
53+
{
4054
scannerType: "axe",
4155
url: "http://127.0.0.1:4000/",
4256
html: '<html lang="en">',
4357
problemShort: "page should contain a level-one heading",
4458
ruleId: "page-has-heading-one",
45-
solutionShort: "ensure that the page, or at least one of its frames contains a level-one heading"
46-
}, {
59+
solutionShort:
60+
"ensure that the page, or at least one of its frames contains a level-one heading",
61+
screenshotId: "12345678-1234-1234-1234-123456789012",
62+
},
63+
{
4764
scannerType: "axe",
4865
url: "http://127.0.0.1:4000/jekyll/update/2025/07/30/welcome-to-jekyll.html",
4966
html: `<time class="dt-published" datetime="2025-07-30T17:32:33+00:00" itemprop="datePublished">Jul 30, 2025
5067
</time>`,
51-
problemShort: "elements must meet minimum color contrast ratio thresholds",
68+
problemShort:
69+
"elements must meet minimum color contrast ratio thresholds",
5270
ruleId: "color-contrast",
53-
solutionShort: "ensure the contrast between foreground and background colors meets wcag 2 aa minimum contrast ratio thresholds",
54-
}, {
71+
solutionShort:
72+
"ensure the contrast between foreground and background colors meets wcag 2 aa minimum contrast ratio thresholds",
73+
screenshotId: "12345678-1234-1234-1234-123456789012",
74+
},
75+
{
5576
scannerType: "axe",
5677
url: "http://127.0.0.1:4000/about/",
5778
html: '<a href="https://jekyllrb.com/">jekyllrb.com</a>',
58-
problemShort: "elements must meet minimum color contrast ratio thresholds",
79+
problemShort:
80+
"elements must meet minimum color contrast ratio thresholds",
5981
ruleId: "color-contrast",
60-
solutionShort: "ensure the contrast between foreground and background colors meets wcag 2 aa minimum contrast ratio thresholds",
61-
}, {
82+
solutionShort:
83+
"ensure the contrast between foreground and background colors meets wcag 2 aa minimum contrast ratio thresholds",
84+
screenshotId: "12345678-1234-1234-1234-123456789012",
85+
},
86+
{
6287
scannerType: "axe",
6388
url: "http://127.0.0.1:4000/404.html",
6489
html: '<li class="p-name">Accessibility Scanner Demo</li>',
65-
problemShort: "elements must meet minimum color contrast ratio thresholds",
90+
problemShort:
91+
"elements must meet minimum color contrast ratio thresholds",
6692
ruleId: "color-contrast",
67-
solutionShort: "ensure the contrast between foreground and background colors meets wcag 2 aa minimum contrast ratio thresholds"
68-
}, {
93+
solutionShort:
94+
"ensure the contrast between foreground and background colors meets wcag 2 aa minimum contrast ratio thresholds",
95+
screenshotId: "12345678-1234-1234-1234-123456789012",
96+
},
97+
{
6998
scannerType: "axe",
7099
url: "http://127.0.0.1:4000/404.html",
71100
html: '<h1 class="post-title"></h1>',
72101
problemShort: "headings should not be empty",
73102
ruleId: "empty-heading",
74103
solutionShort: "ensure headings have discernible text",
104+
screenshotId: "12345678-1234-1234-1234-123456789012",
75105
},
76106
];
77107
// Check that:

tests/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export type Finding = {
77
problemUrl: string;
88
solutionShort: string;
99
solutionLong?: string;
10+
screenshotId?: string;
1011
};
1112

1213
export type Issue = {

0 commit comments

Comments
 (0)