aria-ease 6.11.0 → 6.12.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.
- package/README.md +1 -1
- package/dist/{chunk-XERMSYEH.js → chunk-FZ7GMIJB.js} +0 -21
- package/dist/{chunk-NI3MQCAS.js → chunk-GJGUY643.js} +2 -2
- package/dist/cli.cjs +26 -63
- package/dist/cli.js +3 -3
- package/dist/{configLoader-DWHOHXHL.js → configLoader-Q7N5XV4P.js} +2 -2
- package/dist/{configLoader-UJZHQBYS.js → configLoader-REHK3S3Q.js} +1 -1
- package/dist/{contractTestRunnerPlaywright-QDXSK3FE.js → contractTestRunnerPlaywright-DIXP5DQ3.js} +5 -20
- package/dist/{contractTestRunnerPlaywright-WNWQYSXZ.js → contractTestRunnerPlaywright-EWAWQVHT.js} +5 -20
- package/dist/index.cjs +32 -66
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +23 -15
- package/dist/src/utils/test/{chunk-XERMSYEH.js → chunk-FZ7GMIJB.js} +1 -21
- package/dist/src/utils/test/{configLoader-SHJSRG2A.js → configLoader-NA7IBCS3.js} +2 -2
- package/dist/src/utils/test/{contractTestRunnerPlaywright-Z2AHXSNM.js → contractTestRunnerPlaywright-CIZOXYRW.js} +5 -19
- package/dist/src/utils/test/dsl/index.cjs +7 -4
- package/dist/src/utils/test/dsl/index.d.cts +3 -0
- package/dist/src/utils/test/dsl/index.d.ts +3 -0
- package/dist/src/utils/test/dsl/index.js +7 -4
- package/dist/src/utils/test/index.cjs +19 -55
- package/dist/src/utils/test/index.js +16 -10
- package/dist/{test-O3J4ZPQR.js → test-HBPCSYH5.js} +16 -11
- package/package.json +2 -3
- package/dist/src/utils/test/aria-contracts/accordion/accordion.contract.json +0 -290
- package/dist/src/utils/test/aria-contracts/combobox/combobox.listbox.contract.json +0 -463
- package/dist/src/utils/test/aria-contracts/menu/menu.contract.json +0 -562
- package/dist/src/utils/test/aria-contracts/tabs/tabs.contract.json +0 -361
package/dist/index.cjs
CHANGED
|
@@ -31,31 +31,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
));
|
|
32
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
33
|
|
|
34
|
-
// src/utils/test/contract/contract.json
|
|
35
|
-
var contract_default;
|
|
36
|
-
var init_contract = __esm({
|
|
37
|
-
"src/utils/test/contract/contract.json"() {
|
|
38
|
-
contract_default = {
|
|
39
|
-
menu: {
|
|
40
|
-
path: "./aria-contracts/menu/menu.contract.json",
|
|
41
|
-
component: "menu"
|
|
42
|
-
},
|
|
43
|
-
"combobox.listbox": {
|
|
44
|
-
path: "./aria-contracts/combobox/combobox.listbox.contract.json",
|
|
45
|
-
component: "combobox.listbox"
|
|
46
|
-
},
|
|
47
|
-
accordion: {
|
|
48
|
-
path: "./aria-contracts/accordion/accordion.contract.json",
|
|
49
|
-
component: "accordion"
|
|
50
|
-
},
|
|
51
|
-
tabs: {
|
|
52
|
-
path: "./aria-contracts/tabs/tabs.contract.json",
|
|
53
|
-
component: "tabs"
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
34
|
// src/utils/test/src/ContractReporter.ts
|
|
60
35
|
var ContractReporter;
|
|
61
36
|
var init_ContractReporter = __esm({
|
|
@@ -480,8 +455,8 @@ function validateConfig(config) {
|
|
|
480
455
|
if (typeof comp.name !== "string") {
|
|
481
456
|
errors.push(`test.components[${idx}].name must be a string`);
|
|
482
457
|
}
|
|
483
|
-
if (comp.
|
|
484
|
-
errors.push(`test.components[${idx}].
|
|
458
|
+
if (comp.contractPath !== void 0 && typeof comp.contractPath !== "string") {
|
|
459
|
+
errors.push(`test.components[${idx}].contractPath must be a string when provided`);
|
|
485
460
|
}
|
|
486
461
|
if (comp.strategyPath !== void 0 && typeof comp.strategyPath !== "string") {
|
|
487
462
|
errors.push(`test.components[${idx}].strategyPath must be a string when provided`);
|
|
@@ -885,12 +860,6 @@ var init_StrategyRegistry = __esm({
|
|
|
885
860
|
(m) => m.TabsComponentStrategy
|
|
886
861
|
)
|
|
887
862
|
);
|
|
888
|
-
this.builtInStrategies.set(
|
|
889
|
-
"combobox.listbox",
|
|
890
|
-
() => Promise.resolve().then(() => (init_ComboboxComponentStrategy(), ComboboxComponentStrategy_exports)).then(
|
|
891
|
-
(m) => m.ComboboxComponentStrategy
|
|
892
|
-
)
|
|
893
|
-
);
|
|
894
863
|
}
|
|
895
864
|
/**
|
|
896
865
|
* Load a strategy - either from custom path or built-in registry
|
|
@@ -937,15 +906,14 @@ var init_StrategyRegistry = __esm({
|
|
|
937
906
|
});
|
|
938
907
|
|
|
939
908
|
// src/utils/test/src/ComponentDetector.ts
|
|
940
|
-
var import_fs, import_path3,
|
|
909
|
+
var import_fs, import_path3, import_meta, ComponentDetector;
|
|
941
910
|
var init_ComponentDetector = __esm({
|
|
942
911
|
"src/utils/test/src/ComponentDetector.ts"() {
|
|
943
912
|
"use strict";
|
|
944
913
|
import_fs = require("fs");
|
|
945
914
|
import_path3 = __toESM(require("path"), 1);
|
|
946
|
-
init_contract();
|
|
947
915
|
init_StrategyRegistry();
|
|
948
|
-
|
|
916
|
+
import_meta = {};
|
|
949
917
|
ComponentDetector = class {
|
|
950
918
|
static strategyRegistry = new StrategyRegistry();
|
|
951
919
|
static isComponentConfig(value) {
|
|
@@ -965,11 +933,7 @@ var init_ComponentDetector = __esm({
|
|
|
965
933
|
*/
|
|
966
934
|
static async detect(componentName, componentConfig, actionTimeoutMs = 400, assertionTimeoutMs = 400, configBaseDir) {
|
|
967
935
|
const typedComponentConfig = this.isComponentConfig(componentConfig) ? componentConfig : void 0;
|
|
968
|
-
|
|
969
|
-
if (!contractPath) {
|
|
970
|
-
const contractTyped = contract_default;
|
|
971
|
-
contractPath = contractTyped[componentName]?.path;
|
|
972
|
-
}
|
|
936
|
+
const contractPath = typedComponentConfig?.contractPath;
|
|
973
937
|
if (!contractPath) {
|
|
974
938
|
throw new Error(`Contract path not found for component: ${componentName}`);
|
|
975
939
|
}
|
|
@@ -988,7 +952,7 @@ var init_ComponentDetector = __esm({
|
|
|
988
952
|
(0, import_fs.readFileSync)(cwdResolved, "utf-8");
|
|
989
953
|
return cwdResolved;
|
|
990
954
|
} catch {
|
|
991
|
-
return new URL(contractPath,
|
|
955
|
+
return new URL(contractPath, import_meta.url).pathname;
|
|
992
956
|
}
|
|
993
957
|
})();
|
|
994
958
|
const contractData = (0, import_fs.readFileSync)(resolvedPath, "utf-8");
|
|
@@ -1002,7 +966,7 @@ var init_ComponentDetector = __esm({
|
|
|
1002
966
|
if (!strategyClass) {
|
|
1003
967
|
return null;
|
|
1004
968
|
}
|
|
1005
|
-
const mainSelector = selectors.
|
|
969
|
+
const mainSelector = selectors.main;
|
|
1006
970
|
if (componentName === "tabs") {
|
|
1007
971
|
return new strategyClass(mainSelector, selectors);
|
|
1008
972
|
}
|
|
@@ -1577,7 +1541,7 @@ __export(contractTestRunnerPlaywright_exports, {
|
|
|
1577
1541
|
});
|
|
1578
1542
|
async function runContractTestsPlaywright(componentName, url, strictness, config, configBaseDir) {
|
|
1579
1543
|
const componentConfig = config?.test?.components?.find((c) => c.name === componentName);
|
|
1580
|
-
const isCustomContract = !!componentConfig?.
|
|
1544
|
+
const isCustomContract = !!componentConfig?.contractPath;
|
|
1581
1545
|
const reporter = new ContractReporter(true, isCustomContract);
|
|
1582
1546
|
const defaultTimeouts = {
|
|
1583
1547
|
actionTimeoutMs: 400,
|
|
@@ -1617,11 +1581,7 @@ async function runContractTestsPlaywright(componentName, url, strictness, config
|
|
|
1617
1581
|
defaultTimeouts.componentReadyTimeoutMs
|
|
1618
1582
|
);
|
|
1619
1583
|
const strictnessMode = normalizeStrictness(strictness);
|
|
1620
|
-
|
|
1621
|
-
if (!contractPath) {
|
|
1622
|
-
const contractTyped = contract_default;
|
|
1623
|
-
contractPath = contractTyped[componentName]?.path;
|
|
1624
|
-
}
|
|
1584
|
+
const contractPath = componentConfig?.contractPath;
|
|
1625
1585
|
if (!contractPath) {
|
|
1626
1586
|
throw new Error(`Contract path not found for component: ${componentName}`);
|
|
1627
1587
|
}
|
|
@@ -1640,7 +1600,7 @@ async function runContractTestsPlaywright(componentName, url, strictness, config
|
|
|
1640
1600
|
(0, import_fs2.readFileSync)(cwdResolved, "utf-8");
|
|
1641
1601
|
return cwdResolved;
|
|
1642
1602
|
} catch {
|
|
1643
|
-
return new URL(contractPath,
|
|
1603
|
+
return new URL(contractPath, import_meta2.url).pathname;
|
|
1644
1604
|
}
|
|
1645
1605
|
})();
|
|
1646
1606
|
const contractData = (0, import_fs2.readFileSync)(resolvedPath, "utf-8");
|
|
@@ -2112,20 +2072,19 @@ This usually means:
|
|
|
2112
2072
|
}
|
|
2113
2073
|
return { passes, failures, skipped, warnings };
|
|
2114
2074
|
}
|
|
2115
|
-
var import_fs2, import_path4,
|
|
2075
|
+
var import_fs2, import_path4, import_meta2;
|
|
2116
2076
|
var init_contractTestRunnerPlaywright = __esm({
|
|
2117
2077
|
"src/utils/test/src/contractTestRunnerPlaywright.ts"() {
|
|
2118
2078
|
"use strict";
|
|
2119
2079
|
import_fs2 = require("fs");
|
|
2120
2080
|
import_path4 = __toESM(require("path"), 1);
|
|
2121
|
-
init_contract();
|
|
2122
2081
|
init_playwrightTestHarness();
|
|
2123
2082
|
init_ComponentDetector();
|
|
2124
2083
|
init_ContractReporter();
|
|
2125
2084
|
init_ActionExecutor();
|
|
2126
2085
|
init_AssertionRunner();
|
|
2127
2086
|
init_strictness();
|
|
2128
|
-
|
|
2087
|
+
import_meta2 = {};
|
|
2129
2088
|
}
|
|
2130
2089
|
});
|
|
2131
2090
|
|
|
@@ -3960,7 +3919,7 @@ function isInputFilled() {
|
|
|
3960
3919
|
|
|
3961
3920
|
// src/utils/test/dsl/src/contractBuilder.ts
|
|
3962
3921
|
var STATE_PACKS = {
|
|
3963
|
-
"combobox
|
|
3922
|
+
"combobox": COMBOBOX_STATES
|
|
3964
3923
|
// Add more mappings as needed
|
|
3965
3924
|
};
|
|
3966
3925
|
var FluentContract = class {
|
|
@@ -3994,11 +3953,13 @@ var ContractBuilder = class {
|
|
|
3994
3953
|
const api = {
|
|
3995
3954
|
ariaReference: (from, attribute, to) => ({
|
|
3996
3955
|
required: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "required" }),
|
|
3997
|
-
optional: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "optional" })
|
|
3956
|
+
optional: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "optional" }),
|
|
3957
|
+
recommended: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "recommended" })
|
|
3998
3958
|
}),
|
|
3999
3959
|
contains: (parent, child) => ({
|
|
4000
3960
|
required: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "required" }),
|
|
4001
|
-
optional: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "optional" })
|
|
3961
|
+
optional: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "optional" }),
|
|
3962
|
+
recommended: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "recommended" })
|
|
4002
3963
|
})
|
|
4003
3964
|
};
|
|
4004
3965
|
fn(api);
|
|
@@ -4009,7 +3970,8 @@ var ContractBuilder = class {
|
|
|
4009
3970
|
target: (target) => ({
|
|
4010
3971
|
has: (attribute, expectedValue) => ({
|
|
4011
3972
|
required: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "required" }),
|
|
4012
|
-
optional: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "optional" })
|
|
3973
|
+
optional: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "optional" }),
|
|
3974
|
+
recommended: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "recommended" })
|
|
4013
3975
|
})
|
|
4014
3976
|
})
|
|
4015
3977
|
};
|
|
@@ -4150,21 +4112,16 @@ function createContract(componentName, define) {
|
|
|
4150
4112
|
var import_jest_axe = require("jest-axe");
|
|
4151
4113
|
|
|
4152
4114
|
// src/utils/test/src/contractTestRunner.ts
|
|
4153
|
-
init_contract();
|
|
4154
4115
|
var import_promises = __toESM(require("fs/promises"), 1);
|
|
4155
4116
|
init_ContractReporter();
|
|
4156
4117
|
init_strictness();
|
|
4157
|
-
|
|
4158
|
-
async function runContractTests(componentName, component, strictness) {
|
|
4118
|
+
async function runContractTests(contractPath, componentName, component, strictness) {
|
|
4159
4119
|
const reporter = new ContractReporter(false);
|
|
4160
4120
|
const strictnessMode = normalizeStrictness(strictness);
|
|
4161
|
-
const contractTyped = contract_default;
|
|
4162
|
-
const contractPath = contractTyped[componentName]?.path;
|
|
4163
4121
|
if (!contractPath) {
|
|
4164
|
-
throw new Error(`No contract
|
|
4122
|
+
throw new Error(`No contract path provided for component: ${componentName}`);
|
|
4165
4123
|
}
|
|
4166
|
-
const
|
|
4167
|
-
const contractData = await import_promises.default.readFile(resolvedPath, "utf-8");
|
|
4124
|
+
const contractData = await import_promises.default.readFile(contractPath, "utf-8");
|
|
4168
4125
|
const componentContract = JSON.parse(contractData);
|
|
4169
4126
|
const totalTests = (componentContract.relationships?.length || 0) + (componentContract.static[0]?.assertions.length || 0) + componentContract.dynamic.length;
|
|
4170
4127
|
reporter.start(componentName, totalTests);
|
|
@@ -4398,7 +4355,16 @@ Please start your dev server and try again.`
|
|
|
4398
4355
|
}
|
|
4399
4356
|
} else if (component) {
|
|
4400
4357
|
console.log(`\u{1F3AD} Running component contract tests in JSDOM mode`);
|
|
4401
|
-
|
|
4358
|
+
const contractPath = config.test?.components?.find((comp) => comp?.name === componentName)?.contractPath;
|
|
4359
|
+
if (!contractPath) {
|
|
4360
|
+
throw new Error(`\u274C No contract path found for component: ${componentName}`);
|
|
4361
|
+
}
|
|
4362
|
+
contract = await runContractTests(
|
|
4363
|
+
import_path6.default.resolve(configBaseDir, contractPath),
|
|
4364
|
+
componentName,
|
|
4365
|
+
component,
|
|
4366
|
+
strictness
|
|
4367
|
+
);
|
|
4402
4368
|
} else {
|
|
4403
4369
|
throw new Error("\u274C Either component or URL must be provided");
|
|
4404
4370
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -288,10 +288,12 @@ declare class ContractBuilder {
|
|
|
288
288
|
ariaReference: (from: string, attribute: string, to: string) => {
|
|
289
289
|
required: () => void;
|
|
290
290
|
optional: () => void;
|
|
291
|
+
recommended: () => void;
|
|
291
292
|
};
|
|
292
293
|
contains: (parent: string, child: string) => {
|
|
293
294
|
required: () => void;
|
|
294
295
|
optional: () => void;
|
|
296
|
+
recommended: () => void;
|
|
295
297
|
};
|
|
296
298
|
}) => void): this;
|
|
297
299
|
static(fn: (s: {
|
|
@@ -299,6 +301,7 @@ declare class ContractBuilder {
|
|
|
299
301
|
has: (attribute: string, expectedValue: string) => {
|
|
300
302
|
required: () => void;
|
|
301
303
|
optional: () => void;
|
|
304
|
+
recommended: () => void;
|
|
302
305
|
};
|
|
303
306
|
};
|
|
304
307
|
}) => void): this;
|
package/dist/index.d.ts
CHANGED
|
@@ -288,10 +288,12 @@ declare class ContractBuilder {
|
|
|
288
288
|
ariaReference: (from: string, attribute: string, to: string) => {
|
|
289
289
|
required: () => void;
|
|
290
290
|
optional: () => void;
|
|
291
|
+
recommended: () => void;
|
|
291
292
|
};
|
|
292
293
|
contains: (parent: string, child: string) => {
|
|
293
294
|
required: () => void;
|
|
294
295
|
optional: () => void;
|
|
296
|
+
recommended: () => void;
|
|
295
297
|
};
|
|
296
298
|
}) => void): this;
|
|
297
299
|
static(fn: (s: {
|
|
@@ -299,6 +301,7 @@ declare class ContractBuilder {
|
|
|
299
301
|
has: (attribute: string, expectedValue: string) => {
|
|
300
302
|
required: () => void;
|
|
301
303
|
optional: () => void;
|
|
304
|
+
recommended: () => void;
|
|
302
305
|
};
|
|
303
306
|
};
|
|
304
307
|
}) => void): this;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ContractReporter,
|
|
3
3
|
closeSharedBrowser,
|
|
4
|
-
contract_default,
|
|
5
4
|
normalizeLevel,
|
|
6
5
|
normalizeStrictness,
|
|
7
6
|
resolveEnforcement
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FZ7GMIJB.js";
|
|
9
8
|
import "./chunk-I2KLQ2HA.js";
|
|
10
9
|
|
|
11
10
|
// src/accordion/src/makeAccordionAccessible/makeAccordionAccessible.ts
|
|
@@ -1708,7 +1707,7 @@ function isInputFilled() {
|
|
|
1708
1707
|
|
|
1709
1708
|
// src/utils/test/dsl/src/contractBuilder.ts
|
|
1710
1709
|
var STATE_PACKS = {
|
|
1711
|
-
"combobox
|
|
1710
|
+
"combobox": COMBOBOX_STATES
|
|
1712
1711
|
// Add more mappings as needed
|
|
1713
1712
|
};
|
|
1714
1713
|
var FluentContract = class {
|
|
@@ -1742,11 +1741,13 @@ var ContractBuilder = class {
|
|
|
1742
1741
|
const api = {
|
|
1743
1742
|
ariaReference: (from, attribute, to) => ({
|
|
1744
1743
|
required: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "required" }),
|
|
1745
|
-
optional: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "optional" })
|
|
1744
|
+
optional: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "optional" }),
|
|
1745
|
+
recommended: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "recommended" })
|
|
1746
1746
|
}),
|
|
1747
1747
|
contains: (parent, child) => ({
|
|
1748
1748
|
required: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "required" }),
|
|
1749
|
-
optional: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "optional" })
|
|
1749
|
+
optional: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "optional" }),
|
|
1750
|
+
recommended: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "recommended" })
|
|
1750
1751
|
})
|
|
1751
1752
|
};
|
|
1752
1753
|
fn(api);
|
|
@@ -1757,7 +1758,8 @@ var ContractBuilder = class {
|
|
|
1757
1758
|
target: (target) => ({
|
|
1758
1759
|
has: (attribute, expectedValue) => ({
|
|
1759
1760
|
required: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "required" }),
|
|
1760
|
-
optional: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "optional" })
|
|
1761
|
+
optional: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "optional" }),
|
|
1762
|
+
recommended: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "recommended" })
|
|
1761
1763
|
})
|
|
1762
1764
|
})
|
|
1763
1765
|
};
|
|
@@ -1899,16 +1901,13 @@ import { axe } from "jest-axe";
|
|
|
1899
1901
|
|
|
1900
1902
|
// src/utils/test/src/contractTestRunner.ts
|
|
1901
1903
|
import fs from "fs/promises";
|
|
1902
|
-
async function runContractTests(componentName, component, strictness) {
|
|
1904
|
+
async function runContractTests(contractPath, componentName, component, strictness) {
|
|
1903
1905
|
const reporter = new ContractReporter(false);
|
|
1904
1906
|
const strictnessMode = normalizeStrictness(strictness);
|
|
1905
|
-
const contractTyped = contract_default;
|
|
1906
|
-
const contractPath = contractTyped[componentName]?.path;
|
|
1907
1907
|
if (!contractPath) {
|
|
1908
|
-
throw new Error(`No contract
|
|
1908
|
+
throw new Error(`No contract path provided for component: ${componentName}`);
|
|
1909
1909
|
}
|
|
1910
|
-
const
|
|
1911
|
-
const contractData = await fs.readFile(resolvedPath, "utf-8");
|
|
1910
|
+
const contractData = await fs.readFile(contractPath, "utf-8");
|
|
1912
1911
|
const componentContract = JSON.parse(contractData);
|
|
1913
1912
|
const totalTests = (componentContract.relationships?.length || 0) + (componentContract.static[0]?.assertions.length || 0) + componentContract.dynamic.length;
|
|
1914
1913
|
reporter.start(componentName, totalTests);
|
|
@@ -2108,7 +2107,7 @@ Error: ${error instanceof Error ? error.message : String(error)}`
|
|
|
2108
2107
|
let configBaseDir = typeof process !== "undefined" ? process.cwd() : "";
|
|
2109
2108
|
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
2110
2109
|
try {
|
|
2111
|
-
const { loadConfig } = await import("./configLoader-
|
|
2110
|
+
const { loadConfig } = await import("./configLoader-Q7N5XV4P.js");
|
|
2112
2111
|
const result2 = await loadConfig(process.cwd());
|
|
2113
2112
|
config = result2.config;
|
|
2114
2113
|
if (result2.configPath) {
|
|
@@ -2130,7 +2129,7 @@ Error: ${error instanceof Error ? error.message : String(error)}`
|
|
|
2130
2129
|
const devServerUrl = await checkDevServer(url);
|
|
2131
2130
|
if (devServerUrl) {
|
|
2132
2131
|
console.log(`\u{1F3AD} Running Playwright tests on ${devServerUrl}`);
|
|
2133
|
-
const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-
|
|
2132
|
+
const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-DIXP5DQ3.js");
|
|
2134
2133
|
contract = await runContractTestsPlaywright(componentName, devServerUrl, strictness, config, configBaseDir);
|
|
2135
2134
|
} else {
|
|
2136
2135
|
throw new Error(
|
|
@@ -2140,7 +2139,16 @@ Please start your dev server and try again.`
|
|
|
2140
2139
|
}
|
|
2141
2140
|
} else if (component) {
|
|
2142
2141
|
console.log(`\u{1F3AD} Running component contract tests in JSDOM mode`);
|
|
2143
|
-
|
|
2142
|
+
const contractPath = config.test?.components?.find((comp) => comp?.name === componentName)?.contractPath;
|
|
2143
|
+
if (!contractPath) {
|
|
2144
|
+
throw new Error(`\u274C No contract path found for component: ${componentName}`);
|
|
2145
|
+
}
|
|
2146
|
+
contract = await runContractTests(
|
|
2147
|
+
path.resolve(configBaseDir, contractPath),
|
|
2148
|
+
componentName,
|
|
2149
|
+
component,
|
|
2150
|
+
strictness
|
|
2151
|
+
);
|
|
2144
2152
|
} else {
|
|
2145
2153
|
throw new Error("\u274C Either component or URL must be provided");
|
|
2146
2154
|
}
|
|
@@ -1,25 +1,5 @@
|
|
|
1
1
|
import { chromium } from 'playwright';
|
|
2
2
|
|
|
3
|
-
// src/utils/test/contract/contract.json
|
|
4
|
-
var contract_default = {
|
|
5
|
-
menu: {
|
|
6
|
-
path: "./aria-contracts/menu/menu.contract.json",
|
|
7
|
-
component: "menu"
|
|
8
|
-
},
|
|
9
|
-
"combobox.listbox": {
|
|
10
|
-
path: "./aria-contracts/combobox/combobox.listbox.contract.json",
|
|
11
|
-
component: "combobox.listbox"
|
|
12
|
-
},
|
|
13
|
-
accordion: {
|
|
14
|
-
path: "./aria-contracts/accordion/accordion.contract.json",
|
|
15
|
-
component: "accordion"
|
|
16
|
-
},
|
|
17
|
-
tabs: {
|
|
18
|
-
path: "./aria-contracts/tabs/tabs.contract.json",
|
|
19
|
-
component: "tabs"
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
3
|
// src/utils/test/src/ContractReporter.ts
|
|
24
4
|
var ContractReporter = class {
|
|
25
5
|
startTime = 0;
|
|
@@ -351,4 +331,4 @@ async function closeSharedBrowser() {
|
|
|
351
331
|
}
|
|
352
332
|
}
|
|
353
333
|
|
|
354
|
-
export { ContractReporter, closeSharedBrowser,
|
|
334
|
+
export { ContractReporter, closeSharedBrowser, createTestPage, normalizeLevel, normalizeStrictness, resolveEnforcement };
|
|
@@ -69,8 +69,8 @@ function validateConfig(config) {
|
|
|
69
69
|
if (typeof comp.name !== "string") {
|
|
70
70
|
errors.push(`test.components[${idx}].name must be a string`);
|
|
71
71
|
}
|
|
72
|
-
if (comp.
|
|
73
|
-
errors.push(`test.components[${idx}].
|
|
72
|
+
if (comp.contractPath !== void 0 && typeof comp.contractPath !== "string") {
|
|
73
|
+
errors.push(`test.components[${idx}].contractPath must be a string when provided`);
|
|
74
74
|
}
|
|
75
75
|
if (comp.strategyPath !== void 0 && typeof comp.strategyPath !== "string") {
|
|
76
76
|
errors.push(`test.components[${idx}].strategyPath must be a string when provided`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContractReporter, normalizeStrictness, createTestPage, normalizeLevel, resolveEnforcement } from './chunk-FZ7GMIJB.js';
|
|
2
2
|
import { readFileSync } from 'fs';
|
|
3
3
|
import path2 from 'path';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
@@ -37,12 +37,6 @@ var StrategyRegistry = class {
|
|
|
37
37
|
(m) => m.TabsComponentStrategy
|
|
38
38
|
)
|
|
39
39
|
);
|
|
40
|
-
this.builtInStrategies.set(
|
|
41
|
-
"combobox.listbox",
|
|
42
|
-
() => import('./ComboboxComponentStrategy-5AECQSRN.js').then(
|
|
43
|
-
(m) => m.ComboboxComponentStrategy
|
|
44
|
-
)
|
|
45
|
-
);
|
|
46
40
|
}
|
|
47
41
|
/**
|
|
48
42
|
* Load a strategy - either from custom path or built-in registry
|
|
@@ -106,11 +100,7 @@ var ComponentDetector = class {
|
|
|
106
100
|
*/
|
|
107
101
|
static async detect(componentName, componentConfig, actionTimeoutMs = 400, assertionTimeoutMs = 400, configBaseDir) {
|
|
108
102
|
const typedComponentConfig = this.isComponentConfig(componentConfig) ? componentConfig : void 0;
|
|
109
|
-
|
|
110
|
-
if (!contractPath) {
|
|
111
|
-
const contractTyped = contract_default;
|
|
112
|
-
contractPath = contractTyped[componentName]?.path;
|
|
113
|
-
}
|
|
103
|
+
const contractPath = typedComponentConfig?.contractPath;
|
|
114
104
|
if (!contractPath) {
|
|
115
105
|
throw new Error(`Contract path not found for component: ${componentName}`);
|
|
116
106
|
}
|
|
@@ -143,7 +133,7 @@ var ComponentDetector = class {
|
|
|
143
133
|
if (!strategyClass) {
|
|
144
134
|
return null;
|
|
145
135
|
}
|
|
146
|
-
const mainSelector = selectors.
|
|
136
|
+
const mainSelector = selectors.main;
|
|
147
137
|
if (componentName === "tabs") {
|
|
148
138
|
return new strategyClass(mainSelector, selectors);
|
|
149
139
|
}
|
|
@@ -689,7 +679,7 @@ var AssertionRunner = class {
|
|
|
689
679
|
// src/utils/test/src/contractTestRunnerPlaywright.ts
|
|
690
680
|
async function runContractTestsPlaywright(componentName, url, strictness, config, configBaseDir) {
|
|
691
681
|
const componentConfig = config?.test?.components?.find((c) => c.name === componentName);
|
|
692
|
-
const isCustomContract = !!componentConfig?.
|
|
682
|
+
const isCustomContract = !!componentConfig?.contractPath;
|
|
693
683
|
const reporter = new ContractReporter(true, isCustomContract);
|
|
694
684
|
const defaultTimeouts = {
|
|
695
685
|
actionTimeoutMs: 400,
|
|
@@ -729,11 +719,7 @@ async function runContractTestsPlaywright(componentName, url, strictness, config
|
|
|
729
719
|
defaultTimeouts.componentReadyTimeoutMs
|
|
730
720
|
);
|
|
731
721
|
const strictnessMode = normalizeStrictness(strictness);
|
|
732
|
-
|
|
733
|
-
if (!contractPath) {
|
|
734
|
-
const contractTyped = contract_default;
|
|
735
|
-
contractPath = contractTyped[componentName]?.path;
|
|
736
|
-
}
|
|
722
|
+
const contractPath = componentConfig?.contractPath;
|
|
737
723
|
if (!contractPath) {
|
|
738
724
|
throw new Error(`Contract path not found for component: ${componentName}`);
|
|
739
725
|
}
|
|
@@ -200,7 +200,7 @@ function isInputFilled() {
|
|
|
200
200
|
|
|
201
201
|
// src/utils/test/dsl/src/contractBuilder.ts
|
|
202
202
|
var STATE_PACKS = {
|
|
203
|
-
"combobox
|
|
203
|
+
"combobox": COMBOBOX_STATES
|
|
204
204
|
// Add more mappings as needed
|
|
205
205
|
};
|
|
206
206
|
var FluentContract = class {
|
|
@@ -234,11 +234,13 @@ var ContractBuilder = class {
|
|
|
234
234
|
const api = {
|
|
235
235
|
ariaReference: (from, attribute, to) => ({
|
|
236
236
|
required: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "required" }),
|
|
237
|
-
optional: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "optional" })
|
|
237
|
+
optional: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "optional" }),
|
|
238
|
+
recommended: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "recommended" })
|
|
238
239
|
}),
|
|
239
240
|
contains: (parent, child) => ({
|
|
240
241
|
required: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "required" }),
|
|
241
|
-
optional: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "optional" })
|
|
242
|
+
optional: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "optional" }),
|
|
243
|
+
recommended: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "recommended" })
|
|
242
244
|
})
|
|
243
245
|
};
|
|
244
246
|
fn(api);
|
|
@@ -249,7 +251,8 @@ var ContractBuilder = class {
|
|
|
249
251
|
target: (target) => ({
|
|
250
252
|
has: (attribute, expectedValue) => ({
|
|
251
253
|
required: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "required" }),
|
|
252
|
-
optional: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "optional" })
|
|
254
|
+
optional: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "optional" }),
|
|
255
|
+
recommended: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "recommended" })
|
|
253
256
|
})
|
|
254
257
|
})
|
|
255
258
|
};
|
|
@@ -92,10 +92,12 @@ declare class ContractBuilder {
|
|
|
92
92
|
ariaReference: (from: string, attribute: string, to: string) => {
|
|
93
93
|
required: () => void;
|
|
94
94
|
optional: () => void;
|
|
95
|
+
recommended: () => void;
|
|
95
96
|
};
|
|
96
97
|
contains: (parent: string, child: string) => {
|
|
97
98
|
required: () => void;
|
|
98
99
|
optional: () => void;
|
|
100
|
+
recommended: () => void;
|
|
99
101
|
};
|
|
100
102
|
}) => void): this;
|
|
101
103
|
static(fn: (s: {
|
|
@@ -103,6 +105,7 @@ declare class ContractBuilder {
|
|
|
103
105
|
has: (attribute: string, expectedValue: string) => {
|
|
104
106
|
required: () => void;
|
|
105
107
|
optional: () => void;
|
|
108
|
+
recommended: () => void;
|
|
106
109
|
};
|
|
107
110
|
};
|
|
108
111
|
}) => void): this;
|
|
@@ -92,10 +92,12 @@ declare class ContractBuilder {
|
|
|
92
92
|
ariaReference: (from: string, attribute: string, to: string) => {
|
|
93
93
|
required: () => void;
|
|
94
94
|
optional: () => void;
|
|
95
|
+
recommended: () => void;
|
|
95
96
|
};
|
|
96
97
|
contains: (parent: string, child: string) => {
|
|
97
98
|
required: () => void;
|
|
98
99
|
optional: () => void;
|
|
100
|
+
recommended: () => void;
|
|
99
101
|
};
|
|
100
102
|
}) => void): this;
|
|
101
103
|
static(fn: (s: {
|
|
@@ -103,6 +105,7 @@ declare class ContractBuilder {
|
|
|
103
105
|
has: (attribute: string, expectedValue: string) => {
|
|
104
106
|
required: () => void;
|
|
105
107
|
optional: () => void;
|
|
108
|
+
recommended: () => void;
|
|
106
109
|
};
|
|
107
110
|
};
|
|
108
111
|
}) => void): this;
|
|
@@ -198,7 +198,7 @@ function isInputFilled() {
|
|
|
198
198
|
|
|
199
199
|
// src/utils/test/dsl/src/contractBuilder.ts
|
|
200
200
|
var STATE_PACKS = {
|
|
201
|
-
"combobox
|
|
201
|
+
"combobox": COMBOBOX_STATES
|
|
202
202
|
// Add more mappings as needed
|
|
203
203
|
};
|
|
204
204
|
var FluentContract = class {
|
|
@@ -232,11 +232,13 @@ var ContractBuilder = class {
|
|
|
232
232
|
const api = {
|
|
233
233
|
ariaReference: (from, attribute, to) => ({
|
|
234
234
|
required: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "required" }),
|
|
235
|
-
optional: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "optional" })
|
|
235
|
+
optional: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "optional" }),
|
|
236
|
+
recommended: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "recommended" })
|
|
236
237
|
}),
|
|
237
238
|
contains: (parent, child) => ({
|
|
238
239
|
required: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "required" }),
|
|
239
|
-
optional: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "optional" })
|
|
240
|
+
optional: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "optional" }),
|
|
241
|
+
recommended: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "recommended" })
|
|
240
242
|
})
|
|
241
243
|
};
|
|
242
244
|
fn(api);
|
|
@@ -247,7 +249,8 @@ var ContractBuilder = class {
|
|
|
247
249
|
target: (target) => ({
|
|
248
250
|
has: (attribute, expectedValue) => ({
|
|
249
251
|
required: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "required" }),
|
|
250
|
-
optional: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "optional" })
|
|
252
|
+
optional: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "optional" }),
|
|
253
|
+
recommended: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "recommended" })
|
|
251
254
|
})
|
|
252
255
|
})
|
|
253
256
|
};
|