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
@@ -1,35 +1,7 @@
1
- import { Reporter, TestCase, TestResult, FullResult, FullConfig } from '@playwright/test/reporter';
2
- export interface AccessibilityReporterOptions {
3
- /**
4
- * Folder where the reports will be generated.
5
- * @default "steps-report"
6
- */
7
- outputFolder?: string;
8
- /**
9
- * Custom colors for violation severities in the report.
10
- */
11
- colors?: {
12
- critical?: string;
13
- serious?: string;
14
- moderate?: string;
15
- minor?: string;
16
- };
17
- /**
18
- * Azure DevOps integration options.
19
- */
20
- ado?: {
21
- organization?: string;
22
- project?: string;
23
- areaPath?: string;
24
- };
25
- }
1
+ import type { FullConfig, Reporter, TestCase, TestResult, FullResult } from '@playwright/test/reporter';
2
+ import { ReporterOptions } from './models';
26
3
  /**
27
4
  * Playwright reporter for accessibility audits and test steps.
28
- *
29
- * Generates:
30
- * - A per-test execution report (steps, video, screenshots, errors)
31
- * - A per-scan accessibility report (violations, evidence, ADO integration)
32
- * - A global execution summary with per-browser breakdowns
33
5
  */
34
6
  declare class SnapAllyReporter implements Reporter {
35
7
  private readonly outputFolder;
@@ -38,55 +10,23 @@ declare class SnapAllyReporter implements Reporter {
38
10
  private readonly options;
39
11
  private readonly colors;
40
12
  private projectRoot;
41
- /**
42
- * Monotonically increasing test counter.
43
- * Incremented synchronously in {@link onTestEnd} to avoid race conditions
44
- * when multiple async {@link processTestResult} calls run concurrently.
45
- */
46
13
  private testIndex;
47
- /** Async tasks queued by `onTestEnd`; drained in `onEnd`. */
48
14
  private readonly tasks;
49
- /** Aggregated data for the final summary report. */
50
15
  private readonly executionSummary;
51
- constructor(options?: AccessibilityReporterOptions);
16
+ private readonly testRuleCounts;
17
+ private readonly testGlobalCounts;
18
+ constructor(options?: ReporterOptions);
52
19
  printsToStdio(): boolean;
20
+ /**
21
+ * Validates that the output folder is safe to delete.
22
+ * Prevents accidental deletion of critical directories like repo root, parent dirs, or system paths.
23
+ */
24
+ private validateOutputFolder;
53
25
  onBegin(config: FullConfig): void;
54
26
  onTestEnd(test: TestCase, result: TestResult): void;
55
27
  onEnd(result: FullResult): Promise<void>;
56
28
  private processTestResult;
57
- /** Extracts structured metadata from test annotations and result steps. */
58
- private extractTestMetadata;
59
- /** Determines the browser name for the current test. */
60
- private resolveBrowser;
61
- /** Converts Playwright error objects into HTML-safe strings. */
62
- private extractErrorLogs;
63
- /** Return value for {@link processAccessibilityData}. */
64
- private processAccessibilityData;
65
- /** Collects all A11y data sources (attachments + annotations) for a test. */
66
- private collectA11yDataSources;
67
- /** Attempts to parse a single A11y data source into a ReportData object. */
68
- private parseA11ySource;
69
- /** Generates a sanitized HTML filename for an accessibility report. */
70
- private buildA11yReportName;
71
- /** Applies reporter-level configuration (colors, ADO, video) to a ReportData object. */
72
- private applyReportConfig;
73
- /**
74
- * Backfills reproduction steps from `test.step` calls into a11y targets
75
- * that have no steps recorded (e.g. violations found via static scan).
76
- */
77
- private backfillSteps;
78
- /**
79
- * Aggregates a11y error counts into both the browser-specific and global
80
- * summaries. Returns the total error count for this scan.
81
- */
82
- private aggregateA11yErrors;
83
- /** Updates the browser-specific test counts (passed/failed/skipped). */
84
- private updateBrowserSummary;
85
- /** Updates the global execution summary counts. */
86
- private updateGlobalSummary;
87
- /** Ensures a file group key exists in the grouped results map. */
88
- private ensureGroupExists;
89
- /** Lazily initialises and returns the browser summary for the given browser name. */
90
- private getOrCreateBrowserSummary;
29
+ private getStatusIcon;
30
+ private updateSummary;
91
31
  }
92
32
  export default SnapAllyReporter;