aria-ease 5.0.1 → 5.0.3
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/README.md +2 -2
- package/bin/{audit-6A7OW5NJ.js → audit-5JJ3XK46.js} +1 -1
- package/bin/{chunk-2P3A4VVY.js → chunk-I2KLQ2HA.js} +1 -16
- package/bin/{chunk-5Z7PR3VC.js → chunk-TUWQNVQJ.js} +68 -9
- package/bin/cli.cjs +283 -13023
- package/bin/cli.js +4 -4
- package/bin/{contractTestRunnerPlaywright-YPBTKJP7.js → contractTestRunnerPlaywright-O22AQ4RK.js} +27 -75
- package/bin/{formatters-FCDHFTPI.js → formatters-32KQIIYS.js} +1 -1
- package/bin/test-JNQFZBJA.js +195 -0
- package/dist/{chunk-IPJYOFRK.js → chunk-KJ33RDSC.js} +68 -24
- package/dist/{contractTestRunnerPlaywright-45CFWUOD.js → contractTestRunnerPlaywright-7ZOM7ZMG.js} +26 -74
- package/dist/index.cjs +1669 -14340
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1063 -13744
- package/dist/src/accordion/index.cjs +2 -2
- package/dist/src/accordion/index.d.cts +3 -3
- package/dist/src/accordion/index.d.ts +3 -3
- package/dist/src/accordion/index.js +2 -2
- package/dist/src/utils/test/{chunk-IPJYOFRK.js → chunk-TUWQNVQJ.js} +69 -41
- package/dist/src/utils/test/{contractTestRunnerPlaywright-45CFWUOD.js → contractTestRunnerPlaywright-P5QZAIDR.js} +31 -86
- package/dist/src/utils/test/contracts/AccordionContract.json +232 -6
- package/dist/src/utils/test/contracts/ComboboxContract.json +2 -0
- package/dist/src/utils/test/index.cjs +635 -13173
- package/dist/src/utils/test/index.js +40 -12533
- package/package.json +2 -2
- package/bin/test-TAH4VGZV.js +0 -12877
package/dist/{contractTestRunnerPlaywright-45CFWUOD.js → contractTestRunnerPlaywright-7ZOM7ZMG.js}
RENAMED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__export,
|
|
4
4
|
__reExport,
|
|
5
5
|
contract_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KJ33RDSC.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/test/contract/contractTestRunnerPlaywright.ts
|
|
9
9
|
import { chromium } from "playwright";
|
|
@@ -30,7 +30,8 @@ async function runContractTestsPlaywright(componentName, url) {
|
|
|
30
30
|
const contractData = readFileSync(resolvedPath, "utf-8");
|
|
31
31
|
const componentContract = JSON.parse(contractData);
|
|
32
32
|
const totalTests = componentContract.static[0].assertions.length + componentContract.dynamic.length;
|
|
33
|
-
|
|
33
|
+
const apgUrl = componentContract.meta?.source?.apg;
|
|
34
|
+
reporter.start(componentName, totalTests, apgUrl);
|
|
34
35
|
const failures = [];
|
|
35
36
|
const passes = [];
|
|
36
37
|
const skipped = [];
|
|
@@ -41,25 +42,21 @@ async function runContractTestsPlaywright(componentName, url) {
|
|
|
41
42
|
const page = await context.newPage();
|
|
42
43
|
await page.goto(url, {
|
|
43
44
|
waitUntil: "domcontentloaded",
|
|
44
|
-
timeout:
|
|
45
|
+
timeout: 9e5
|
|
45
46
|
});
|
|
47
|
+
await page.addStyleTag({ content: `* { transition: none !important; animation: none !important; }` });
|
|
46
48
|
const mainSelector = componentContract.selectors.trigger || componentContract.selectors.input || componentContract.selectors.container;
|
|
47
49
|
if (!mainSelector) {
|
|
48
50
|
throw new Error(`No main selector (trigger, input, or container) found in contract for ${componentName}`);
|
|
49
51
|
}
|
|
50
|
-
await page.
|
|
52
|
+
await page.locator(mainSelector).first().waitFor({ state: "attached", timeout: 9e5 });
|
|
51
53
|
if (componentName === "menu" && componentContract.selectors.trigger) {
|
|
52
|
-
await page.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
componentContract.selectors.trigger,
|
|
58
|
-
{ timeout: 1e4 }
|
|
59
|
-
).catch(() => {
|
|
60
|
-
console.warn("Menu initialization signal not detected, continuing with tests...");
|
|
54
|
+
await page.locator(componentContract.selectors.trigger).first().waitFor({
|
|
55
|
+
state: "visible",
|
|
56
|
+
timeout: 1e4
|
|
57
|
+
}).catch(() => {
|
|
58
|
+
console.warn("Menu trigger not visible, continuing with tests...");
|
|
61
59
|
});
|
|
62
|
-
await page.waitForTimeout(300);
|
|
63
60
|
}
|
|
64
61
|
async function resolveRelativeTarget(selector, relative) {
|
|
65
62
|
const items = await page.locator(selector).all();
|
|
@@ -135,7 +132,7 @@ async function runContractTestsPlaywright(componentName, url) {
|
|
|
135
132
|
const popupSelector = componentContract.selectors.listbox || componentContract.selectors.container;
|
|
136
133
|
if (!popupSelector) continue;
|
|
137
134
|
const popupElement = page.locator(popupSelector).first();
|
|
138
|
-
const isPopupVisible = await popupElement.isVisible();
|
|
135
|
+
const isPopupVisible = await popupElement.isVisible().catch(() => false);
|
|
139
136
|
if (isPopupVisible) {
|
|
140
137
|
let menuClosed = false;
|
|
141
138
|
let closeSelector = componentContract.selectors.input;
|
|
@@ -147,44 +144,17 @@ async function runContractTestsPlaywright(componentName, url) {
|
|
|
147
144
|
if (closeSelector) {
|
|
148
145
|
const closeElement = page.locator(closeSelector).first();
|
|
149
146
|
await closeElement.focus();
|
|
150
|
-
await page.waitForTimeout(200);
|
|
151
147
|
await page.keyboard.press("Escape");
|
|
152
|
-
menuClosed = await
|
|
153
|
-
(selector) => {
|
|
154
|
-
const popup = document.querySelector(selector);
|
|
155
|
-
return popup && getComputedStyle(popup).display === "none";
|
|
156
|
-
},
|
|
157
|
-
popupSelector,
|
|
158
|
-
{ timeout: 3e3 }
|
|
159
|
-
).then(() => true).catch(() => false);
|
|
148
|
+
menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
|
|
160
149
|
}
|
|
161
150
|
if (!menuClosed && componentContract.selectors.trigger) {
|
|
162
151
|
const triggerElement = page.locator(componentContract.selectors.trigger).first();
|
|
163
152
|
await triggerElement.click();
|
|
164
|
-
await
|
|
165
|
-
menuClosed = await page.waitForFunction(
|
|
166
|
-
(selector) => {
|
|
167
|
-
const popup = document.querySelector(selector);
|
|
168
|
-
return popup && getComputedStyle(popup).display === "none";
|
|
169
|
-
},
|
|
170
|
-
popupSelector,
|
|
171
|
-
{ timeout: 3e3 }
|
|
172
|
-
).then(() => true).catch(() => false);
|
|
153
|
+
menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
|
|
173
154
|
}
|
|
174
155
|
if (!menuClosed) {
|
|
175
156
|
await page.mouse.click(10, 10);
|
|
176
|
-
await
|
|
177
|
-
menuClosed = await page.waitForFunction(
|
|
178
|
-
(selector) => {
|
|
179
|
-
const popup = document.querySelector(selector);
|
|
180
|
-
return popup && getComputedStyle(popup).display === "none";
|
|
181
|
-
},
|
|
182
|
-
popupSelector,
|
|
183
|
-
{ timeout: 3e3 }
|
|
184
|
-
).then(() => true).catch(() => false);
|
|
185
|
-
if (menuClosed) {
|
|
186
|
-
console.log("\u{1F3AF} Strategy 3 (Click outside) worked");
|
|
187
|
-
}
|
|
157
|
+
menuClosed = await (0, test_exports.expect)(popupElement).toBeHidden({ timeout: 3e3 }).then(() => true).catch(() => false);
|
|
188
158
|
}
|
|
189
159
|
if (!menuClosed) {
|
|
190
160
|
throw new Error(
|
|
@@ -195,25 +165,12 @@ async function runContractTestsPlaywright(componentName, url) {
|
|
|
195
165
|
This indicates a problem with the menu component's close functionality.`
|
|
196
166
|
);
|
|
197
167
|
}
|
|
198
|
-
if (componentName === "menu" && componentContract.selectors.trigger) {
|
|
199
|
-
await page.waitForFunction(
|
|
200
|
-
(selector) => {
|
|
201
|
-
const trigger = document.querySelector(selector);
|
|
202
|
-
return document.activeElement === trigger;
|
|
203
|
-
},
|
|
204
|
-
componentContract.selectors.trigger,
|
|
205
|
-
{ timeout: 2e3 }
|
|
206
|
-
).catch(async () => {
|
|
207
|
-
const triggerElement = page.locator(componentContract.selectors.trigger).first();
|
|
208
|
-
await triggerElement.focus();
|
|
209
|
-
await page.waitForTimeout(200);
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
await page.waitForTimeout(500);
|
|
213
168
|
if (componentContract.selectors.input) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
169
|
+
await page.locator(componentContract.selectors.input).first().clear();
|
|
170
|
+
}
|
|
171
|
+
if (componentName === "menu" && componentContract.selectors.trigger) {
|
|
172
|
+
const triggerElement = page.locator(componentContract.selectors.trigger).first();
|
|
173
|
+
await triggerElement.focus();
|
|
217
174
|
}
|
|
218
175
|
}
|
|
219
176
|
}
|
|
@@ -257,7 +214,6 @@ This indicates a problem with the menu component's close functionality.`
|
|
|
257
214
|
continue;
|
|
258
215
|
}
|
|
259
216
|
await page.locator(focusSelector).first().focus();
|
|
260
|
-
await page.waitForTimeout(100);
|
|
261
217
|
}
|
|
262
218
|
if (act.type === "type" && act.value) {
|
|
263
219
|
const typeSelector = componentContract.selectors[act.target];
|
|
@@ -266,7 +222,6 @@ This indicates a problem with the menu component's close functionality.`
|
|
|
266
222
|
continue;
|
|
267
223
|
}
|
|
268
224
|
await page.locator(typeSelector).first().fill(act.value);
|
|
269
|
-
await page.waitForTimeout(100);
|
|
270
225
|
}
|
|
271
226
|
if (act.type === "click") {
|
|
272
227
|
if (act.target === "document") {
|
|
@@ -283,7 +238,6 @@ This indicates a problem with the menu component's close functionality.`
|
|
|
283
238
|
continue;
|
|
284
239
|
}
|
|
285
240
|
await relativeElement.click();
|
|
286
|
-
await page.waitForTimeout(componentName === "menu" ? 800 : 200);
|
|
287
241
|
} else {
|
|
288
242
|
const actionSelector = componentContract.selectors[act.target];
|
|
289
243
|
if (!actionSelector) {
|
|
@@ -291,7 +245,6 @@ This indicates a problem with the menu component's close functionality.`
|
|
|
291
245
|
continue;
|
|
292
246
|
}
|
|
293
247
|
await page.locator(actionSelector).first().click();
|
|
294
|
-
await page.waitForTimeout(componentName === "menu" ? 800 : 200);
|
|
295
248
|
}
|
|
296
249
|
}
|
|
297
250
|
if (act.type === "keypress" && act.key) {
|
|
@@ -314,9 +267,7 @@ This indicates a problem with the menu component's close functionality.`
|
|
|
314
267
|
keyValue = keyValue.replace(/ /g, "");
|
|
315
268
|
}
|
|
316
269
|
if (act.target === "focusable" && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Escape"].includes(keyValue)) {
|
|
317
|
-
await page.waitForTimeout(componentName === "menu" ? 200 : 100);
|
|
318
270
|
await page.keyboard.press(keyValue);
|
|
319
|
-
await page.waitForTimeout(componentName === "menu" ? 300 : 100);
|
|
320
271
|
} else {
|
|
321
272
|
const keypressSelector = componentContract.selectors[act.target];
|
|
322
273
|
if (!keypressSelector) {
|
|
@@ -345,7 +296,6 @@ This indicates a problem with the menu component's close functionality.`
|
|
|
345
296
|
continue;
|
|
346
297
|
}
|
|
347
298
|
await relativeElement.hover();
|
|
348
|
-
await page.waitForTimeout(100);
|
|
349
299
|
} else {
|
|
350
300
|
const hoverSelector = componentContract.selectors[act.target];
|
|
351
301
|
if (!hoverSelector) {
|
|
@@ -353,12 +303,9 @@ This indicates a problem with the menu component's close functionality.`
|
|
|
353
303
|
continue;
|
|
354
304
|
}
|
|
355
305
|
await page.locator(hoverSelector).first().hover();
|
|
356
|
-
await page.waitForTimeout(100);
|
|
357
306
|
}
|
|
358
307
|
}
|
|
359
|
-
await page.waitForTimeout(componentName === "menu" ? 200 : 100);
|
|
360
308
|
}
|
|
361
|
-
await page.waitForTimeout(componentName === "menu" ? 300 : 100);
|
|
362
309
|
for (const assertion of assertions) {
|
|
363
310
|
let target;
|
|
364
311
|
if (assertion.target === "relative") {
|
|
@@ -475,7 +422,12 @@ This indicates a problem with the menu component's close functionality.`
|
|
|
475
422
|
const failuresAfterTest = failures.length;
|
|
476
423
|
const testPassed = failuresAfterTest === failuresBeforeTest;
|
|
477
424
|
const failureMessage = testPassed ? void 0 : failures[failures.length - 1];
|
|
478
|
-
|
|
425
|
+
if (dynamicTest.isOptional === true && !testPassed) {
|
|
426
|
+
failures.pop();
|
|
427
|
+
reporter.reportTest(dynamicTest, "optional-fail", failureMessage);
|
|
428
|
+
} else {
|
|
429
|
+
reporter.reportTest(dynamicTest, testPassed ? "pass" : "fail", failureMessage);
|
|
430
|
+
}
|
|
479
431
|
}
|
|
480
432
|
const staticPassed = componentContract.static[0].assertions.length;
|
|
481
433
|
const staticFailed = 0;
|