snap-ally 0.2.5-beta → 0.3.0

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.
Files changed (75) hide show
  1. package/dist/A11yReportAssets.d.ts +5 -12
  2. package/dist/A11yReportAssets.js +16 -82
  3. package/dist/A11yScanner.d.ts +2 -21
  4. package/dist/A11yScanner.js +16 -22
  5. package/dist/A11yTimeUtils.js +11 -23
  6. package/dist/A11yVisualReporter.d.ts +50 -0
  7. package/dist/A11yVisualReporter.js +188 -0
  8. package/dist/AccessibilityReporterOptions.d.ts +24 -0
  9. package/dist/AccessibilityReporterOptions.js +5 -0
  10. package/dist/ResolvedColors.d.ts +15 -0
  11. package/dist/ResolvedColors.js +20 -0
  12. package/dist/SnapAllyReporter.d.ts +12 -72
  13. package/dist/SnapAllyReporter.js +218 -329
  14. package/dist/core/A11yHtmlRenderer.d.ts +17 -0
  15. package/dist/core/A11yHtmlRenderer.js +118 -0
  16. package/dist/core/A11yReportAssets.d.ts +30 -0
  17. package/dist/core/A11yReportAssets.js +127 -0
  18. package/dist/core/A11yScanner.d.ts +8 -0
  19. package/dist/core/A11yScanner.js +178 -0
  20. package/dist/core/A11yVisualReporter.d.ts +50 -0
  21. package/dist/core/A11yVisualReporter.js +188 -0
  22. package/dist/core/HtmlRenderer.d.ts +14 -0
  23. package/dist/core/HtmlRenderer.js +106 -0
  24. package/dist/core/ReportAssets.d.ts +29 -0
  25. package/dist/core/ReportAssets.js +126 -0
  26. package/dist/core/Scanner.d.ts +7 -0
  27. package/dist/core/Scanner.js +162 -0
  28. package/dist/core/VisualReporter.d.ts +54 -0
  29. package/dist/core/VisualReporter.js +192 -0
  30. package/dist/index.d.ts +6 -6
  31. package/dist/index.js +13 -12
  32. package/dist/models/A11yDataSource.d.ts +15 -0
  33. package/dist/models/A11yDataSource.js +2 -0
  34. package/dist/models/A11yError.d.ts +34 -0
  35. package/dist/models/A11yError.js +11 -0
  36. package/dist/models/A11yScannerOptions.d.ts +24 -0
  37. package/dist/models/A11yScannerOptions.js +2 -0
  38. package/dist/models/AccessibilityReporterOptions.d.ts +24 -0
  39. package/dist/models/AccessibilityReporterOptions.js +5 -0
  40. package/dist/models/DataSource.d.ts +15 -0
  41. package/dist/models/DataSource.js +2 -0
  42. package/dist/models/ImagePath.d.ts +5 -0
  43. package/dist/models/ImagePath.js +3 -0
  44. package/dist/models/ReportData.d.ts +24 -0
  45. package/dist/models/ReportData.js +2 -0
  46. package/dist/models/ReporterOptions.d.ts +24 -0
  47. package/dist/models/ReporterOptions.js +5 -0
  48. package/dist/models/ResolvedColors.d.ts +16 -0
  49. package/dist/models/ResolvedColors.js +24 -0
  50. package/dist/models/ScannerOptions.d.ts +30 -0
  51. package/dist/models/ScannerOptions.js +2 -0
  52. package/dist/models/Severity.d.ts +7 -0
  53. package/dist/models/Severity.js +11 -0
  54. package/dist/models/Target.d.ts +10 -0
  55. package/dist/models/Target.js +3 -0
  56. package/dist/models/TestResults.d.ts +41 -0
  57. package/dist/models/TestResults.js +2 -0
  58. package/dist/models/TestStatusIcon.d.ts +8 -0
  59. package/dist/models/TestStatusIcon.js +12 -0
  60. package/dist/models/TestSummary.d.ts +34 -0
  61. package/dist/models/TestSummary.js +2 -0
  62. package/dist/models/Violation.d.ts +13 -0
  63. package/dist/models/Violation.js +2 -0
  64. package/dist/models/index.d.ts +12 -113
  65. package/dist/models/index.js +26 -16
  66. package/dist/templates/accessibility-report.html +75 -101
  67. package/dist/templates/execution-summary.html +37 -103
  68. package/dist/templates/global-report-styles.css +400 -9
  69. package/dist/templates/report-app.js +171 -73
  70. package/dist/templates/test-execution-report.html +84 -113
  71. package/dist/utils/A11yTimeUtils.d.ts +13 -0
  72. package/dist/utils/A11yTimeUtils.js +40 -0
  73. package/dist/utils/TimeUtils.d.ts +13 -0
  74. package/dist/utils/TimeUtils.js +39 -0
  75. package/package.json +2 -2
