@lullabot/playwright-testing 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/github-a11y-summary +2 -2
- package/bin/github-failure-summary +4 -4
- package/lib/accessibility-baseline-file.d.ts +6 -6
- package/lib/accessibility-baseline-file.js +29 -23
- package/lib/accessibility-baseline.js +5 -3
- package/lib/accessible-screenshot.d.ts +4 -4
- package/lib/accessible-screenshot.js +88 -76
- package/lib/focus.js +4 -1
- package/lib/frames.js +4 -4
- package/lib/github/a11y-summary.js +74 -79
- package/lib/github/attachments.d.ts +1 -1
- package/lib/github/attachments.js +36 -34
- package/lib/github/failure-summary.d.ts +4 -4
- package/lib/github/failure-summary.js +139 -107
- package/lib/github/index.d.ts +6 -6
- package/lib/github/report-paths.js +17 -9
- package/lib/hover.js +17 -17
- package/lib/images.js +15 -12
- package/lib/index.d.ts +13 -13
- package/lib/interaction-states.d.ts +2 -2
- package/lib/interaction-states.js +7 -7
- package/lib/mock/index.d.ts +1 -1
- package/lib/mock/youtube.d.ts +1 -1
- package/lib/mock/youtube.js +1 -1
- package/lib/pseudo-state.d.ts +2 -2
- package/lib/pseudo-state.js +15 -7
- package/lib/videos.js +21 -10
- package/lib/visualdiff.d.ts +4 -4
- package/lib/visualdiff.js +35 -27
- package/package.json +3 -3
- package/src/accessibility-baseline-file.test.ts +190 -154
- package/src/accessibility-baseline-file.ts +107 -83
- package/src/accessibility-baseline.test.ts +633 -433
- package/src/accessibility-baseline.ts +41 -21
- package/src/accessible-screenshot.test.ts +551 -423
- package/src/accessible-screenshot.ts +334 -245
- package/src/focus.test.ts +23 -23
- package/src/focus.ts +7 -2
- package/src/fonts.test.ts +13 -13
- package/src/fonts.ts +1 -1
- package/src/frames.test.ts +10 -8
- package/src/frames.ts +5 -5
- package/src/github/a11y-summary.test.ts +436 -332
- package/src/github/a11y-summary.ts +189 -179
- package/src/github/attachments.test.ts +228 -167
- package/src/github/attachments.ts +144 -121
- package/src/github/failure-summary.test.ts +659 -445
- package/src/github/failure-summary.ts +376 -274
- package/src/github/index.test.ts +14 -14
- package/src/github/index.ts +6 -6
- package/src/github/report-paths.test.ts +211 -156
- package/src/github/report-paths.ts +75 -61
- package/src/hover.test.ts +50 -46
- package/src/hover.ts +18 -18
- package/src/images.test.ts +251 -206
- package/src/images.ts +52 -43
- package/src/index.ts +13 -13
- package/src/interaction-states.test.ts +72 -42
- package/src/interaction-states.ts +43 -29
- package/src/mock/index.ts +1 -1
- package/src/mock/youtube.test.ts +26 -26
- package/src/mock/youtube.ts +4 -6
- package/src/pseudo-state.test.ts +58 -51
- package/src/pseudo-state.ts +32 -27
- package/src/videos.test.ts +559 -399
- package/src/videos.ts +68 -44
- package/src/visualdiff.test.ts +416 -315
- package/src/visualdiff.ts +140 -99
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
export interface AccessibilityBaselineEntry {
|
|
2
2
|
/** axe rule ID (e.g. 'color-contrast') */
|
|
3
|
-
rule: string
|
|
3
|
+
rule: string;
|
|
4
4
|
/** CSS selectors for the elements with this violation */
|
|
5
|
-
targets: string[]
|
|
5
|
+
targets: string[];
|
|
6
6
|
/** Why this violation is accepted */
|
|
7
|
-
reason: string
|
|
7
|
+
reason: string;
|
|
8
8
|
/** Link to tracking ticket */
|
|
9
|
-
willBeFixedIn: string
|
|
9
|
+
willBeFixedIn: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export type AccessibilityBaseline = AccessibilityBaselineEntry[]
|
|
12
|
+
export type AccessibilityBaseline = AccessibilityBaselineEntry[];
|
|
13
13
|
|
|
14
|
-
export function defineAccessibilityBaseline(
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
export function defineAccessibilityBaseline(
|
|
15
|
+
entries: AccessibilityBaseline,
|
|
16
|
+
): AccessibilityBaseline {
|
|
17
|
+
validateAccessibilityBaseline(entries);
|
|
18
|
+
return entries;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -22,29 +24,47 @@ export function defineAccessibilityBaseline(entries: AccessibilityBaseline): Acc
|
|
|
22
24
|
* Seed files deliberately contain TODO placeholders, so callers validate only
|
|
23
25
|
* committed/in-code baselines, not a seed during the local creation run.
|
|
24
26
|
*/
|
|
25
|
-
export function validateAccessibilityBaseline(
|
|
26
|
-
|
|
27
|
+
export function validateAccessibilityBaseline(
|
|
28
|
+
entries: AccessibilityBaseline,
|
|
29
|
+
): void {
|
|
30
|
+
const seen = new Set<string>();
|
|
27
31
|
|
|
28
32
|
entries.forEach((entry, index) => {
|
|
29
33
|
if (!entry.rule.trim()) {
|
|
30
|
-
throw new Error(
|
|
34
|
+
throw new Error(
|
|
35
|
+
`Accessibility baseline entry ${index + 1} requires a rule.`,
|
|
36
|
+
);
|
|
31
37
|
}
|
|
32
|
-
if (
|
|
33
|
-
|
|
38
|
+
if (
|
|
39
|
+
entry.targets.length === 0 ||
|
|
40
|
+
entry.targets.some((target) => !target.trim())
|
|
41
|
+
) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Accessibility baseline entry ${index + 1} requires at least one non-empty target.`,
|
|
44
|
+
);
|
|
34
45
|
}
|
|
35
|
-
if (!entry.reason.trim() || entry.reason.trim().toUpperCase() ===
|
|
36
|
-
throw new Error(
|
|
46
|
+
if (!entry.reason.trim() || entry.reason.trim().toUpperCase() === "TODO") {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`Accessibility baseline entry ${index + 1} requires a reason.`,
|
|
49
|
+
);
|
|
37
50
|
}
|
|
38
|
-
if (
|
|
39
|
-
|
|
51
|
+
if (
|
|
52
|
+
!entry.willBeFixedIn.trim() ||
|
|
53
|
+
entry.willBeFixedIn.trim().toUpperCase() === "TODO"
|
|
54
|
+
) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`Accessibility baseline entry ${index + 1} requires a willBeFixedIn tracking reference.`,
|
|
57
|
+
);
|
|
40
58
|
}
|
|
41
59
|
|
|
42
60
|
for (const target of new Set(entry.targets)) {
|
|
43
|
-
const key = JSON.stringify([entry.rule, target])
|
|
61
|
+
const key = JSON.stringify([entry.rule, target]);
|
|
44
62
|
if (seen.has(key)) {
|
|
45
|
-
throw new Error(
|
|
63
|
+
throw new Error(
|
|
64
|
+
`Accessibility baseline contains a duplicate waiver for ${entry.rule} on ${target}.`,
|
|
65
|
+
);
|
|
46
66
|
}
|
|
47
|
-
seen.add(key)
|
|
67
|
+
seen.add(key);
|
|
48
68
|
}
|
|
49
|
-
})
|
|
69
|
+
});
|
|
50
70
|
}
|