@vitest/browser 3.0.5 → 3.0.7
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/context.d.ts +8 -8
- package/dist/client/.vite/manifest.json +6 -6
- package/dist/client/__vitest__/assets/index-BX_iUIjH.js +52 -0
- package/dist/client/__vitest__/index.html +2 -2
- package/dist/client/__vitest_browser__/{orchestrator-vOivV83Y.js → orchestrator-DeY4LJgz.js} +2 -1
- package/dist/client/__vitest_browser__/tester-Cqa_buNy.js +15505 -0
- package/dist/client/__vitest_browser__/{utils-Owv5OOOf.js → utils-CBFLDkwI.js} +23 -0
- package/dist/client/orchestrator.html +2 -2
- package/dist/client/tester/tester.html +2 -2
- package/dist/client.js +5 -5
- package/dist/context.js +6 -9
- package/dist/{index--cbQOwRJ.js → index-fqTesRIH.js} +3 -14
- package/dist/index.d.ts +6 -7
- package/dist/index.js +34 -25
- package/dist/locators/index.d.ts +0 -3
- package/dist/locators/index.js +2 -2
- package/dist/locators/playwright.js +2 -2
- package/dist/locators/preview.js +2 -2
- package/dist/locators/webdriverio.js +2 -2
- package/dist/providers.js +1 -1
- package/dist/{public-utils-DldpEzVw.js → public-utils-J4vwTaki.js} +100 -102
- package/dist/state.js +1 -1
- package/dist/utils.js +1 -1
- package/dist/{webdriver-kh_HHy0p.js → webdriver-C5-VI7VH.js} +17 -8
- package/dummy.js +0 -0
- package/jest-dom.d.ts +1 -2
- package/package.json +21 -19
- package/providers/webdriverio.d.ts +4 -2
- package/dist/client/__vitest__/assets/index-CkLwJNkP.js +0 -52
- package/dist/client/__vitest_browser__/tester-BbJOQDQr.js +0 -13875
- /package/dist/client/__vitest__/assets/{index-D-vGI2PU.css → index-CV9H8iCm.css} +0 -0
|
@@ -94,7 +94,7 @@ function tokenize(str1) {
|
|
|
94
94
|
return str[i2];
|
|
95
95
|
};
|
|
96
96
|
const next = function(num) {
|
|
97
|
-
if (num ===
|
|
97
|
+
if (num === void 0) {
|
|
98
98
|
num = 1;
|
|
99
99
|
}
|
|
100
100
|
if (num > 3) {
|
|
@@ -103,7 +103,7 @@ function tokenize(str1) {
|
|
|
103
103
|
return codepoint(i + num);
|
|
104
104
|
};
|
|
105
105
|
const consume = function(num) {
|
|
106
|
-
if (num ===
|
|
106
|
+
if (num === void 0) {
|
|
107
107
|
num = 1;
|
|
108
108
|
}
|
|
109
109
|
i += num;
|
|
@@ -115,7 +115,7 @@ function tokenize(str1) {
|
|
|
115
115
|
return true;
|
|
116
116
|
};
|
|
117
117
|
const eof = function(codepoint2) {
|
|
118
|
-
if (codepoint2 ===
|
|
118
|
+
if (codepoint2 === void 0) {
|
|
119
119
|
codepoint2 = code;
|
|
120
120
|
}
|
|
121
121
|
return codepoint2 === -1;
|
|
@@ -317,7 +317,7 @@ function tokenize(str1) {
|
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
319
|
const consumeAStringToken = function(endingCodePoint) {
|
|
320
|
-
if (endingCodePoint ===
|
|
320
|
+
if (endingCodePoint === void 0) {
|
|
321
321
|
endingCodePoint = code;
|
|
322
322
|
}
|
|
323
323
|
let string = "";
|
|
@@ -1162,7 +1162,7 @@ function parseCSS(selector, customNames) {
|
|
|
1162
1162
|
if (!rawCSSString && !functions.length) {
|
|
1163
1163
|
throw unexpected();
|
|
1164
1164
|
}
|
|
1165
|
-
return { css: rawCSSString ||
|
|
1165
|
+
return { css: rawCSSString || void 0, functions };
|
|
1166
1166
|
}
|
|
1167
1167
|
function consumeBuiltinFunctionArguments() {
|
|
1168
1168
|
let s = "";
|
|
@@ -1362,7 +1362,7 @@ function parseSelectorString(selector) {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
result.parts.push({ name, body });
|
|
1364
1364
|
if (capture) {
|
|
1365
|
-
if (result.capture !==
|
|
1365
|
+
if (result.capture !== void 0) {
|
|
1366
1366
|
throw new InvalidSelectorError(
|
|
1367
1367
|
`Only one of the selectors can capture using * modifier`
|
|
1368
1368
|
);
|
|
@@ -1385,7 +1385,7 @@ function parseSelectorString(selector) {
|
|
|
1385
1385
|
if (c === "\\" && index + 1 < selector.length) {
|
|
1386
1386
|
index += 2;
|
|
1387
1387
|
} else if (c === quote) {
|
|
1388
|
-
quote =
|
|
1388
|
+
quote = void 0;
|
|
1389
1389
|
index++;
|
|
1390
1390
|
} else if (!quote && (c === '"' || c === "'" || c === "`") && !shouldIgnoreTextSelectorQuote()) {
|
|
1391
1391
|
quote = c;
|
|
@@ -1604,7 +1604,7 @@ function parseAttributeSelector(selector, allowUnquotedStrings) {
|
|
|
1604
1604
|
skipSpaces();
|
|
1605
1605
|
}
|
|
1606
1606
|
if (!EOL) {
|
|
1607
|
-
syntaxError(
|
|
1607
|
+
syntaxError(void 0);
|
|
1608
1608
|
}
|
|
1609
1609
|
if (!result.name && !result.attributes.length) {
|
|
1610
1610
|
throw new InvalidSelectorError(
|
|
@@ -1734,7 +1734,7 @@ function closestCrossShadow(element, css) {
|
|
|
1734
1734
|
}
|
|
1735
1735
|
}
|
|
1736
1736
|
function getElementComputedStyle(element, pseudo) {
|
|
1737
|
-
return element.ownerDocument && element.ownerDocument.defaultView ? element.ownerDocument.defaultView.getComputedStyle(element, pseudo) :
|
|
1737
|
+
return element.ownerDocument && element.ownerDocument.defaultView ? element.ownerDocument.defaultView.getComputedStyle(element, pseudo) : void 0;
|
|
1738
1738
|
}
|
|
1739
1739
|
function isElementStyleVisibilityVisible(element, style) {
|
|
1740
1740
|
style = style != null ? style : getElementComputedStyle(element);
|
|
@@ -1747,7 +1747,7 @@ function isElementStyleVisibilityVisible(element, style) {
|
|
|
1747
1747
|
}
|
|
1748
1748
|
} else {
|
|
1749
1749
|
const detailsOrSummary = element.closest("details,summary");
|
|
1750
|
-
if (detailsOrSummary !== element && (detailsOrSummary == null ?
|
|
1750
|
+
if (detailsOrSummary !== element && (detailsOrSummary == null ? void 0 : detailsOrSummary.nodeName) === "DETAILS" && !detailsOrSummary.open) {
|
|
1751
1751
|
return false;
|
|
1752
1752
|
}
|
|
1753
1753
|
}
|
|
@@ -1797,25 +1797,25 @@ function hasExplicitAccessibleName(e) {
|
|
|
1797
1797
|
}
|
|
1798
1798
|
var kAncestorPreventingLandmark = "article:not([role]), aside:not([role]), main:not([role]), nav:not([role]), section:not([role]), [role=article], [role=complementary], [role=main], [role=navigation], [role=region]";
|
|
1799
1799
|
var kGlobalAriaAttributes = /* @__PURE__ */ new Map([
|
|
1800
|
-
["aria-atomic",
|
|
1801
|
-
["aria-busy",
|
|
1802
|
-
["aria-controls",
|
|
1803
|
-
["aria-current",
|
|
1804
|
-
["aria-describedby",
|
|
1805
|
-
["aria-details",
|
|
1800
|
+
["aria-atomic", void 0],
|
|
1801
|
+
["aria-busy", void 0],
|
|
1802
|
+
["aria-controls", void 0],
|
|
1803
|
+
["aria-current", void 0],
|
|
1804
|
+
["aria-describedby", void 0],
|
|
1805
|
+
["aria-details", void 0],
|
|
1806
1806
|
// Global use deprecated in ARIA 1.2
|
|
1807
1807
|
// ['aria-disabled', undefined],
|
|
1808
|
-
["aria-dropeffect",
|
|
1808
|
+
["aria-dropeffect", void 0],
|
|
1809
1809
|
// Global use deprecated in ARIA 1.2
|
|
1810
1810
|
// ['aria-errormessage', undefined],
|
|
1811
|
-
["aria-flowto",
|
|
1812
|
-
["aria-grabbed",
|
|
1811
|
+
["aria-flowto", void 0],
|
|
1812
|
+
["aria-grabbed", void 0],
|
|
1813
1813
|
// Global use deprecated in ARIA 1.2
|
|
1814
1814
|
// ['aria-haspopup', undefined],
|
|
1815
|
-
["aria-hidden",
|
|
1815
|
+
["aria-hidden", void 0],
|
|
1816
1816
|
// Global use deprecated in ARIA 1.2
|
|
1817
1817
|
// ['aria-invalid', undefined],
|
|
1818
|
-
["aria-keyshortcuts",
|
|
1818
|
+
["aria-keyshortcuts", void 0],
|
|
1819
1819
|
[
|
|
1820
1820
|
"aria-label",
|
|
1821
1821
|
/* @__PURE__ */ new Set([
|
|
@@ -1848,14 +1848,14 @@ var kGlobalAriaAttributes = /* @__PURE__ */ new Map([
|
|
|
1848
1848
|
"superscript"
|
|
1849
1849
|
])
|
|
1850
1850
|
],
|
|
1851
|
-
["aria-live",
|
|
1852
|
-
["aria-owns",
|
|
1853
|
-
["aria-relevant",
|
|
1851
|
+
["aria-live", void 0],
|
|
1852
|
+
["aria-owns", void 0],
|
|
1853
|
+
["aria-relevant", void 0],
|
|
1854
1854
|
["aria-roledescription", /* @__PURE__ */ new Set(["generic"])]
|
|
1855
1855
|
]);
|
|
1856
1856
|
function hasGlobalAriaAttribute(element, forRole) {
|
|
1857
1857
|
return [...kGlobalAriaAttributes].some(([attr, prohibited]) => {
|
|
1858
|
-
return !(prohibited == null ?
|
|
1858
|
+
return !(prohibited == null ? void 0 : prohibited.has(forRole || "")) && element.hasAttribute(attr);
|
|
1859
1859
|
});
|
|
1860
1860
|
}
|
|
1861
1861
|
function hasTabIndex(element) {
|
|
@@ -1998,7 +1998,7 @@ var kPresentationInheritanceParents = {
|
|
|
1998
1998
|
};
|
|
1999
1999
|
function getImplicitAriaRole(element) {
|
|
2000
2000
|
var _a;
|
|
2001
|
-
const implicitRole = ((_a = kImplicitRoleByTagName[elementSafeTagName(element)]) == null ?
|
|
2001
|
+
const implicitRole = ((_a = kImplicitRoleByTagName[elementSafeTagName(element)]) == null ? void 0 : _a.call(kImplicitRoleByTagName, element)) || "";
|
|
2002
2002
|
if (!implicitRole) {
|
|
2003
2003
|
return null;
|
|
2004
2004
|
}
|
|
@@ -2149,7 +2149,7 @@ function getAriaRole(element) {
|
|
|
2149
2149
|
return explicitRole;
|
|
2150
2150
|
}
|
|
2151
2151
|
function getAriaBoolean(attr) {
|
|
2152
|
-
return attr === null ?
|
|
2152
|
+
return attr === null ? void 0 : attr.toLowerCase() === "true";
|
|
2153
2153
|
}
|
|
2154
2154
|
function isElementHiddenForAria(element) {
|
|
2155
2155
|
if (["STYLE", "SCRIPT", "NOSCRIPT", "TEMPLATE"].includes(elementSafeTagName(element))) {
|
|
@@ -2157,7 +2157,7 @@ function isElementHiddenForAria(element) {
|
|
|
2157
2157
|
}
|
|
2158
2158
|
const style = getElementComputedStyle(element);
|
|
2159
2159
|
const isSlot = element.nodeName === "SLOT";
|
|
2160
|
-
if ((style == null ?
|
|
2160
|
+
if ((style == null ? void 0 : style.display) === "contents" && !isSlot) {
|
|
2161
2161
|
for (let child = element.firstChild; child; child = child.nextSibling) {
|
|
2162
2162
|
if (child.nodeType === 1 && !isElementHiddenForAria(child)) {
|
|
2163
2163
|
return false;
|
|
@@ -2175,8 +2175,8 @@ function isElementHiddenForAria(element) {
|
|
|
2175
2175
|
return belongsToDisplayNoneOrAriaHiddenOrNonSlotted(element);
|
|
2176
2176
|
}
|
|
2177
2177
|
function belongsToDisplayNoneOrAriaHiddenOrNonSlotted(element) {
|
|
2178
|
-
let hidden = cacheIsHidden == null ?
|
|
2179
|
-
if (hidden ===
|
|
2178
|
+
let hidden = cacheIsHidden == null ? void 0 : cacheIsHidden.get(element);
|
|
2179
|
+
if (hidden === void 0) {
|
|
2180
2180
|
hidden = false;
|
|
2181
2181
|
if (element.parentElement && element.parentElement.shadowRoot && !element.assignedSlot) {
|
|
2182
2182
|
hidden = true;
|
|
@@ -2191,7 +2191,7 @@ function belongsToDisplayNoneOrAriaHiddenOrNonSlotted(element) {
|
|
|
2191
2191
|
hidden = belongsToDisplayNoneOrAriaHiddenOrNonSlotted(parent);
|
|
2192
2192
|
}
|
|
2193
2193
|
}
|
|
2194
|
-
cacheIsHidden == null ?
|
|
2194
|
+
cacheIsHidden == null ? void 0 : cacheIsHidden.set(element, hidden);
|
|
2195
2195
|
}
|
|
2196
2196
|
return hidden;
|
|
2197
2197
|
}
|
|
@@ -2235,8 +2235,8 @@ function queryInAriaOwned(element, selector) {
|
|
|
2235
2235
|
}
|
|
2236
2236
|
function getPseudoContent(element, pseudo) {
|
|
2237
2237
|
const cache = pseudo === "::before" ? cachePseudoContentBefore : cachePseudoContentAfter;
|
|
2238
|
-
if (cache == null ?
|
|
2239
|
-
return (cache == null ?
|
|
2238
|
+
if (cache == null ? void 0 : cache.has(element)) {
|
|
2239
|
+
return (cache == null ? void 0 : cache.get(element)) || "";
|
|
2240
2240
|
}
|
|
2241
2241
|
const pseudoStyle = getElementComputedStyle(element, pseudo);
|
|
2242
2242
|
const content = getPseudoContentImpl(pseudoStyle);
|
|
@@ -2318,8 +2318,8 @@ function allowsNameFromContent(role, targetDescendant) {
|
|
|
2318
2318
|
}
|
|
2319
2319
|
function getElementAccessibleName(element, includeHidden) {
|
|
2320
2320
|
const cache = includeHidden ? cacheAccessibleNameHidden : cacheAccessibleName;
|
|
2321
|
-
let accessibleName = cache == null ?
|
|
2322
|
-
if (accessibleName ===
|
|
2321
|
+
let accessibleName = cache == null ? void 0 : cache.get(element);
|
|
2322
|
+
if (accessibleName === void 0) {
|
|
2323
2323
|
accessibleName = "";
|
|
2324
2324
|
const elementProhibitsNaming = [
|
|
2325
2325
|
"caption",
|
|
@@ -2344,15 +2344,15 @@ function getElementAccessibleName(element, includeHidden) {
|
|
|
2344
2344
|
getTextAlternativeInternal(element, {
|
|
2345
2345
|
includeHidden,
|
|
2346
2346
|
visitedElements: /* @__PURE__ */ new Set(),
|
|
2347
|
-
embeddedInDescribedBy:
|
|
2348
|
-
embeddedInLabelledBy:
|
|
2349
|
-
embeddedInLabel:
|
|
2350
|
-
embeddedInNativeTextAlternative:
|
|
2347
|
+
embeddedInDescribedBy: void 0,
|
|
2348
|
+
embeddedInLabelledBy: void 0,
|
|
2349
|
+
embeddedInLabel: void 0,
|
|
2350
|
+
embeddedInNativeTextAlternative: void 0,
|
|
2351
2351
|
embeddedInTargetElement: "self"
|
|
2352
2352
|
})
|
|
2353
2353
|
);
|
|
2354
2354
|
}
|
|
2355
|
-
cache == null ?
|
|
2355
|
+
cache == null ? void 0 : cache.set(element, accessibleName);
|
|
2356
2356
|
}
|
|
2357
2357
|
return accessibleName;
|
|
2358
2358
|
}
|
|
@@ -2365,7 +2365,7 @@ function getTextAlternativeInternal(element, options) {
|
|
|
2365
2365
|
...options,
|
|
2366
2366
|
embeddedInTargetElement: options.embeddedInTargetElement === "self" ? "descendant" : options.embeddedInTargetElement
|
|
2367
2367
|
};
|
|
2368
|
-
if (!options.includeHidden && !((_a = options.embeddedInLabelledBy) == null ?
|
|
2368
|
+
if (!options.includeHidden && !((_a = options.embeddedInLabelledBy) == null ? void 0 : _a.hidden) && !((_b = options.embeddedInDescribedBy) == null ? void 0 : _b.hidden) && !((_c = options == null ? void 0 : options.embeddedInNativeTextAlternative) == null ? void 0 : _c.hidden) && !((_d = options == null ? void 0 : options.embeddedInLabel) == null ? void 0 : _d.hidden) && isElementHiddenForAria(element)) {
|
|
2369
2369
|
options.visitedElements.add(element);
|
|
2370
2370
|
return "";
|
|
2371
2371
|
}
|
|
@@ -2378,10 +2378,10 @@ function getTextAlternativeInternal(element, options) {
|
|
|
2378
2378
|
element: ref,
|
|
2379
2379
|
hidden: isElementHiddenForAria(ref)
|
|
2380
2380
|
},
|
|
2381
|
-
embeddedInDescribedBy:
|
|
2381
|
+
embeddedInDescribedBy: void 0,
|
|
2382
2382
|
embeddedInTargetElement: "none",
|
|
2383
|
-
embeddedInLabel:
|
|
2384
|
-
embeddedInNativeTextAlternative:
|
|
2383
|
+
embeddedInLabel: void 0,
|
|
2384
|
+
embeddedInNativeTextAlternative: void 0
|
|
2385
2385
|
})
|
|
2386
2386
|
).join(" ");
|
|
2387
2387
|
if (accessibleName) {
|
|
@@ -2608,7 +2608,7 @@ function getTextAlternativeInternal(element, options) {
|
|
|
2608
2608
|
return;
|
|
2609
2609
|
}
|
|
2610
2610
|
if (node.nodeType === 1) {
|
|
2611
|
-
const display = ((_a2 = getElementComputedStyle(node)) == null ?
|
|
2611
|
+
const display = ((_a2 = getElementComputedStyle(node)) == null ? void 0 : _a2.display) || "inline";
|
|
2612
2612
|
let token = getTextAlternativeInternal(node, childOptions);
|
|
2613
2613
|
if (display !== "inline" || node.nodeName === "BR") {
|
|
2614
2614
|
token = ` ${token} `;
|
|
@@ -2852,9 +2852,9 @@ function getAccessibleNameFromAssociatedLabels(labels, options) {
|
|
|
2852
2852
|
element: label,
|
|
2853
2853
|
hidden: isElementHiddenForAria(label)
|
|
2854
2854
|
},
|
|
2855
|
-
embeddedInNativeTextAlternative:
|
|
2856
|
-
embeddedInLabelledBy:
|
|
2857
|
-
embeddedInDescribedBy:
|
|
2855
|
+
embeddedInNativeTextAlternative: void 0,
|
|
2856
|
+
embeddedInLabelledBy: void 0,
|
|
2857
|
+
embeddedInDescribedBy: void 0,
|
|
2858
2858
|
embeddedInTargetElement: "none"
|
|
2859
2859
|
})
|
|
2860
2860
|
).filter((accessibleName) => !!accessibleName).join(" ");
|
|
@@ -2875,11 +2875,11 @@ function beginAriaCaches() {
|
|
|
2875
2875
|
}
|
|
2876
2876
|
function endAriaCaches() {
|
|
2877
2877
|
if (!--cachesCounter) {
|
|
2878
|
-
cacheAccessibleName =
|
|
2879
|
-
cacheAccessibleNameHidden =
|
|
2880
|
-
cacheIsHidden =
|
|
2881
|
-
cachePseudoContentBefore =
|
|
2882
|
-
cachePseudoContentAfter =
|
|
2878
|
+
cacheAccessibleName = void 0;
|
|
2879
|
+
cacheAccessibleNameHidden = void 0;
|
|
2880
|
+
cacheIsHidden = void 0;
|
|
2881
|
+
cachePseudoContentBefore = void 0;
|
|
2882
|
+
cachePseudoContentAfter = void 0;
|
|
2883
2883
|
}
|
|
2884
2884
|
}
|
|
2885
2885
|
|
|
@@ -2922,7 +2922,7 @@ function shouldSkipForTextMatching(element) {
|
|
|
2922
2922
|
}
|
|
2923
2923
|
function elementText(cache, root) {
|
|
2924
2924
|
let value = cache.get(root);
|
|
2925
|
-
if (value ===
|
|
2925
|
+
if (value === void 0) {
|
|
2926
2926
|
value = { full: "", normalized: "", immediate: [] };
|
|
2927
2927
|
if (!shouldSkipForTextMatching(root)) {
|
|
2928
2928
|
let currentImmediate = "";
|
|
@@ -3121,22 +3121,22 @@ function queryRole(scope, options, internal) {
|
|
|
3121
3121
|
if (getAriaRole(element) !== options.role) {
|
|
3122
3122
|
return;
|
|
3123
3123
|
}
|
|
3124
|
-
if (options.selected !==
|
|
3124
|
+
if (options.selected !== void 0 && getAriaSelected(element) !== options.selected) {
|
|
3125
3125
|
return;
|
|
3126
3126
|
}
|
|
3127
|
-
if (options.checked !==
|
|
3127
|
+
if (options.checked !== void 0 && getAriaChecked(element) !== options.checked) {
|
|
3128
3128
|
return;
|
|
3129
3129
|
}
|
|
3130
|
-
if (options.pressed !==
|
|
3130
|
+
if (options.pressed !== void 0 && getAriaPressed(element) !== options.pressed) {
|
|
3131
3131
|
return;
|
|
3132
3132
|
}
|
|
3133
|
-
if (options.expanded !==
|
|
3133
|
+
if (options.expanded !== void 0 && getAriaExpanded(element) !== options.expanded) {
|
|
3134
3134
|
return;
|
|
3135
3135
|
}
|
|
3136
|
-
if (options.level !==
|
|
3136
|
+
if (options.level !== void 0 && getAriaLevel(element) !== options.level) {
|
|
3137
3137
|
return;
|
|
3138
3138
|
}
|
|
3139
|
-
if (options.disabled !==
|
|
3139
|
+
if (options.disabled !== void 0 && getAriaDisabled(element) !== options.disabled) {
|
|
3140
3140
|
return;
|
|
3141
3141
|
}
|
|
3142
3142
|
if (!options.includeHidden) {
|
|
@@ -3145,7 +3145,7 @@ function queryRole(scope, options, internal) {
|
|
|
3145
3145
|
return;
|
|
3146
3146
|
}
|
|
3147
3147
|
}
|
|
3148
|
-
if (options.name !==
|
|
3148
|
+
if (options.name !== void 0) {
|
|
3149
3149
|
const accessibleName = normalizeWhiteSpace(
|
|
3150
3150
|
getElementAccessibleName(element, !!options.includeHidden)
|
|
3151
3151
|
);
|
|
@@ -3156,8 +3156,6 @@ function queryRole(scope, options, internal) {
|
|
|
3156
3156
|
options.nameOp = "*=";
|
|
3157
3157
|
}
|
|
3158
3158
|
if (!matchesAttributePart(accessibleName, {
|
|
3159
|
-
name: "",
|
|
3160
|
-
jsonPath: [],
|
|
3161
3159
|
op: options.nameOp || "=",
|
|
3162
3160
|
value: options.name,
|
|
3163
3161
|
caseSensitive: !!options.exact
|
|
@@ -3471,10 +3469,10 @@ var JavaScriptLocatorFactory = class {
|
|
|
3471
3469
|
generateLocator(base, kind, body, options = {}) {
|
|
3472
3470
|
switch (kind) {
|
|
3473
3471
|
case "default":
|
|
3474
|
-
if (options.hasText !==
|
|
3472
|
+
if (options.hasText !== void 0) {
|
|
3475
3473
|
return `locator(${this.quote(body)}, { hasText: ${this.toHasText(options.hasText)} })`;
|
|
3476
3474
|
}
|
|
3477
|
-
if (options.hasNotText !==
|
|
3475
|
+
if (options.hasNotText !== void 0) {
|
|
3478
3476
|
return `locator(${this.quote(body)}, { hasNotText: ${this.toHasText(options.hasNotText)} })`;
|
|
3479
3477
|
}
|
|
3480
3478
|
return `locator(${this.quote(body)})`;
|
|
@@ -3685,7 +3683,7 @@ function generateSelectorFor(injectedScript, targetElement, options) {
|
|
|
3685
3683
|
const calculateCached = (element, allowText) => {
|
|
3686
3684
|
const cache = allowText ? cacheAllowText : cacheDisallowText;
|
|
3687
3685
|
let value = cache.get(element);
|
|
3688
|
-
if (value ===
|
|
3686
|
+
if (value === void 0) {
|
|
3689
3687
|
value = calculate(element, allowText);
|
|
3690
3688
|
cache.set(element, value);
|
|
3691
3689
|
}
|
|
@@ -3962,7 +3960,7 @@ function cssFallback(injectedScript, targetElement, options) {
|
|
|
3962
3960
|
const selector = path.join(" > ");
|
|
3963
3961
|
const parsedSelector = injectedScript.parseSelector(selector);
|
|
3964
3962
|
const node = injectedScript.querySelector(parsedSelector, root, false);
|
|
3965
|
-
return node === targetElement ? selector :
|
|
3963
|
+
return node === targetElement ? selector : void 0;
|
|
3966
3964
|
}
|
|
3967
3965
|
function makeStrict(selector) {
|
|
3968
3966
|
const token = { engine: "css", selector, score: kCSSFallbackScore };
|
|
@@ -4162,34 +4160,34 @@ function suitableTextAlternatives(text) {
|
|
|
4162
4160
|
// src/layoutSelectorUtils.ts
|
|
4163
4161
|
function boxRightOf(box1, box2, maxDistance) {
|
|
4164
4162
|
const distance = box1.left - box2.right;
|
|
4165
|
-
if (distance < 0 || maxDistance !==
|
|
4163
|
+
if (distance < 0 || maxDistance !== void 0 && distance > maxDistance) {
|
|
4166
4164
|
return;
|
|
4167
4165
|
}
|
|
4168
4166
|
return distance + Math.max(box2.bottom - box1.bottom, 0) + Math.max(box1.top - box2.top, 0);
|
|
4169
4167
|
}
|
|
4170
4168
|
function boxLeftOf(box1, box2, maxDistance) {
|
|
4171
4169
|
const distance = box2.left - box1.right;
|
|
4172
|
-
if (distance < 0 || maxDistance !==
|
|
4170
|
+
if (distance < 0 || maxDistance !== void 0 && distance > maxDistance) {
|
|
4173
4171
|
return;
|
|
4174
4172
|
}
|
|
4175
4173
|
return distance + Math.max(box2.bottom - box1.bottom, 0) + Math.max(box1.top - box2.top, 0);
|
|
4176
4174
|
}
|
|
4177
4175
|
function boxAbove(box1, box2, maxDistance) {
|
|
4178
4176
|
const distance = box2.top - box1.bottom;
|
|
4179
|
-
if (distance < 0 || maxDistance !==
|
|
4177
|
+
if (distance < 0 || maxDistance !== void 0 && distance > maxDistance) {
|
|
4180
4178
|
return;
|
|
4181
4179
|
}
|
|
4182
4180
|
return distance + Math.max(box1.left - box2.left, 0) + Math.max(box2.right - box1.right, 0);
|
|
4183
4181
|
}
|
|
4184
4182
|
function boxBelow(box1, box2, maxDistance) {
|
|
4185
4183
|
const distance = box1.top - box2.bottom;
|
|
4186
|
-
if (distance < 0 || maxDistance !==
|
|
4184
|
+
if (distance < 0 || maxDistance !== void 0 && distance > maxDistance) {
|
|
4187
4185
|
return;
|
|
4188
4186
|
}
|
|
4189
4187
|
return distance + Math.max(box1.left - box2.left, 0) + Math.max(box2.right - box1.right, 0);
|
|
4190
4188
|
}
|
|
4191
4189
|
function boxNear(box1, box2, maxDistance) {
|
|
4192
|
-
const kThreshold = maxDistance ===
|
|
4190
|
+
const kThreshold = maxDistance === void 0 ? 50 : maxDistance;
|
|
4193
4191
|
let score = 0;
|
|
4194
4192
|
if (box1.left - box2.right >= 0) {
|
|
4195
4193
|
score += box1.left - box2.right;
|
|
@@ -4203,7 +4201,7 @@ function boxNear(box1, box2, maxDistance) {
|
|
|
4203
4201
|
if (box1.top - box2.bottom >= 0) {
|
|
4204
4202
|
score += box1.top - box2.bottom;
|
|
4205
4203
|
}
|
|
4206
|
-
return score > kThreshold ?
|
|
4204
|
+
return score > kThreshold ? void 0 : score;
|
|
4207
4205
|
}
|
|
4208
4206
|
var kLayoutSelectorNames = [
|
|
4209
4207
|
"left-of",
|
|
@@ -4227,10 +4225,10 @@ function layoutSelectorScore(name, element, inner, maxDistance) {
|
|
|
4227
4225
|
continue;
|
|
4228
4226
|
}
|
|
4229
4227
|
const score = scorer(box, e.getBoundingClientRect(), maxDistance);
|
|
4230
|
-
if (score ===
|
|
4228
|
+
if (score === void 0) {
|
|
4231
4229
|
continue;
|
|
4232
4230
|
}
|
|
4233
|
-
if (bestScore ===
|
|
4231
|
+
if (bestScore === void 0 || score < bestScore) {
|
|
4234
4232
|
bestScore = score;
|
|
4235
4233
|
}
|
|
4236
4234
|
}
|
|
@@ -4470,15 +4468,15 @@ var SelectorEvaluatorImpl = class {
|
|
|
4470
4468
|
let css = simple.css;
|
|
4471
4469
|
const funcs = simple.functions;
|
|
4472
4470
|
if (css === "*" && funcs.length) {
|
|
4473
|
-
css =
|
|
4471
|
+
css = void 0;
|
|
4474
4472
|
}
|
|
4475
4473
|
let elements;
|
|
4476
4474
|
let firstIndex = -1;
|
|
4477
|
-
if (css !==
|
|
4475
|
+
if (css !== void 0) {
|
|
4478
4476
|
elements = this._queryCSS(context, css);
|
|
4479
4477
|
} else {
|
|
4480
4478
|
firstIndex = funcs.findIndex(
|
|
4481
|
-
(func) => this._getEngine(func.name).query !==
|
|
4479
|
+
(func) => this._getEngine(func.name).query !== void 0
|
|
4482
4480
|
);
|
|
4483
4481
|
if (firstIndex === -1) {
|
|
4484
4482
|
firstIndex = 0;
|
|
@@ -4494,7 +4492,7 @@ var SelectorEvaluatorImpl = class {
|
|
|
4494
4492
|
continue;
|
|
4495
4493
|
}
|
|
4496
4494
|
const engine = this._getEngine(funcs[i].name);
|
|
4497
|
-
if (engine.matches !==
|
|
4495
|
+
if (engine.matches !== void 0) {
|
|
4498
4496
|
elements = elements.filter(
|
|
4499
4497
|
(e) => this._matchesEngine(engine, e, funcs[i].args, context)
|
|
4500
4498
|
);
|
|
@@ -4505,7 +4503,7 @@ var SelectorEvaluatorImpl = class {
|
|
|
4505
4503
|
continue;
|
|
4506
4504
|
}
|
|
4507
4505
|
const engine = this._getEngine(funcs[i].name);
|
|
4508
|
-
if (engine.matches ===
|
|
4506
|
+
if (engine.matches === void 0) {
|
|
4509
4507
|
elements = elements.filter(
|
|
4510
4508
|
(e) => this._matchesEngine(engine, e, funcs[i].args, context)
|
|
4511
4509
|
);
|
|
@@ -4783,7 +4781,7 @@ var textMatchesEngine = {
|
|
|
4783
4781
|
`"text-matches" engine expects a regexp body and optional regexp flags`
|
|
4784
4782
|
);
|
|
4785
4783
|
}
|
|
4786
|
-
const re = new RegExp(args[0], args.length === 2 ? args[1] :
|
|
4784
|
+
const re = new RegExp(args[0], args.length === 2 ? args[1] : void 0);
|
|
4787
4785
|
const matcher = (elementText2) => re.test(elementText2.full);
|
|
4788
4786
|
return elementMatchesText(
|
|
4789
4787
|
evaluator._cacheText,
|
|
@@ -4810,16 +4808,16 @@ var hasTextEngine = {
|
|
|
4810
4808
|
function createLayoutEngine(name) {
|
|
4811
4809
|
return {
|
|
4812
4810
|
matches(element, args, context, evaluator) {
|
|
4813
|
-
const maxDistance = args.length && typeof args[args.length - 1] === "number" ? args[args.length - 1] :
|
|
4814
|
-
const queryArgs = maxDistance ===
|
|
4815
|
-
if (args.length < 1 + (maxDistance ===
|
|
4811
|
+
const maxDistance = args.length && typeof args[args.length - 1] === "number" ? args[args.length - 1] : void 0;
|
|
4812
|
+
const queryArgs = maxDistance === void 0 ? args : args.slice(0, args.length - 1);
|
|
4813
|
+
if (args.length < 1 + (maxDistance === void 0 ? 0 : 1)) {
|
|
4816
4814
|
throw new Error(
|
|
4817
4815
|
`"${name}" engine expects a selector list and optional maximum distance in pixels`
|
|
4818
4816
|
);
|
|
4819
4817
|
}
|
|
4820
4818
|
const inner = evaluator.query(context, queryArgs);
|
|
4821
4819
|
const score = layoutSelectorScore(name, element, inner, maxDistance);
|
|
4822
|
-
if (score ===
|
|
4820
|
+
if (score === void 0) {
|
|
4823
4821
|
return false;
|
|
4824
4822
|
}
|
|
4825
4823
|
evaluator._markScore(element, score);
|
|
@@ -4854,7 +4852,7 @@ function parentElementOrShadowHostInContext(element, context) {
|
|
|
4854
4852
|
return;
|
|
4855
4853
|
}
|
|
4856
4854
|
if (!context.pierceShadow) {
|
|
4857
|
-
return element.parentElement ||
|
|
4855
|
+
return element.parentElement || void 0;
|
|
4858
4856
|
}
|
|
4859
4857
|
return parentElementOrShadowHost(element);
|
|
4860
4858
|
}
|
|
@@ -4862,7 +4860,7 @@ function previousSiblingInContext(element, context) {
|
|
|
4862
4860
|
if (element === context.scope) {
|
|
4863
4861
|
return;
|
|
4864
4862
|
}
|
|
4865
|
-
return element.previousElementSibling ||
|
|
4863
|
+
return element.previousElementSibling || void 0;
|
|
4866
4864
|
}
|
|
4867
4865
|
function sortInDOMOrder(elements) {
|
|
4868
4866
|
const elementToEntry = /* @__PURE__ */ new Map();
|
|
@@ -5063,7 +5061,7 @@ var _Ivya = class _Ivya {
|
|
|
5063
5061
|
);
|
|
5064
5062
|
}
|
|
5065
5063
|
querySelectorAll(selector, root) {
|
|
5066
|
-
if (selector.capture !==
|
|
5064
|
+
if (selector.capture !== void 0) {
|
|
5067
5065
|
if (selector.parts.some((part) => part.name === "nth")) {
|
|
5068
5066
|
throw this.createStacklessError(
|
|
5069
5067
|
`Can't query n-th element in a request with the capture.`
|
|
@@ -5088,7 +5086,7 @@ var _Ivya = class _Ivya {
|
|
|
5088
5086
|
if (!root.querySelectorAll) {
|
|
5089
5087
|
throw this.createStacklessError("Node is not queryable.");
|
|
5090
5088
|
}
|
|
5091
|
-
if (selector.capture !==
|
|
5089
|
+
if (selector.capture !== void 0) {
|
|
5092
5090
|
throw this.createStacklessError(
|
|
5093
5091
|
"Internal error: there should not be a capture in the selector."
|
|
5094
5092
|
);
|
|
@@ -5158,7 +5156,7 @@ var _Ivya = class _Ivya {
|
|
|
5158
5156
|
const inner = this.querySelectorAll(body.parsed, originalRoot);
|
|
5159
5157
|
for (const element of elements) {
|
|
5160
5158
|
const score = layoutSelectorScore(name, element, inner, body.distance);
|
|
5161
|
-
if (score !==
|
|
5159
|
+
if (score !== void 0) {
|
|
5162
5160
|
result.push({ element, score });
|
|
5163
5161
|
}
|
|
5164
5162
|
}
|
|
@@ -5462,13 +5460,13 @@ var XPathEngine = {
|
|
|
5462
5460
|
|
|
5463
5461
|
// src/locatorUtils.ts
|
|
5464
5462
|
function getByAttributeTextSelector(attrName, text, options) {
|
|
5465
|
-
return `internal:attr=[${attrName}=${escapeForAttributeSelector(text, (options == null ?
|
|
5463
|
+
return `internal:attr=[${attrName}=${escapeForAttributeSelector(text, (options == null ? void 0 : options.exact) || false)}]`;
|
|
5466
5464
|
}
|
|
5467
5465
|
function getByTestIdSelector(testIdAttributeName, testId) {
|
|
5468
5466
|
return `internal:testid=[${testIdAttributeName}=${escapeForAttributeSelector(testId, true)}]`;
|
|
5469
5467
|
}
|
|
5470
5468
|
function getByLabelSelector(text, options) {
|
|
5471
|
-
return `internal:label=${escapeForTextSelector(text, !!(options == null ?
|
|
5469
|
+
return `internal:label=${escapeForTextSelector(text, !!(options == null ? void 0 : options.exact))}`;
|
|
5472
5470
|
}
|
|
5473
5471
|
function getByAltTextSelector(text, options) {
|
|
5474
5472
|
return getByAttributeTextSelector("alt", text, options);
|
|
@@ -5480,32 +5478,32 @@ function getByPlaceholderSelector(text, options) {
|
|
|
5480
5478
|
return getByAttributeTextSelector("placeholder", text, options);
|
|
5481
5479
|
}
|
|
5482
5480
|
function getByTextSelector(text, options) {
|
|
5483
|
-
return `internal:text=${escapeForTextSelector(text, !!(options == null ?
|
|
5481
|
+
return `internal:text=${escapeForTextSelector(text, !!(options == null ? void 0 : options.exact))}`;
|
|
5484
5482
|
}
|
|
5485
5483
|
function getByRoleSelector(role, options = {}) {
|
|
5486
5484
|
const props = [];
|
|
5487
|
-
if (options.checked !==
|
|
5485
|
+
if (options.checked !== void 0) {
|
|
5488
5486
|
props.push(["checked", String(options.checked)]);
|
|
5489
5487
|
}
|
|
5490
|
-
if (options.disabled !==
|
|
5488
|
+
if (options.disabled !== void 0) {
|
|
5491
5489
|
props.push(["disabled", String(options.disabled)]);
|
|
5492
5490
|
}
|
|
5493
|
-
if (options.selected !==
|
|
5491
|
+
if (options.selected !== void 0) {
|
|
5494
5492
|
props.push(["selected", String(options.selected)]);
|
|
5495
5493
|
}
|
|
5496
|
-
if (options.expanded !==
|
|
5494
|
+
if (options.expanded !== void 0) {
|
|
5497
5495
|
props.push(["expanded", String(options.expanded)]);
|
|
5498
5496
|
}
|
|
5499
|
-
if (options.includeHidden !==
|
|
5497
|
+
if (options.includeHidden !== void 0) {
|
|
5500
5498
|
props.push(["include-hidden", String(options.includeHidden)]);
|
|
5501
5499
|
}
|
|
5502
|
-
if (options.level !==
|
|
5500
|
+
if (options.level !== void 0) {
|
|
5503
5501
|
props.push(["level", String(options.level)]);
|
|
5504
5502
|
}
|
|
5505
|
-
if (options.name !==
|
|
5503
|
+
if (options.name !== void 0) {
|
|
5506
5504
|
props.push(["name", escapeForAttributeSelector(options.name, !!options.exact)]);
|
|
5507
5505
|
}
|
|
5508
|
-
if (options.pressed !==
|
|
5506
|
+
if (options.pressed !== void 0) {
|
|
5509
5507
|
props.push(["pressed", String(options.pressed)]);
|
|
5510
5508
|
}
|
|
5511
5509
|
return `internal:role=${role}${props.map(([n, v]) => `[${n}=${v}]`).join("")}`;
|
|
@@ -5560,4 +5558,4 @@ ${prettyDOM(container)}`);
|
|
|
5560
5558
|
return error;
|
|
5561
5559
|
}
|
|
5562
5560
|
|
|
5563
|
-
export { Ivya as I,
|
|
5561
|
+
export { Ivya as I, getByTextSelector as a, getByPlaceholderSelector as b, getByAltTextSelector as c, getByTestIdSelector as d, getByRoleSelector as e, getByLabelSelector as f, getByTitleSelector as g, getElementError as h, getElementLocatorSelectors as i, debug as j, prettyDOM as p };
|
package/dist/state.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const{parse:$parse
|
|
1
|
+
(function(){"use strict";const{parse:$parse}=JSON;const{keys}=Object;const Primitive=String;const primitive="string";const ignore={};const object="object";const noop=(_,value)=>value;const primitives=value=>value instanceof Primitive?Primitive(value):value;const Primitives=(_,value)=>typeof value===primitive?new Primitive(value):value;const revive=(input,parsed,output,$)=>{const lazy=[];for(let ke=keys(output),{length}=ke,y=0;y<length;y++){const k=ke[y];const value=output[k];if(value instanceof Primitive){const tmp=input[value];if(typeof tmp===object&&!parsed.has(tmp)){parsed.add(tmp);output[k]=ignore;lazy.push({k,a:[input,parsed,tmp,$]})}else output[k]=$.call(output,k,tmp)}else if(output[k]!==ignore)output[k]=$.call(output,k,value)}for(let{length}=lazy,i=0;i<length;i++){const{k,a}=lazy[i];output[k]=$.call(output,k,revive.apply(null,a))}return output};const parse=(text,reviver)=>{const input=$parse(text,Primitives).map(primitives);const value=input[0];const $=noop;const tmp=typeof value===object&&value?revive(input,new Set,value,$):value;return $.call({"":tmp},"",tmp)};function getBrowserState(){return window.__vitest_browser_runner__}const config=getBrowserState().config;const sessionId=getBrowserState().sessionId;const providedContext=parse(getBrowserState().providedContext);const state={ctx:{pool:"browser",worker:"./browser.js",workerId:1,config,projectName:config.name||"",files:[],environment:{name:"browser",options:null},providedContext,invalidates:[]},onCancel:null,config,environment:{name:"browser",transformMode:"web",setup(){throw new Error("Not called in the browser")}},moduleCache:getBrowserState().moduleCache,rpc:null,durations:{environment:0,prepare:performance.now()},providedContext};globalThis.__vitest_browser__=true;globalThis.__vitest_worker__=state;getBrowserState().cdp=createCdp();function rpc(){return state.rpc}function createCdp(){const listenersMap=new WeakMap;function getId(listener){const id=listenersMap.get(listener)||crypto.randomUUID();listenersMap.set(listener,id);return id}const listeners={};const cdp={send(method,params){return rpc().sendCdpEvent(sessionId,method,params)},on(event,listener){const listenerId=getId(listener);listeners[event]=listeners[event]||[];listeners[event].push(listener);rpc().trackCdpEvent(sessionId,"on",event,listenerId).catch(error);return cdp},once(event,listener){const listenerId=getId(listener);const handler=data=>{listener(data);cdp.off(event,listener)};listeners[event]=listeners[event]||[];listeners[event].push(handler);rpc().trackCdpEvent(sessionId,"once",event,listenerId).catch(error);return cdp},off(event,listener){const listenerId=getId(listener);if(listeners[event]){listeners[event]=listeners[event].filter(l=>l!==listener)}rpc().trackCdpEvent(sessionId,"off",event,listenerId).catch(error);return cdp},emit(event,payload){if(listeners[event]){listeners[event].forEach(l=>{try{l(payload)}catch(err){error(err)}})}}};return cdp}function error(err){window.dispatchEvent(new ErrorEvent("error",{error:err}))}})();
|
package/dist/utils.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '@vitest/browser/context';
|
|
2
|
-
export { j as debug, h as getElementError, i as getElementLocatorSelectors, p as prettyDOM } from './public-utils-
|
|
2
|
+
export { j as debug, h as getElementError, i as getElementLocatorSelectors, p as prettyDOM } from './public-utils-J4vwTaki.js';
|
|
3
3
|
import 'vitest/utils';
|
|
@@ -186,16 +186,25 @@ class WebdriverBrowserProvider {
|
|
|
186
186
|
this.browserName = browser;
|
|
187
187
|
this.options = options;
|
|
188
188
|
}
|
|
189
|
-
async
|
|
189
|
+
async switchToTestFrame() {
|
|
190
190
|
const page = this.browser;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
191
|
+
if (page.switchFrame) {
|
|
192
|
+
await page.switchFrame(page.$("iframe[data-vitest]"));
|
|
193
|
+
} else {
|
|
194
|
+
const iframe = await page.findElement(
|
|
195
|
+
"css selector",
|
|
196
|
+
"iframe[data-vitest]"
|
|
197
|
+
);
|
|
198
|
+
await page.switchToFrame(iframe);
|
|
199
|
+
}
|
|
196
200
|
}
|
|
197
|
-
async
|
|
198
|
-
|
|
201
|
+
async switchToMainFrame() {
|
|
202
|
+
const page = this.browser;
|
|
203
|
+
if (page.switchFrame) {
|
|
204
|
+
await page.switchFrame(null);
|
|
205
|
+
} else {
|
|
206
|
+
await page.switchToParentFrame();
|
|
207
|
+
}
|
|
199
208
|
}
|
|
200
209
|
getCommandsContext() {
|
|
201
210
|
return {
|
package/dummy.js
ADDED
|
File without changes
|