@@ -0,0 +1,54 @@
1
+ import { type Page, type TestInfo } from '@playwright/test';
2
+ /**
3
+ * Information about an accessibility violation to display.
4
+ */
5
+ interface ViolationInfo {
6
+ id: string;
7
+ help: string;
8
+ }
9
+ /**
10
+ * Manages visual feedback on the page during an accessibility scan.
11
+ * Handles element highlights, violation banners, and report attachments.
12
+ */
13
+ export declare class VisualReporter {
14
+ private readonly page;
15
+ private readonly overlayHostId;
16
+ private static readonly BANNER_ID;
17
+ private static readonly HIGHLIGHT_ID;
18
+ private static readonly HIGHLIGHT_PADDING;
19
+ private static readonly BANNER_ALPHA;
20
+ private static readonly HIGHLIGHT_SHADOW_ALPHA;
21
+ private static readonly PAGE_LIFECYCLE_ERROR_PATTERNS;
22
+ constructor(page: Page);
23
+ showBanner(violation: ViolationInfo, color: string): Promise<void>;
24
+ highlightElement(selector: string, color: string): Promise<void>;
25
+ cleanupOverlay(): Promise<void>;
26
+ removeHighlight(): Promise<void>;
27
+ attachJsonData(testInfo: TestInfo, name: string, data: string): Promise<void>;
28
+ captureScreenshot(testInfo: TestInfo, name: string): Promise<Buffer>;
29
+ /**
30
+ * Injects helper functions into the page context for overlay management.
31
+ * These helpers are used by visual feedback operations (banner, highlight).
32
+ */
33
+ private ensurePageHelpers;
34
+ /**
35
+ * Checks if an error message indicates a page lifecycle issue.
36
+ */
37
+ private isPageLifecycleError;
38
+ /**
39
+ * Executes a function in the page context with safety guarantees:
40
+ * 1. Ensures overlay helper functions are injected before execution
41
+ * 2. Gracefully handles page lifecycle errors (closed/destroyed pages)
42
+ *
43
+ * @param fn - Function to execute in the page context
44
+ * @param arg - Optional argument to pass to the function
45
+ */
46
+ private safeEvaluate;
47
+ }
48
+ declare global {
49
+ interface Window {
50
+ getOrCreateOverlayShadowRoot: (id: string) => ShadowRoot;
51
+ addAlphaToColor: (color: string, alpha: number) => string;
52
+ }
53
+ }
54
+ export {};
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VisualReporter = void 0;
4
+ const test_1 = require("@playwright/test");
5
+ /**
6
+ * Manages visual feedback on the page during an accessibility scan.
7
+ * Handles element highlights, violation banners, and report attachments.
8
+ */
9
+ class VisualReporter {
10
+ constructor(page) {
11
+ this.page = page;
12
+ this.overlayHostId = 'snap-ally-visual-root';
13
+ }
14
+ async showBanner(violation, color) {
15
+ await this.safeEvaluate(([v, rawColor, rootId, bannerId, bannerAlpha]) => {
16
+ const shadow = window.getOrCreateOverlayShadowRoot(rootId);
17
+ let container = shadow.getElementById(bannerId);
18
+ if (!container) {
19
+ const style = document.createElement('style');
20
+ style.textContent = `
21
+ #${bannerId} {
22
+ position: fixed;
23
+ left: 50%;
24
+ top: 24px;
25
+ transform: translateX(-50%);
26
+ width: calc(100% - 40px);
27
+ max-width: 600px;
28
+ padding: 12px 18px;
29
+ border-radius: 12px;
30
+ color: white;
31
+ font-family: system-ui, -apple-system, sans-serif;
32
+ font-size: 14px;
33
+ display: flex;
34
+ align-items: center;
35
+ gap: 12px;
36
+ box-shadow: 0 12px 40px rgba(0,0,0,0.3);
37
+ backdrop-filter: blur(16px) saturate(180%);
38
+ -webkit-backdrop-filter: blur(16px) saturate(180%);
39
+ border: 1px solid rgba(255,255,255,0.15);
40
+ z-index: 10000;
41
+ transition: all 0.3s ease;
42
+ }
43
+ .badge {
44
+ background: rgba(255,255,255,0.2);
45
+ padding: 2px 8px;
46
+ border-radius: 6px;
47
+ font-size: 11px;
48
+ font-weight: 700;
49
+ text-transform: uppercase;
50
+ border: 1px solid rgba(255,255,255,0.2);
51
+ }
52
+ .content { flex: 1; line-height: 1.4; font-weight: 500; }
53
+ `;
54
+ shadow.appendChild(style);
55
+ container = document.createElement('div');
56
+ container.id = bannerId;
57
+ shadow.appendChild(container);
58
+ }
59
+ container.style.backgroundColor = window.addAlphaToColor(rawColor, bannerAlpha);
60
+ container.innerHTML = `
61
+ <div style="font-size: 20px;">⚠️</div>
62
+ <div class="content">
63
+ <div style="margin-bottom:4px; display:flex; align-items:center; gap:8px;">
64
+ <span class="badge">${v.id}</span>
65
+ <span style="opacity: 0.9;">${v.help}</span>
66
+ </div>
67
+ </div>
68
+ `;
69
+ }, [violation, color, this.overlayHostId, VisualReporter.BANNER_ID, VisualReporter.BANNER_ALPHA]);
70
+ }
71
+ async highlightElement(selector, color) {
72
+ await this.safeEvaluate(([sel, rawColor, rootId, highlightId, padding, shadowAlpha]) => {
73
+ const target = document.querySelector(sel);
74
+ if (!target)
75
+ return;
76
+ target.scrollIntoView({ behavior: 'auto', block: 'center' });
77
+ const shadow = window.getOrCreateOverlayShadowRoot(rootId);
78
+ let highlight = shadow.getElementById(highlightId);
79
+ if (!highlight) {
80
+ const style = document.createElement('style');
81
+ style.textContent = `
82
+ #${highlightId} {
83
+ position: absolute;
84
+ pointer-events: none;
85
+ border-radius: 8px;
86
+ box-sizing: border-box;
87
+ z-index: 9999;
88
+ transition: all 0.2s ease;
89
+ box-shadow: 0 0 0 4px var(--c-alpha), 0 0 20px var(--c-alpha);
90
+ }
91
+ `;
92
+ shadow.appendChild(style);
93
+ highlight = document.createElement('div');
94
+ highlight.id = highlightId;
95
+ shadow.appendChild(highlight);
96
+ }
97
+ const rect = target.getBoundingClientRect();
98
+ highlight.style.left = `${rect.left + window.scrollX - padding}px`;
99
+ highlight.style.top = `${rect.top + window.scrollY - padding}px`;
100
+ highlight.style.width = `${rect.width + padding * 2}px`;
101
+ highlight.style.height = `${rect.height + padding * 2}px`;
102
+ highlight.style.border = `3px solid ${rawColor}`;
103
+ highlight.style.setProperty('--c-alpha', window.addAlphaToColor(rawColor, shadowAlpha));
104
+ }, [selector, color, this.overlayHostId, VisualReporter.HIGHLIGHT_ID, VisualReporter.HIGHLIGHT_PADDING, VisualReporter.HIGHLIGHT_SHADOW_ALPHA]);
105
+ }
106
+ async cleanupOverlay() {
107
+ await this.safeEvaluate((id) => { var _a; return (_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.remove(); }, this.overlayHostId);
108
+ }
109
+ async removeHighlight() {
110
+ await this.safeEvaluate(([rootId, hId]) => { var _a, _b, _c; return (_c = (_b = (_a = document.getElementById(rootId)) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.getElementById(hId)) === null || _c === void 0 ? void 0 : _c.remove(); }, [this.overlayHostId, VisualReporter.HIGHLIGHT_ID]);
111
+ }
112
+ async attachJsonData(testInfo, name, data) {
113
+ await testInfo.attach(name, {
114
+ contentType: 'application/json',
115
+ body: Buffer.from(data),
116
+ });
117
+ }
118
+ async captureScreenshot(testInfo, name) {
119
+ return await test_1.test.step('Capture A11y screenshot', async () => {
120
+ const screenshot = await this.page.screenshot({ fullPage: false });
121
+ await testInfo.attach(name, { contentType: 'image/png', body: screenshot });
122
+ return screenshot;
123
+ });
124
+ }
125
+ /**
126
+ * Injects helper functions into the page context for overlay management.
127
+ * These helpers are used by visual feedback operations (banner, highlight).
128
+ */
129
+ async ensurePageHelpers() {
130
+ await this.page.evaluate(() => {
131
+ const w = window;
132
+ // Check if both helpers are already defined
133
+ if (typeof w.getOrCreateOverlayShadowRoot === 'function' && typeof w.addAlphaToColor === 'function') {
134
+ return;
135
+ }
136
+ w.getOrCreateOverlayShadowRoot = (id) => {
137
+ let root = document.getElementById(id);
138
+ if (!root) {
139
+ root = document.createElement('div');
140
+ root.id = id;
141
+ root.style.cssText = 'position:absolute;top:0;left:0;width:0;height:0;z-index:2147483647;';
142
+ document.body.appendChild(root);
143
+ root.attachShadow({ mode: 'open' });
144
+ }
145
+ return root.shadowRoot;
146
+ };
147
+ w.addAlphaToColor = (color, alpha) => {
148
+ if (color.startsWith('rgba'))
149
+ return color.replace(/[\d.]+\)$/, `${alpha})`);
150
+ if (color.startsWith('rgb'))
151
+ return color.replace('rgb', 'rgba').replace(')', `, ${alpha})`);
152
+ const hex = Math.round(alpha * 255).toString(16).padStart(2, '0');
153
+ return `${color}${hex}`;
154
+ };
155
+ });
156
+ }
157
+ /**
158
+ * Checks if an error message indicates a page lifecycle issue.
159
+ */
160
+ isPageLifecycleError(message) {
161
+ const lowerMsg = message.toLowerCase();
162
+ return VisualReporter.PAGE_LIFECYCLE_ERROR_PATTERNS.some(pattern => lowerMsg.includes(pattern));
163
+ }
164
+ /**
165
+ * Executes a function in the page context with safety guarantees:
166
+ * 1. Ensures overlay helper functions are injected before execution
167
+ * 2. Gracefully handles page lifecycle errors (closed/destroyed pages)
168
+ *
169
+ * @param fn - Function to execute in the page context
170
+ * @param arg - Optional argument to pass to the function
171
+ */
172
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
173
+ async safeEvaluate(fn, arg) {
174
+ try {
175
+ await this.ensurePageHelpers();
176
+ await (arg !== undefined ? this.page.evaluate(fn, arg) : this.page.evaluate(fn));
177
+ }
178
+ catch (e) {
179
+ const msg = e instanceof Error ? e.message : String(e);
180
+ if (this.isPageLifecycleError(msg))
181
+ return;
182
+ throw e;
183
+ }
184
+ }
185
+ }
186
+ exports.VisualReporter = VisualReporter;
187
+ VisualReporter.BANNER_ID = 'snap-ally-banner';
188
+ VisualReporter.HIGHLIGHT_ID = 'snap-ally-highlight';
189
+ VisualReporter.HIGHLIGHT_PADDING = 4;
190
+ VisualReporter.BANNER_ALPHA = 0.85;
191
+ VisualReporter.HIGHLIGHT_SHADOW_ALPHA = 0.3;
192
+ VisualReporter.PAGE_LIFECYCLE_ERROR_PATTERNS = ['closed', 'destroyed', 'ended'];
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import SnapAllyReporter from './SnapAllyReporter';
2
2
  export default SnapAllyReporter;
3
- export { scanA11y, checkAccessibility, A11yScannerOptions } from './A11yScanner';
4
- export { AccessibilityReporterOptions } from './SnapAllyReporter';
5
- export { A11yAuditOverlay } from './A11yAuditOverlay';
6
- export { A11yReportAssets } from './A11yReportAssets';
7
- export { A11yHtmlRenderer } from './A11yHtmlRenderer';
8
- export { A11yTimeUtils } from './A11yTimeUtils';
3
+ export { SnapAllyReporter };
4
+ export { scanA11y, checkAccessibility } from './core/Scanner';
5
+ export { VisualReporter } from './core/VisualReporter';
6
+ export { ReportAssets } from './core/ReportAssets';
7
+ export { HtmlRenderer } from './core/HtmlRenderer';
8
+ export { TimeUtils } from './utils/TimeUtils';
9
9
  export * from './models';
package/dist/index.js CHANGED
@@ -17,18 +17,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.A11yTimeUtils = exports.A11yHtmlRenderer = exports.A11yReportAssets = exports.A11yAuditOverlay = exports.checkAccessibility = exports.scanA11y = void 0;
20
+ exports.TimeUtils = exports.HtmlRenderer = exports.ReportAssets = exports.VisualReporter = exports.checkAccessibility = exports.scanA11y = exports.SnapAllyReporter = void 0;
21
21
  const SnapAllyReporter_1 = __importDefault(require("./SnapAllyReporter"));
22
+ exports.SnapAllyReporter = SnapAllyReporter_1.default;
22
23
  exports.default = SnapAllyReporter_1.default;
23
- var A11yScanner_1 = require("./A11yScanner");
24
- Object.defineProperty(exports, "scanA11y", { enumerable: true, get: function () { return A11yScanner_1.scanA11y; } });
25
- Object.defineProperty(exports, "checkAccessibility", { enumerable: true, get: function () { return A11yScanner_1.checkAccessibility; } });
26
- var A11yAuditOverlay_1 = require("./A11yAuditOverlay");
27
- Object.defineProperty(exports, "A11yAuditOverlay", { enumerable: true, get: function () { return A11yAuditOverlay_1.A11yAuditOverlay; } });
28
- var A11yReportAssets_1 = require("./A11yReportAssets");
29
- Object.defineProperty(exports, "A11yReportAssets", { enumerable: true, get: function () { return A11yReportAssets_1.A11yReportAssets; } });
30
- var A11yHtmlRenderer_1 = require("./A11yHtmlRenderer");
31
- Object.defineProperty(exports, "A11yHtmlRenderer", { enumerable: true, get: function () { return A11yHtmlRenderer_1.A11yHtmlRenderer; } });
32
- var A11yTimeUtils_1 = require("./A11yTimeUtils");
33
- Object.defineProperty(exports, "A11yTimeUtils", { enumerable: true, get: function () { return A11yTimeUtils_1.A11yTimeUtils; } });
24
+ var Scanner_1 = require("./core/Scanner");
25
+ Object.defineProperty(exports, "scanA11y", { enumerable: true, get: function () { return Scanner_1.scanA11y; } });
26
+ Object.defineProperty(exports, "checkAccessibility", { enumerable: true, get: function () { return Scanner_1.checkAccessibility; } });
27
+ var VisualReporter_1 = require("./core/VisualReporter");
28
+ Object.defineProperty(exports, "VisualReporter", { enumerable: true, get: function () { return VisualReporter_1.VisualReporter; } });
29
+ var ReportAssets_1 = require("./core/ReportAssets");
30
+ Object.defineProperty(exports, "ReportAssets", { enumerable: true, get: function () { return ReportAssets_1.ReportAssets; } });
31
+ var HtmlRenderer_1 = require("./core/HtmlRenderer");
32
+ Object.defineProperty(exports, "HtmlRenderer", { enumerable: true, get: function () { return HtmlRenderer_1.HtmlRenderer; } });
33
+ var TimeUtils_1 = require("./utils/TimeUtils");
34
+ Object.defineProperty(exports, "TimeUtils", { enumerable: true, get: function () { return TimeUtils_1.TimeUtils; } });
34
35
  __exportStar(require("./models"), exports);
@@ -0,0 +1,15 @@
1
+ /** Union of the two shapes that can carry A11y data in Playwright results. */
2
+ export type A11yDataSource = {
3
+ type: 'attachment';
4
+ data: {
5
+ name: string;
6
+ body?: Buffer;
7
+ path?: string;
8
+ };
9
+ } | {
10
+ type: 'annotation';
11
+ data: {
12
+ type: string;
13
+ description?: string;
14
+ };
15
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,34 @@
1
+ /** Known Axe impact severity levels. */
2
+ export declare enum Severity {
3
+ minor = "minor",
4
+ moderate = "moderate",
5
+ serious = "serious",
6
+ critical = "critical"
7
+ }
8
+ /** Individual element that failed a specific accessibility rule. */
9
+ export interface Target {
10
+ element: string;
11
+ snippet: string;
12
+ html: string;
13
+ screenshot: string;
14
+ steps: string[];
15
+ stepsJson: string;
16
+ screenshotBase64: string;
17
+ }
18
+ /** Grouped error entry for a specific accessibility violation. */
19
+ export interface A11yError {
20
+ id: string;
21
+ description: string;
22
+ wcagRule: string;
23
+ severity: string;
24
+ help: string;
25
+ helpUrl: string;
26
+ guideline: string;
27
+ total: number;
28
+ target: Target[];
29
+ }
30
+ /** Simple image path and filename pair. */
31
+ export interface ImagePath {
32
+ srcPath: string;
33
+ fileName: string;
34
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Severity = void 0;
4
+ /** Known Axe impact severity levels. */
5
+ var Severity;
6
+ (function (Severity) {
7
+ Severity["minor"] = "minor";
8
+ Severity["moderate"] = "moderate";
9
+ Severity["serious"] = "serious";
10
+ Severity["critical"] = "critical";
11
+ })(Severity || (exports.Severity = Severity = {}));
@@ -0,0 +1,24 @@
1
+ import type { Locator } from '@playwright/test';
2
+ /**
3
+ * Options for the accessibility scanner.
4
+ */
5
+ export interface A11yScannerOptions {
6
+ /** Specific selector or locator to include in the scan. */
7
+ include?: string | Locator;
8
+ /** Alias for include. */
9
+ box?: string | Locator;
10
+ /** Whether to log violations to the console. @default true */
11
+ verbose?: boolean;
12
+ /** Alias for verbose. */
13
+ consoleLog?: boolean;
14
+ /** Specific Axe rules to enable or disable. */
15
+ rules?: Record<string, {
16
+ enabled: boolean;
17
+ }>;
18
+ /** Specific WCAG tags to check (e.g., ['wcag2a', 'wcag2aa']). */
19
+ tags?: string[];
20
+ /** Any other Axe-core options to pass to the builder. */
21
+ axeOptions?: Record<string, unknown>;
22
+ /** Custom identifier for the report file name. */
23
+ pageKey?: string;
24
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ export interface AccessibilityReporterOptions {
2
+ /**
3
+ * Folder where the reports will be generated.
4
+ * @default "steps-report"
5
+ */
6
+ outputFolder?: string;
7
+ /**
8
+ * Custom colors for violation severities in the report.
9
+ */
10
+ colors?: {
11
+ critical?: string;
12
+ serious?: string;
13
+ moderate?: string;
14
+ minor?: string;
15
+ };
16
+ /**
17
+ * Azure DevOps integration options.
18
+ */
19
+ ado?: {
20
+ organization?: string;
21
+ project?: string;
22
+ areaPath?: string;
23
+ };
24
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // ────────────────────────────────────────────────────────────────────────────
3
+ // Public options interface
4
+ // ────────────────────────────────────────────────────────────────────────────
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ /** Union of the two shapes that can carry data in Playwright results. */
2
+ export type DataSource = {
3
+ type: 'attachment';
4
+ data: {
5
+ name: string;
6
+ body?: Buffer;
7
+ path?: string;
8
+ };
9
+ } | {
10
+ type: 'annotation';
11
+ data: {
12
+ type: string;
13
+ description?: string;
14
+ };
15
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ /** Simple image path and filename pair. */
2
+ export interface ImagePath {
3
+ srcPath: string;
4
+ fileName: string;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ /** Simple image path and filename pair. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ import { Violation } from './Violation';
2
+ /** Complete data structure for an individual accessibility report. */
3
+ export interface ReportData {
4
+ pageKey: string;
5
+ pageUrl?: string;
6
+ /** No longer used; accessibility score derivation from Lighthouse removed. */
7
+ accessibilityScore: number;
8
+ /** Relative paths to videos for this a11y scan. */
9
+ video?: string | string[];
10
+ /** List of accessibility violations found. */
11
+ a11yErrors: Violation[];
12
+ /** Severity level colors used in the report. */
13
+ criticalColor: string;
14
+ seriousColor: string;
15
+ moderateColor: string;
16
+ minorColor: string;
17
+ /** ADO integration details. */
18
+ adoOrganization?: string;
19
+ adoProject?: string;
20
+ adoAreaPath?: string;
21
+ adoPat?: string;
22
+ /** Execution timestamp. */
23
+ timestamp?: string;
24
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ export interface ReporterOptions {
2
+ /**
3
+ * Folder where the reports will be generated.
4
+ * @default "steps-report"
5
+ */
6
+ outputFolder?: string;
7
+ /**
8
+ * Custom colors for violation severities in the report.
9
+ */
10
+ colors?: {
11
+ critical?: string;
12
+ serious?: string;
13
+ moderate?: string;
14
+ minor?: string;
15
+ };
16
+ /**
17
+ * Azure DevOps integration options.
18
+ */
19
+ ado?: {
20
+ organization?: string;
21
+ project?: string;
22
+ areaPath?: string;
23
+ };
24
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // ────────────────────────────────────────────────────────────────────────────
3
+ // Public options interface
4
+ // ────────────────────────────────────────────────────────────────────────────
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ /** Resolved severity color palette. */
2
+ export interface ResolvedColors {
3
+ critical: string;
4
+ serious: string;
5
+ moderate: string;
6
+ minor: string;
7
+ }
8
+ /** Default severity colors used when the user doesn't override them. */
9
+ export declare const DEFAULT_COLORS: Readonly<ResolvedColors>;
10
+ /** Default fallback color for unknown severities. */
11
+ export declare const FALLBACK_GRAY = "#757575";
12
+ /**
13
+ * Maps an Axe 'impact' level to its corresponding hex color.
14
+ * Supports optional custom color overrides.
15
+ */
16
+ export declare function getSeverityColor(impact?: string | null, customColors?: Partial<ResolvedColors>): string;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FALLBACK_GRAY = exports.DEFAULT_COLORS = void 0;
4
+ exports.getSeverityColor = getSeverityColor;
5
+ /** Default severity colors used when the user doesn't override them. */
6
+ exports.DEFAULT_COLORS = {
7
+ critical: '#dc2626', // Power Red
8
+ serious: '#ea580c', // Deep Orange
9
+ moderate: '#f59e0b', // Amber/Honey
10
+ minor: '#f0f06f', // Ocean Blue (Updated to Yellow per user request)
11
+ };
12
+ /** Default fallback color for unknown severities. */
13
+ exports.FALLBACK_GRAY = '#757575';
14
+ /**
15
+ * Maps an Axe 'impact' level to its corresponding hex color.
16
+ * Supports optional custom color overrides.
17
+ */
18
+ function getSeverityColor(impact, customColors) {
19
+ const level = (impact || 'minor');
20
+ if (customColors && customColors[level]) {
21
+ return customColors[level];
22
+ }
23
+ return exports.DEFAULT_COLORS[level] || exports.FALLBACK_GRAY;
24
+ }
@@ -0,0 +1,30 @@
1
+ import type { Locator } from '@playwright/test';
2
+ /**
3
+ * Options for the accessibility scanner.
4
+ */
5
+ export interface ScannerOptions {
6
+ /** Specific selector or locator to include in the scan. */
7
+ include?: string | Locator;
8
+ /** Alias for include. */
9
+ box?: string | Locator;
10
+ /** Whether to log violations to the console. @default true */
11
+ verbose?: boolean;
12
+ /** Alias for verbose. */
13
+ consoleLog?: boolean;
14
+ /** Specific Axe rules to enable or disable. */
15
+ rules?: Record<string, {
16
+ enabled: boolean;
17
+ }>;
18
+ /** Specific WCAG tags to check (e.g., ['wcag2a', 'wcag2aa']). */
19
+ tags?: string[];
20
+ /** Any other Axe-core options to pass to the builder. */
21
+ axeOptions?: Record<string, unknown>;
22
+ /** Custom identifier for the report file name. */
23
+ pageKey?: string;
24
+ /** Azure DevOps integration options for bug reporting. */
25
+ ado?: {
26
+ organization?: string;
27
+ project?: string;
28
+ areaPath?: string;
29
+ };
30
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /** Known Axe impact severity levels. */
2
+ export declare enum Severity {
3
+ minor = "minor",
4
+ moderate = "moderate",
5
+ serious = "serious",
6
+ critical = "critical"
7
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /** Known Axe impact severity levels. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Severity = void 0;
5
+ var Severity;
6
+ (function (Severity) {
7
+ Severity["minor"] = "minor";
8
+ Severity["moderate"] = "moderate";
9
+ Severity["serious"] = "serious";
10
+ Severity["critical"] = "critical";
11
+ })(Severity || (exports.Severity = Severity = {}));
@@ -0,0 +1,10 @@
1
+ /** Individual element that failed a specific accessibility rule. */
2
+ export interface Target {
3
+ element: string;
4
+ snippet: string;
5
+ html: string;
6
+ screenshot: string;
7
+ steps: string[];
8
+ stepsJson: string;
9
+ screenshotBase64: string;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ /** Individual element that failed a specific accessibility rule. */
3
+ Object.defineProperty(exports, "__esModule", { value: true });