aria-ease 2.8.0 → 2.8.2
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/cli.js +3 -4
- package/dist/chunk-PCORWVIQ.js +213 -0
- package/dist/{chunk-4F6O5RKZ.js → chunk-SSBW5VAA.js} +0 -1
- package/dist/{contractTestRunnerPlaywright-FM6MK6DY.js → contractTestRunnerPlaywright-SE6TPWZZ.js} +1 -2
- package/{bin/contractTestRunnerPlaywright-2LQHVMXT.js → dist/contractTestRunnerPlaywright-YNHMLHQ2.js} +6 -178
- package/dist/contractTestRunnerPlaywright-ZY2T4UTV.js +254 -0
- package/dist/index.cjs +23 -8
- package/dist/index.d.cts +11 -14
- package/dist/index.d.ts +11 -14
- package/dist/index.js +24 -9
- package/dist/src/{Types.d-BbztRe-S.d.cts → Types.d-w1KLKLcA.d.cts} +8 -1
- package/dist/src/{Types.d-BbztRe-S.d.ts → Types.d-w1KLKLcA.d.ts} +8 -1
- package/dist/src/accordion/index.cjs +0 -2
- package/dist/src/accordion/index.d.cts +1 -1
- package/dist/src/accordion/index.d.ts +1 -1
- package/dist/src/accordion/index.js +0 -2
- package/dist/src/block/index.cjs +13 -5
- package/dist/src/block/index.d.cts +4 -3
- package/dist/src/block/index.d.ts +4 -3
- package/dist/src/block/index.js +14 -6
- package/dist/src/checkbox/index.cjs +0 -2
- package/dist/src/checkbox/index.d.cts +1 -1
- package/dist/src/checkbox/index.d.ts +1 -1
- package/dist/src/checkbox/index.js +0 -2
- package/dist/src/{chunk-DF4OR64G.js → chunk-TBJ6MIC7.js} +0 -2
- package/dist/src/menu/index.cjs +9 -4
- package/dist/src/menu/index.d.cts +4 -11
- package/dist/src/menu/index.d.ts +4 -11
- package/dist/src/menu/index.js +10 -5
- package/dist/src/radio/index.cjs +0 -2
- package/dist/src/radio/index.d.cts +1 -1
- package/dist/src/radio/index.d.ts +1 -1
- package/dist/src/radio/index.js +0 -2
- package/dist/src/toggle/index.cjs +0 -2
- package/dist/src/toggle/index.d.cts +1 -1
- package/dist/src/toggle/index.d.ts +1 -1
- package/dist/src/toggle/index.js +0 -2
- package/dist/src/utils/test/{chunk-UAS6V5MH.js → chunk-SSBW5VAA.js} +0 -2
- package/dist/src/utils/test/{contractTestRunnerPlaywright-IBC4FHWK.js → contractTestRunnerPlaywright-I36Y2NHA.js} +1 -3
- package/dist/src/utils/test/contractTestRunnerPlaywright-YNHMLHQ2.js +249 -0
- package/dist/src/utils/test/contractTestRunnerPlaywright-ZY2T4UTV.js +249 -0
- package/dist/src/utils/test/contracts/MenuContract.json +52 -8
- package/dist/src/utils/test/index.cjs +1 -3
- package/dist/src/utils/test/index.js +2 -4
- package/package.json +14 -13
- package/bin/cli.cjs +0 -475
- package/bin/cli.cjs.map +0 -1
- package/bin/cli.d.cts +0 -1
- package/bin/cli.d.ts +0 -1
- package/bin/cli.d.ts.map +0 -1
- package/bin/cli.js.map +0 -1
- package/bin/cli.ts +0 -122
- package/bin/configLoader.d.ts +0 -19
- package/bin/configLoader.d.ts.map +0 -1
- package/bin/configLoader.js +0 -155
- package/bin/configLoader.ts +0 -170
- package/bin/contractTestRunnerPlaywright-2LQHVMXT.js.map +0 -1
- package/dist/chunk-4F6O5RKZ.js.map +0 -1
- package/dist/contractTestRunnerPlaywright-FM6MK6DY.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/src/accordion/index.cjs.map +0 -1
- package/dist/src/accordion/index.js.map +0 -1
- package/dist/src/block/index.cjs.map +0 -1
- package/dist/src/block/index.js.map +0 -1
- package/dist/src/checkbox/index.cjs.map +0 -1
- package/dist/src/checkbox/index.js.map +0 -1
- package/dist/src/chunk-CGC24XEF.js +0 -127
- package/dist/src/chunk-CGC24XEF.js.map +0 -1
- package/dist/src/chunk-DF4OR64G.js.map +0 -1
- package/dist/src/chunk-MNMWQWXH.js +0 -117
- package/dist/src/chunk-MNMWQWXH.js.map +0 -1
- package/dist/src/menu/index.cjs.map +0 -1
- package/dist/src/menu/index.js.map +0 -1
- package/dist/src/radio/index.cjs.map +0 -1
- package/dist/src/radio/index.js.map +0 -1
- package/dist/src/toggle/index.cjs.map +0 -1
- package/dist/src/toggle/index.js.map +0 -1
- package/dist/src/utils/test/chunk-UAS6V5MH.js.map +0 -1
- package/dist/src/utils/test/contractTestRunnerPlaywright-IBC4FHWK.js.map +0 -1
- package/dist/src/utils/test/index.cjs.map +0 -1
- package/dist/src/utils/test/index.js.map +0 -1
package/bin/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// src/utils/cli/cli.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
import path2 from "path";
|
|
@@ -248,7 +248,7 @@ if (typeof window === "undefined") {
|
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
//
|
|
251
|
+
// src/utils/cli/configLoader.js
|
|
252
252
|
import path from "path";
|
|
253
253
|
import fs from "fs-extra";
|
|
254
254
|
function validateConfig(config) {
|
|
@@ -364,7 +364,7 @@ async function loadConfig(cwd = process.cwd()) {
|
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
//
|
|
367
|
+
// src/utils/cli/cli.ts
|
|
368
368
|
var program = new Command();
|
|
369
369
|
program.name("aria-ease").description("Run accessibility tests and audits").version("2.2.3");
|
|
370
370
|
program.command("audit").description("Run axe-core powered accessibility audit on webpages").option("-u, --url <url>", "Single URL to audit").option("-f, --format <format>", "Output format for the audit report: json | csv | html | all", "all").option("-o, --out <path>", "Directory to save the audit report", "./accessibility-reports/audit").action(async (opts) => {
|
|
@@ -449,4 +449,3 @@ program.command("help").description("Display help information").action(() => {
|
|
|
449
449
|
program.outputHelp();
|
|
450
450
|
});
|
|
451
451
|
program.parse(process.argv);
|
|
452
|
-
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
|
|
33
|
+
// src/utils/test/contract/contract.json
|
|
34
|
+
var contract_default = {
|
|
35
|
+
menu: {
|
|
36
|
+
path: "./contracts/MenuContract.json",
|
|
37
|
+
component: "menu"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/utils/test/contract/ContractReporter.ts
|
|
42
|
+
var ContractReporter = class {
|
|
43
|
+
startTime = 0;
|
|
44
|
+
componentName = "";
|
|
45
|
+
staticPasses = 0;
|
|
46
|
+
staticFailures = 0;
|
|
47
|
+
dynamicResults = [];
|
|
48
|
+
totalTests = 0;
|
|
49
|
+
skipped = 0;
|
|
50
|
+
isPlaywright = false;
|
|
51
|
+
constructor(isPlaywright = false) {
|
|
52
|
+
this.isPlaywright = isPlaywright;
|
|
53
|
+
}
|
|
54
|
+
log(message) {
|
|
55
|
+
process.stderr.write(message + "\n");
|
|
56
|
+
}
|
|
57
|
+
start(componentName, totalTests) {
|
|
58
|
+
this.startTime = Date.now();
|
|
59
|
+
this.componentName = componentName;
|
|
60
|
+
this.totalTests = totalTests;
|
|
61
|
+
const mode = this.isPlaywright ? "Playwright (Real Browser)" : "jsdom (Fast)";
|
|
62
|
+
this.log(`
|
|
63
|
+
${"\u2550".repeat(60)}`);
|
|
64
|
+
this.log(`\u{1F50D} Testing ${componentName} Component - ${mode}`);
|
|
65
|
+
this.log(`${"\u2550".repeat(60)}
|
|
66
|
+
`);
|
|
67
|
+
}
|
|
68
|
+
reportStatic(passes, failures) {
|
|
69
|
+
this.staticPasses = passes;
|
|
70
|
+
this.staticFailures = failures;
|
|
71
|
+
const icon = failures === 0 ? "\u2705" : "\u274C";
|
|
72
|
+
const status = failures === 0 ? "PASS" : "FAIL";
|
|
73
|
+
this.log(`${icon} Static ARIA Tests: ${status}`);
|
|
74
|
+
this.log(` ${passes}/${passes + failures} required attributes present
|
|
75
|
+
`);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Report individual dynamic test result
|
|
79
|
+
*/
|
|
80
|
+
reportTest(test, status, failureMessage) {
|
|
81
|
+
const result = {
|
|
82
|
+
description: test.description,
|
|
83
|
+
status,
|
|
84
|
+
failureMessage
|
|
85
|
+
};
|
|
86
|
+
if (status === "skip" && test.requiresBrowser) {
|
|
87
|
+
result.skipReason = "Requires real browser (addEventListener events)";
|
|
88
|
+
}
|
|
89
|
+
this.dynamicResults.push(result);
|
|
90
|
+
const icons = { pass: "\u2713", fail: "\u2717", skip: "\u25CB" };
|
|
91
|
+
this.log(` ${icons[status]} ${test.description}`);
|
|
92
|
+
if (status === "skip" && !this.isPlaywright) {
|
|
93
|
+
this.log(` \u21B3 Skipped in jsdom (runs in Playwright)`);
|
|
94
|
+
}
|
|
95
|
+
if (status === "fail" && failureMessage) {
|
|
96
|
+
this.log(` \u21B3 ${failureMessage}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Report all failures with actionable context
|
|
101
|
+
*/
|
|
102
|
+
reportFailures(failures) {
|
|
103
|
+
if (failures.length === 0) return;
|
|
104
|
+
this.log(`
|
|
105
|
+
${"\u2500".repeat(60)}`);
|
|
106
|
+
this.log(`\u274C Failures (${failures.length}):
|
|
107
|
+
`);
|
|
108
|
+
failures.forEach((failure, index) => {
|
|
109
|
+
this.log(`${index + 1}. ${failure}`);
|
|
110
|
+
if (failure.includes("aria-")) {
|
|
111
|
+
this.log(` \u{1F4A1} Add the missing ARIA attribute to improve screen reader support`);
|
|
112
|
+
} else if (failure.includes("focus")) {
|
|
113
|
+
this.log(` \u{1F4A1} Check keyboard event handlers and focus management`);
|
|
114
|
+
} else if (failure.includes("visible")) {
|
|
115
|
+
this.log(` \u{1F4A1} Verify display/visibility styles and state management`);
|
|
116
|
+
}
|
|
117
|
+
this.log("");
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Report skipped tests with helpful context
|
|
122
|
+
*/
|
|
123
|
+
reportSkipped() {
|
|
124
|
+
if (this.skipped === 0 || this.isPlaywright) return;
|
|
125
|
+
const skippedTests = this.dynamicResults.filter((r) => r.status === "skip");
|
|
126
|
+
this.log(`
|
|
127
|
+
${"\u2500".repeat(60)}`);
|
|
128
|
+
this.log(`\u2139\uFE0F Skipped Tests (${this.skipped}):
|
|
129
|
+
`);
|
|
130
|
+
this.log(`These tests use native keyboard events via addEventListener,`);
|
|
131
|
+
this.log(`which jsdom cannot simulate. They run successfully in Playwright.
|
|
132
|
+
`);
|
|
133
|
+
skippedTests.forEach((test, index) => {
|
|
134
|
+
this.log(`${index + 1}. ${test.description}`);
|
|
135
|
+
});
|
|
136
|
+
this.log(`
|
|
137
|
+
\u{1F4A1} Run with Playwright for full validation:`);
|
|
138
|
+
this.log(` testUiComponent('${this.componentName}', component, 'http://localhost:5173/')
|
|
139
|
+
`);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Generate final summary with statistics
|
|
143
|
+
*/
|
|
144
|
+
summary(failures) {
|
|
145
|
+
const duration = Date.now() - this.startTime;
|
|
146
|
+
const dynamicPasses = this.dynamicResults.filter((r) => r.status === "pass").length;
|
|
147
|
+
const dynamicFailures = this.dynamicResults.filter((r) => r.status === "fail").length;
|
|
148
|
+
this.skipped = this.dynamicResults.filter((r) => r.status === "skip").length;
|
|
149
|
+
const totalPasses = this.staticPasses + dynamicPasses;
|
|
150
|
+
const totalFailures = this.staticFailures + dynamicFailures;
|
|
151
|
+
const totalRun = totalPasses + totalFailures;
|
|
152
|
+
if (failures.length > 0) {
|
|
153
|
+
this.reportFailures(failures);
|
|
154
|
+
}
|
|
155
|
+
this.reportSkipped();
|
|
156
|
+
this.log(`
|
|
157
|
+
${"\u2550".repeat(60)}`);
|
|
158
|
+
this.log(`\u{1F4CA} Summary
|
|
159
|
+
`);
|
|
160
|
+
if (totalFailures === 0 && this.skipped === 0) {
|
|
161
|
+
this.log(`\u2705 All ${totalRun} tests passed!`);
|
|
162
|
+
this.log(` ${this.componentName} component meets APG and WCAG guidelines \u2713`);
|
|
163
|
+
} else if (totalFailures === 0) {
|
|
164
|
+
this.log(`\u2705 ${totalPasses}/${totalRun} tests passed`);
|
|
165
|
+
this.log(`\u25CB ${this.skipped} tests skipped (jsdom limitation)`);
|
|
166
|
+
this.log(` ${this.componentName} component works correctly`);
|
|
167
|
+
} else {
|
|
168
|
+
this.log(`\u274C ${totalFailures} test${totalFailures > 1 ? "s" : ""} failed`);
|
|
169
|
+
this.log(`\u2705 ${totalPasses} test${totalPasses > 1 ? "s" : ""} passed`);
|
|
170
|
+
if (this.skipped > 0) {
|
|
171
|
+
this.log(`\u25CB ${this.skipped} test${this.skipped > 1 ? "s" : ""} skipped`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
this.log(`\u23F1\uFE0F Duration: ${duration}ms`);
|
|
175
|
+
this.log(`${"\u2550".repeat(60)}
|
|
176
|
+
`);
|
|
177
|
+
if (totalFailures > 0) {
|
|
178
|
+
this.log(`\u{1F527} Next Steps:`);
|
|
179
|
+
this.log(` 1. Review the failures above`);
|
|
180
|
+
this.log(` 2. Fix ARIA attributes and keyboard handlers`);
|
|
181
|
+
this.log(` 3. Re-run tests to verify fixes
|
|
182
|
+
`);
|
|
183
|
+
} else if (!this.isPlaywright && this.skipped > 0) {
|
|
184
|
+
this.log(`\u2728 Optional: Run Playwright tests for complete validation
|
|
185
|
+
`);
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
passes: totalPasses,
|
|
189
|
+
failures: totalFailures,
|
|
190
|
+
skipped: this.skipped,
|
|
191
|
+
duration
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Report an error during test execution
|
|
196
|
+
*/
|
|
197
|
+
error(message, context) {
|
|
198
|
+
this.log(`
|
|
199
|
+
\u274C Error: ${message}`);
|
|
200
|
+
if (context) {
|
|
201
|
+
this.log(` Context: ${context}`);
|
|
202
|
+
}
|
|
203
|
+
this.log("");
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export {
|
|
208
|
+
__require,
|
|
209
|
+
__commonJS,
|
|
210
|
+
__toESM,
|
|
211
|
+
contract_default,
|
|
212
|
+
ContractReporter
|
|
213
|
+
};
|
package/dist/{contractTestRunnerPlaywright-FM6MK6DY.js → contractTestRunnerPlaywright-SE6TPWZZ.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ContractReporter,
|
|
3
3
|
contract_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PCORWVIQ.js";
|
|
5
5
|
|
|
6
6
|
// src/utils/test/contract/contractTestRunnerPlaywright.ts
|
|
7
7
|
import { chromium } from "playwright";
|
|
@@ -252,4 +252,3 @@ async function runContractTestsPlaywright(componentName, url) {
|
|
|
252
252
|
export {
|
|
253
253
|
runContractTestsPlaywright
|
|
254
254
|
};
|
|
255
|
-
//# sourceMappingURL=contractTestRunnerPlaywright-FM6MK6DY.js.map
|
|
@@ -1,182 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ContractReporter,
|
|
3
|
+
contract_default
|
|
4
|
+
} from "./chunk-SSBW5VAA.js";
|
|
5
|
+
|
|
1
6
|
// src/utils/test/contract/contractTestRunnerPlaywright.ts
|
|
2
7
|
import { chromium } from "playwright";
|
|
3
8
|
import { readFileSync } from "fs";
|
|
4
|
-
|
|
5
|
-
// src/utils/test/contract/contract.json
|
|
6
|
-
var contract_default = {
|
|
7
|
-
menu: {
|
|
8
|
-
path: "./contracts/MenuContract.json",
|
|
9
|
-
component: "menu"
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// src/utils/test/contract/ContractReporter.ts
|
|
14
|
-
var ContractReporter = class {
|
|
15
|
-
startTime = 0;
|
|
16
|
-
componentName = "";
|
|
17
|
-
staticPasses = 0;
|
|
18
|
-
staticFailures = 0;
|
|
19
|
-
dynamicResults = [];
|
|
20
|
-
totalTests = 0;
|
|
21
|
-
skipped = 0;
|
|
22
|
-
isPlaywright = false;
|
|
23
|
-
constructor(isPlaywright = false) {
|
|
24
|
-
this.isPlaywright = isPlaywright;
|
|
25
|
-
}
|
|
26
|
-
log(message) {
|
|
27
|
-
process.stderr.write(message + "\n");
|
|
28
|
-
}
|
|
29
|
-
start(componentName, totalTests) {
|
|
30
|
-
this.startTime = Date.now();
|
|
31
|
-
this.componentName = componentName;
|
|
32
|
-
this.totalTests = totalTests;
|
|
33
|
-
const mode = this.isPlaywright ? "Playwright (Real Browser)" : "jsdom (Fast)";
|
|
34
|
-
this.log(`
|
|
35
|
-
${"\u2550".repeat(60)}`);
|
|
36
|
-
this.log(`\u{1F50D} Testing ${componentName} Component - ${mode}`);
|
|
37
|
-
this.log(`${"\u2550".repeat(60)}
|
|
38
|
-
`);
|
|
39
|
-
}
|
|
40
|
-
reportStatic(passes, failures) {
|
|
41
|
-
this.staticPasses = passes;
|
|
42
|
-
this.staticFailures = failures;
|
|
43
|
-
const icon = failures === 0 ? "\u2705" : "\u274C";
|
|
44
|
-
const status = failures === 0 ? "PASS" : "FAIL";
|
|
45
|
-
this.log(`${icon} Static ARIA Tests: ${status}`);
|
|
46
|
-
this.log(` ${passes}/${passes + failures} required attributes present
|
|
47
|
-
`);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Report individual dynamic test result
|
|
51
|
-
*/
|
|
52
|
-
reportTest(test, status, failureMessage) {
|
|
53
|
-
const result = {
|
|
54
|
-
description: test.description,
|
|
55
|
-
status,
|
|
56
|
-
failureMessage
|
|
57
|
-
};
|
|
58
|
-
if (status === "skip" && test.requiresBrowser) {
|
|
59
|
-
result.skipReason = "Requires real browser (addEventListener events)";
|
|
60
|
-
}
|
|
61
|
-
this.dynamicResults.push(result);
|
|
62
|
-
const icons = { pass: "\u2713", fail: "\u2717", skip: "\u25CB" };
|
|
63
|
-
this.log(` ${icons[status]} ${test.description}`);
|
|
64
|
-
if (status === "skip" && !this.isPlaywright) {
|
|
65
|
-
this.log(` \u21B3 Skipped in jsdom (runs in Playwright)`);
|
|
66
|
-
}
|
|
67
|
-
if (status === "fail" && failureMessage) {
|
|
68
|
-
this.log(` \u21B3 ${failureMessage}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Report all failures with actionable context
|
|
73
|
-
*/
|
|
74
|
-
reportFailures(failures) {
|
|
75
|
-
if (failures.length === 0) return;
|
|
76
|
-
this.log(`
|
|
77
|
-
${"\u2500".repeat(60)}`);
|
|
78
|
-
this.log(`\u274C Failures (${failures.length}):
|
|
79
|
-
`);
|
|
80
|
-
failures.forEach((failure, index) => {
|
|
81
|
-
this.log(`${index + 1}. ${failure}`);
|
|
82
|
-
if (failure.includes("aria-")) {
|
|
83
|
-
this.log(` \u{1F4A1} Add the missing ARIA attribute to improve screen reader support`);
|
|
84
|
-
} else if (failure.includes("focus")) {
|
|
85
|
-
this.log(` \u{1F4A1} Check keyboard event handlers and focus management`);
|
|
86
|
-
} else if (failure.includes("visible")) {
|
|
87
|
-
this.log(` \u{1F4A1} Verify display/visibility styles and state management`);
|
|
88
|
-
}
|
|
89
|
-
this.log("");
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Report skipped tests with helpful context
|
|
94
|
-
*/
|
|
95
|
-
reportSkipped() {
|
|
96
|
-
if (this.skipped === 0 || this.isPlaywright) return;
|
|
97
|
-
const skippedTests = this.dynamicResults.filter((r) => r.status === "skip");
|
|
98
|
-
this.log(`
|
|
99
|
-
${"\u2500".repeat(60)}`);
|
|
100
|
-
this.log(`\u2139\uFE0F Skipped Tests (${this.skipped}):
|
|
101
|
-
`);
|
|
102
|
-
this.log(`These tests use native keyboard events via addEventListener,`);
|
|
103
|
-
this.log(`which jsdom cannot simulate. They run successfully in Playwright.
|
|
104
|
-
`);
|
|
105
|
-
skippedTests.forEach((test, index) => {
|
|
106
|
-
this.log(`${index + 1}. ${test.description}`);
|
|
107
|
-
});
|
|
108
|
-
this.log(`
|
|
109
|
-
\u{1F4A1} Run with Playwright for full validation:`);
|
|
110
|
-
this.log(` testUiComponent('${this.componentName}', component, 'http://localhost:5173/')
|
|
111
|
-
`);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Generate final summary with statistics
|
|
115
|
-
*/
|
|
116
|
-
summary(failures) {
|
|
117
|
-
const duration = Date.now() - this.startTime;
|
|
118
|
-
const dynamicPasses = this.dynamicResults.filter((r) => r.status === "pass").length;
|
|
119
|
-
const dynamicFailures = this.dynamicResults.filter((r) => r.status === "fail").length;
|
|
120
|
-
this.skipped = this.dynamicResults.filter((r) => r.status === "skip").length;
|
|
121
|
-
const totalPasses = this.staticPasses + dynamicPasses;
|
|
122
|
-
const totalFailures = this.staticFailures + dynamicFailures;
|
|
123
|
-
const totalRun = totalPasses + totalFailures;
|
|
124
|
-
if (failures.length > 0) {
|
|
125
|
-
this.reportFailures(failures);
|
|
126
|
-
}
|
|
127
|
-
this.reportSkipped();
|
|
128
|
-
this.log(`
|
|
129
|
-
${"\u2550".repeat(60)}`);
|
|
130
|
-
this.log(`\u{1F4CA} Summary
|
|
131
|
-
`);
|
|
132
|
-
if (totalFailures === 0 && this.skipped === 0) {
|
|
133
|
-
this.log(`\u2705 All ${totalRun} tests passed!`);
|
|
134
|
-
this.log(` ${this.componentName} component meets APG and WCAG guidelines \u2713`);
|
|
135
|
-
} else if (totalFailures === 0) {
|
|
136
|
-
this.log(`\u2705 ${totalPasses}/${totalRun} tests passed`);
|
|
137
|
-
this.log(`\u25CB ${this.skipped} tests skipped (jsdom limitation)`);
|
|
138
|
-
this.log(` ${this.componentName} component works correctly`);
|
|
139
|
-
} else {
|
|
140
|
-
this.log(`\u274C ${totalFailures} test${totalFailures > 1 ? "s" : ""} failed`);
|
|
141
|
-
this.log(`\u2705 ${totalPasses} test${totalPasses > 1 ? "s" : ""} passed`);
|
|
142
|
-
if (this.skipped > 0) {
|
|
143
|
-
this.log(`\u25CB ${this.skipped} test${this.skipped > 1 ? "s" : ""} skipped`);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
this.log(`\u23F1\uFE0F Duration: ${duration}ms`);
|
|
147
|
-
this.log(`${"\u2550".repeat(60)}
|
|
148
|
-
`);
|
|
149
|
-
if (totalFailures > 0) {
|
|
150
|
-
this.log(`\u{1F527} Next Steps:`);
|
|
151
|
-
this.log(` 1. Review the failures above`);
|
|
152
|
-
this.log(` 2. Fix ARIA attributes and keyboard handlers`);
|
|
153
|
-
this.log(` 3. Re-run tests to verify fixes
|
|
154
|
-
`);
|
|
155
|
-
} else if (!this.isPlaywright && this.skipped > 0) {
|
|
156
|
-
this.log(`\u2728 Optional: Run Playwright tests for complete validation
|
|
157
|
-
`);
|
|
158
|
-
}
|
|
159
|
-
return {
|
|
160
|
-
passes: totalPasses,
|
|
161
|
-
failures: totalFailures,
|
|
162
|
-
skipped: this.skipped,
|
|
163
|
-
duration
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Report an error during test execution
|
|
168
|
-
*/
|
|
169
|
-
error(message, context) {
|
|
170
|
-
this.log(`
|
|
171
|
-
\u274C Error: ${message}`);
|
|
172
|
-
if (context) {
|
|
173
|
-
this.log(` Context: ${context}`);
|
|
174
|
-
}
|
|
175
|
-
this.log("");
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
// src/utils/test/contract/contractTestRunnerPlaywright.ts
|
|
180
9
|
async function runContractTestsPlaywright(componentName, url) {
|
|
181
10
|
const reporter = new ContractReporter(true);
|
|
182
11
|
const contractTyped = contract_default;
|
|
@@ -197,7 +26,7 @@ async function runContractTestsPlaywright(componentName, url) {
|
|
|
197
26
|
const context = await browser.newContext();
|
|
198
27
|
const page = await context.newPage();
|
|
199
28
|
await page.goto(url, { waitUntil: "networkidle" });
|
|
200
|
-
await page.waitForSelector(componentContract.selectors.trigger, { timeout:
|
|
29
|
+
await page.waitForSelector(componentContract.selectors.trigger, { timeout: 3e4 });
|
|
201
30
|
async function resolveRelativeTarget(selector, relative) {
|
|
202
31
|
const items = await page.locator(selector).all();
|
|
203
32
|
switch (relative) {
|
|
@@ -423,4 +252,3 @@ async function runContractTestsPlaywright(componentName, url) {
|
|
|
423
252
|
export {
|
|
424
253
|
runContractTestsPlaywright
|
|
425
254
|
};
|
|
426
|
-
//# sourceMappingURL=contractTestRunnerPlaywright-2LQHVMXT.js.map
|