@vitest/browser 3.0.0-beta.4 → 3.0.1
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/dist/client/.vite/manifest.json +6 -6
- package/dist/client/__vitest__/assets/index-D9z-wtyx.js +52 -0
- package/dist/client/__vitest__/assets/index-GEF0wBOB.css +1 -0
- package/dist/client/__vitest__/index.html +2 -2
- package/dist/client/__vitest_browser__/{orchestrator-Cv-bzUFk.js → orchestrator-vOivV83Y.js} +1 -1
- package/dist/client/__vitest_browser__/{tester-DreAh6ar.js → tester-COSVU_mu.js} +37 -41
- package/dist/client/__vitest_browser__/{utils-CaCTRFti.js → utils-Owv5OOOf.js} +0 -2
- package/dist/client/esm-client-injector.js +1 -0
- package/dist/client/orchestrator.html +2 -2
- package/dist/client/tester/tester.html +2 -2
- package/dist/client.js +5 -4
- package/dist/context.js +2 -2
- package/dist/{index-Dos_sf7B.js → index--cbQOwRJ.js} +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js +149 -178
- 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-D6S2-5kI.js → public-utils-DldpEzVw.js} +99 -99
- package/dist/utils.js +1 -1
- package/dist/{webdriver-dkCg9pjp.js → webdriver-kh_HHy0p.js} +4 -0
- package/package.json +11 -11
- package/dist/client/__vitest__/assets/index-BC8TFRpg.js +0 -52
- package/dist/client/__vitest__/assets/index-D1v_Nqq1.css +0 -1
|
@@ -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 === undefined) {
|
|
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 === undefined) {
|
|
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 === undefined) {
|
|
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 === undefined) {
|
|
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 || undefined, 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 !== undefined) {
|
|
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 = undefined;
|
|
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(undefined);
|
|
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) : undefined;
|
|
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 ? undefined : 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", undefined],
|
|
1801
|
+
["aria-busy", undefined],
|
|
1802
|
+
["aria-controls", undefined],
|
|
1803
|
+
["aria-current", undefined],
|
|
1804
|
+
["aria-describedby", undefined],
|
|
1805
|
+
["aria-details", undefined],
|
|
1806
1806
|
// Global use deprecated in ARIA 1.2
|
|
1807
1807
|
// ['aria-disabled', undefined],
|
|
1808
|
-
["aria-dropeffect",
|
|
1808
|
+
["aria-dropeffect", undefined],
|
|
1809
1809
|
// Global use deprecated in ARIA 1.2
|
|
1810
1810
|
// ['aria-errormessage', undefined],
|
|
1811
|
-
["aria-flowto",
|
|
1812
|
-
["aria-grabbed",
|
|
1811
|
+
["aria-flowto", undefined],
|
|
1812
|
+
["aria-grabbed", undefined],
|
|
1813
1813
|
// Global use deprecated in ARIA 1.2
|
|
1814
1814
|
// ['aria-haspopup', undefined],
|
|
1815
|
-
["aria-hidden",
|
|
1815
|
+
["aria-hidden", undefined],
|
|
1816
1816
|
// Global use deprecated in ARIA 1.2
|
|
1817
1817
|
// ['aria-invalid', undefined],
|
|
1818
|
-
["aria-keyshortcuts",
|
|
1818
|
+
["aria-keyshortcuts", undefined],
|
|
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", undefined],
|
|
1852
|
+
["aria-owns", undefined],
|
|
1853
|
+
["aria-relevant", undefined],
|
|
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 ? undefined : 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 ? undefined : _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 ? undefined : 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 ? undefined : 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 ? undefined : cacheIsHidden.get(element);
|
|
2179
|
+
if (hidden === undefined) {
|
|
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 ? undefined : 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 ? undefined : cache.has(element)) {
|
|
2239
|
+
return (cache == null ? undefined : 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 ? undefined : cache.get(element);
|
|
2322
|
+
if (accessibleName === undefined) {
|
|
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: undefined,
|
|
2348
|
+
embeddedInLabelledBy: undefined,
|
|
2349
|
+
embeddedInLabel: undefined,
|
|
2350
|
+
embeddedInNativeTextAlternative: undefined,
|
|
2351
2351
|
embeddedInTargetElement: "self"
|
|
2352
2352
|
})
|
|
2353
2353
|
);
|
|
2354
2354
|
}
|
|
2355
|
-
cache == null ?
|
|
2355
|
+
cache == null ? undefined : 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 ? undefined : _a.hidden) && !((_b = options.embeddedInDescribedBy) == null ? undefined : _b.hidden) && !((_c = options == null ? undefined : options.embeddedInNativeTextAlternative) == null ? undefined : _c.hidden) && !((_d = options == null ? undefined : options.embeddedInLabel) == null ? undefined : _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: undefined,
|
|
2382
2382
|
embeddedInTargetElement: "none",
|
|
2383
|
-
embeddedInLabel:
|
|
2384
|
-
embeddedInNativeTextAlternative:
|
|
2383
|
+
embeddedInLabel: undefined,
|
|
2384
|
+
embeddedInNativeTextAlternative: undefined
|
|
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 ? undefined : _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: undefined,
|
|
2856
|
+
embeddedInLabelledBy: undefined,
|
|
2857
|
+
embeddedInDescribedBy: undefined,
|
|
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 = undefined;
|
|
2879
|
+
cacheAccessibleNameHidden = undefined;
|
|
2880
|
+
cacheIsHidden = undefined;
|
|
2881
|
+
cachePseudoContentBefore = undefined;
|
|
2882
|
+
cachePseudoContentAfter = undefined;
|
|
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 === undefined) {
|
|
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 !== undefined && getAriaSelected(element) !== options.selected) {
|
|
3125
3125
|
return;
|
|
3126
3126
|
}
|
|
3127
|
-
if (options.checked !==
|
|
3127
|
+
if (options.checked !== undefined && getAriaChecked(element) !== options.checked) {
|
|
3128
3128
|
return;
|
|
3129
3129
|
}
|
|
3130
|
-
if (options.pressed !==
|
|
3130
|
+
if (options.pressed !== undefined && getAriaPressed(element) !== options.pressed) {
|
|
3131
3131
|
return;
|
|
3132
3132
|
}
|
|
3133
|
-
if (options.expanded !==
|
|
3133
|
+
if (options.expanded !== undefined && getAriaExpanded(element) !== options.expanded) {
|
|
3134
3134
|
return;
|
|
3135
3135
|
}
|
|
3136
|
-
if (options.level !==
|
|
3136
|
+
if (options.level !== undefined && getAriaLevel(element) !== options.level) {
|
|
3137
3137
|
return;
|
|
3138
3138
|
}
|
|
3139
|
-
if (options.disabled !==
|
|
3139
|
+
if (options.disabled !== undefined && 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 !== undefined) {
|
|
3149
3149
|
const accessibleName = normalizeWhiteSpace(
|
|
3150
3150
|
getElementAccessibleName(element, !!options.includeHidden)
|
|
3151
3151
|
);
|
|
@@ -3471,10 +3471,10 @@ var JavaScriptLocatorFactory = class {
|
|
|
3471
3471
|
generateLocator(base, kind, body, options = {}) {
|
|
3472
3472
|
switch (kind) {
|
|
3473
3473
|
case "default":
|
|
3474
|
-
if (options.hasText !==
|
|
3474
|
+
if (options.hasText !== undefined) {
|
|
3475
3475
|
return `locator(${this.quote(body)}, { hasText: ${this.toHasText(options.hasText)} })`;
|
|
3476
3476
|
}
|
|
3477
|
-
if (options.hasNotText !==
|
|
3477
|
+
if (options.hasNotText !== undefined) {
|
|
3478
3478
|
return `locator(${this.quote(body)}, { hasNotText: ${this.toHasText(options.hasNotText)} })`;
|
|
3479
3479
|
}
|
|
3480
3480
|
return `locator(${this.quote(body)})`;
|
|
@@ -3685,7 +3685,7 @@ function generateSelectorFor(injectedScript, targetElement, options) {
|
|
|
3685
3685
|
const calculateCached = (element, allowText) => {
|
|
3686
3686
|
const cache = allowText ? cacheAllowText : cacheDisallowText;
|
|
3687
3687
|
let value = cache.get(element);
|
|
3688
|
-
if (value ===
|
|
3688
|
+
if (value === undefined) {
|
|
3689
3689
|
value = calculate(element, allowText);
|
|
3690
3690
|
cache.set(element, value);
|
|
3691
3691
|
}
|
|
@@ -3962,7 +3962,7 @@ function cssFallback(injectedScript, targetElement, options) {
|
|
|
3962
3962
|
const selector = path.join(" > ");
|
|
3963
3963
|
const parsedSelector = injectedScript.parseSelector(selector);
|
|
3964
3964
|
const node = injectedScript.querySelector(parsedSelector, root, false);
|
|
3965
|
-
return node === targetElement ? selector :
|
|
3965
|
+
return node === targetElement ? selector : undefined;
|
|
3966
3966
|
}
|
|
3967
3967
|
function makeStrict(selector) {
|
|
3968
3968
|
const token = { engine: "css", selector, score: kCSSFallbackScore };
|
|
@@ -4162,34 +4162,34 @@ function suitableTextAlternatives(text) {
|
|
|
4162
4162
|
// src/layoutSelectorUtils.ts
|
|
4163
4163
|
function boxRightOf(box1, box2, maxDistance) {
|
|
4164
4164
|
const distance = box1.left - box2.right;
|
|
4165
|
-
if (distance < 0 || maxDistance !==
|
|
4165
|
+
if (distance < 0 || maxDistance !== undefined && distance > maxDistance) {
|
|
4166
4166
|
return;
|
|
4167
4167
|
}
|
|
4168
4168
|
return distance + Math.max(box2.bottom - box1.bottom, 0) + Math.max(box1.top - box2.top, 0);
|
|
4169
4169
|
}
|
|
4170
4170
|
function boxLeftOf(box1, box2, maxDistance) {
|
|
4171
4171
|
const distance = box2.left - box1.right;
|
|
4172
|
-
if (distance < 0 || maxDistance !==
|
|
4172
|
+
if (distance < 0 || maxDistance !== undefined && distance > maxDistance) {
|
|
4173
4173
|
return;
|
|
4174
4174
|
}
|
|
4175
4175
|
return distance + Math.max(box2.bottom - box1.bottom, 0) + Math.max(box1.top - box2.top, 0);
|
|
4176
4176
|
}
|
|
4177
4177
|
function boxAbove(box1, box2, maxDistance) {
|
|
4178
4178
|
const distance = box2.top - box1.bottom;
|
|
4179
|
-
if (distance < 0 || maxDistance !==
|
|
4179
|
+
if (distance < 0 || maxDistance !== undefined && distance > maxDistance) {
|
|
4180
4180
|
return;
|
|
4181
4181
|
}
|
|
4182
4182
|
return distance + Math.max(box1.left - box2.left, 0) + Math.max(box2.right - box1.right, 0);
|
|
4183
4183
|
}
|
|
4184
4184
|
function boxBelow(box1, box2, maxDistance) {
|
|
4185
4185
|
const distance = box1.top - box2.bottom;
|
|
4186
|
-
if (distance < 0 || maxDistance !==
|
|
4186
|
+
if (distance < 0 || maxDistance !== undefined && distance > maxDistance) {
|
|
4187
4187
|
return;
|
|
4188
4188
|
}
|
|
4189
4189
|
return distance + Math.max(box1.left - box2.left, 0) + Math.max(box2.right - box1.right, 0);
|
|
4190
4190
|
}
|
|
4191
4191
|
function boxNear(box1, box2, maxDistance) {
|
|
4192
|
-
const kThreshold = maxDistance ===
|
|
4192
|
+
const kThreshold = maxDistance === undefined ? 50 : maxDistance;
|
|
4193
4193
|
let score = 0;
|
|
4194
4194
|
if (box1.left - box2.right >= 0) {
|
|
4195
4195
|
score += box1.left - box2.right;
|
|
@@ -4203,7 +4203,7 @@ function boxNear(box1, box2, maxDistance) {
|
|
|
4203
4203
|
if (box1.top - box2.bottom >= 0) {
|
|
4204
4204
|
score += box1.top - box2.bottom;
|
|
4205
4205
|
}
|
|
4206
|
-
return score > kThreshold ?
|
|
4206
|
+
return score > kThreshold ? undefined : score;
|
|
4207
4207
|
}
|
|
4208
4208
|
var kLayoutSelectorNames = [
|
|
4209
4209
|
"left-of",
|
|
@@ -4227,10 +4227,10 @@ function layoutSelectorScore(name, element, inner, maxDistance) {
|
|
|
4227
4227
|
continue;
|
|
4228
4228
|
}
|
|
4229
4229
|
const score = scorer(box, e.getBoundingClientRect(), maxDistance);
|
|
4230
|
-
if (score ===
|
|
4230
|
+
if (score === undefined) {
|
|
4231
4231
|
continue;
|
|
4232
4232
|
}
|
|
4233
|
-
if (bestScore ===
|
|
4233
|
+
if (bestScore === undefined || score < bestScore) {
|
|
4234
4234
|
bestScore = score;
|
|
4235
4235
|
}
|
|
4236
4236
|
}
|
|
@@ -4470,15 +4470,15 @@ var SelectorEvaluatorImpl = class {
|
|
|
4470
4470
|
let css = simple.css;
|
|
4471
4471
|
const funcs = simple.functions;
|
|
4472
4472
|
if (css === "*" && funcs.length) {
|
|
4473
|
-
css =
|
|
4473
|
+
css = undefined;
|
|
4474
4474
|
}
|
|
4475
4475
|
let elements;
|
|
4476
4476
|
let firstIndex = -1;
|
|
4477
|
-
if (css !==
|
|
4477
|
+
if (css !== undefined) {
|
|
4478
4478
|
elements = this._queryCSS(context, css);
|
|
4479
4479
|
} else {
|
|
4480
4480
|
firstIndex = funcs.findIndex(
|
|
4481
|
-
(func) => this._getEngine(func.name).query !==
|
|
4481
|
+
(func) => this._getEngine(func.name).query !== undefined
|
|
4482
4482
|
);
|
|
4483
4483
|
if (firstIndex === -1) {
|
|
4484
4484
|
firstIndex = 0;
|
|
@@ -4494,7 +4494,7 @@ var SelectorEvaluatorImpl = class {
|
|
|
4494
4494
|
continue;
|
|
4495
4495
|
}
|
|
4496
4496
|
const engine = this._getEngine(funcs[i].name);
|
|
4497
|
-
if (engine.matches !==
|
|
4497
|
+
if (engine.matches !== undefined) {
|
|
4498
4498
|
elements = elements.filter(
|
|
4499
4499
|
(e) => this._matchesEngine(engine, e, funcs[i].args, context)
|
|
4500
4500
|
);
|
|
@@ -4505,7 +4505,7 @@ var SelectorEvaluatorImpl = class {
|
|
|
4505
4505
|
continue;
|
|
4506
4506
|
}
|
|
4507
4507
|
const engine = this._getEngine(funcs[i].name);
|
|
4508
|
-
if (engine.matches ===
|
|
4508
|
+
if (engine.matches === undefined) {
|
|
4509
4509
|
elements = elements.filter(
|
|
4510
4510
|
(e) => this._matchesEngine(engine, e, funcs[i].args, context)
|
|
4511
4511
|
);
|
|
@@ -4783,7 +4783,7 @@ var textMatchesEngine = {
|
|
|
4783
4783
|
`"text-matches" engine expects a regexp body and optional regexp flags`
|
|
4784
4784
|
);
|
|
4785
4785
|
}
|
|
4786
|
-
const re = new RegExp(args[0], args.length === 2 ? args[1] :
|
|
4786
|
+
const re = new RegExp(args[0], args.length === 2 ? args[1] : undefined);
|
|
4787
4787
|
const matcher = (elementText2) => re.test(elementText2.full);
|
|
4788
4788
|
return elementMatchesText(
|
|
4789
4789
|
evaluator._cacheText,
|
|
@@ -4810,16 +4810,16 @@ var hasTextEngine = {
|
|
|
4810
4810
|
function createLayoutEngine(name) {
|
|
4811
4811
|
return {
|
|
4812
4812
|
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 ===
|
|
4813
|
+
const maxDistance = args.length && typeof args[args.length - 1] === "number" ? args[args.length - 1] : undefined;
|
|
4814
|
+
const queryArgs = maxDistance === undefined ? args : args.slice(0, args.length - 1);
|
|
4815
|
+
if (args.length < 1 + (maxDistance === undefined ? 0 : 1)) {
|
|
4816
4816
|
throw new Error(
|
|
4817
4817
|
`"${name}" engine expects a selector list and optional maximum distance in pixels`
|
|
4818
4818
|
);
|
|
4819
4819
|
}
|
|
4820
4820
|
const inner = evaluator.query(context, queryArgs);
|
|
4821
4821
|
const score = layoutSelectorScore(name, element, inner, maxDistance);
|
|
4822
|
-
if (score ===
|
|
4822
|
+
if (score === undefined) {
|
|
4823
4823
|
return false;
|
|
4824
4824
|
}
|
|
4825
4825
|
evaluator._markScore(element, score);
|
|
@@ -4854,7 +4854,7 @@ function parentElementOrShadowHostInContext(element, context) {
|
|
|
4854
4854
|
return;
|
|
4855
4855
|
}
|
|
4856
4856
|
if (!context.pierceShadow) {
|
|
4857
|
-
return element.parentElement ||
|
|
4857
|
+
return element.parentElement || undefined;
|
|
4858
4858
|
}
|
|
4859
4859
|
return parentElementOrShadowHost(element);
|
|
4860
4860
|
}
|
|
@@ -4862,7 +4862,7 @@ function previousSiblingInContext(element, context) {
|
|
|
4862
4862
|
if (element === context.scope) {
|
|
4863
4863
|
return;
|
|
4864
4864
|
}
|
|
4865
|
-
return element.previousElementSibling ||
|
|
4865
|
+
return element.previousElementSibling || undefined;
|
|
4866
4866
|
}
|
|
4867
4867
|
function sortInDOMOrder(elements) {
|
|
4868
4868
|
const elementToEntry = /* @__PURE__ */ new Map();
|
|
@@ -5063,7 +5063,7 @@ var _Ivya = class _Ivya {
|
|
|
5063
5063
|
);
|
|
5064
5064
|
}
|
|
5065
5065
|
querySelectorAll(selector, root) {
|
|
5066
|
-
if (selector.capture !==
|
|
5066
|
+
if (selector.capture !== undefined) {
|
|
5067
5067
|
if (selector.parts.some((part) => part.name === "nth")) {
|
|
5068
5068
|
throw this.createStacklessError(
|
|
5069
5069
|
`Can't query n-th element in a request with the capture.`
|
|
@@ -5088,7 +5088,7 @@ var _Ivya = class _Ivya {
|
|
|
5088
5088
|
if (!root.querySelectorAll) {
|
|
5089
5089
|
throw this.createStacklessError("Node is not queryable.");
|
|
5090
5090
|
}
|
|
5091
|
-
if (selector.capture !==
|
|
5091
|
+
if (selector.capture !== undefined) {
|
|
5092
5092
|
throw this.createStacklessError(
|
|
5093
5093
|
"Internal error: there should not be a capture in the selector."
|
|
5094
5094
|
);
|
|
@@ -5158,7 +5158,7 @@ var _Ivya = class _Ivya {
|
|
|
5158
5158
|
const inner = this.querySelectorAll(body.parsed, originalRoot);
|
|
5159
5159
|
for (const element of elements) {
|
|
5160
5160
|
const score = layoutSelectorScore(name, element, inner, body.distance);
|
|
5161
|
-
if (score !==
|
|
5161
|
+
if (score !== undefined) {
|
|
5162
5162
|
result.push({ element, score });
|
|
5163
5163
|
}
|
|
5164
5164
|
}
|
|
@@ -5462,13 +5462,13 @@ var XPathEngine = {
|
|
|
5462
5462
|
|
|
5463
5463
|
// src/locatorUtils.ts
|
|
5464
5464
|
function getByAttributeTextSelector(attrName, text, options) {
|
|
5465
|
-
return `internal:attr=[${attrName}=${escapeForAttributeSelector(text, (options == null ?
|
|
5465
|
+
return `internal:attr=[${attrName}=${escapeForAttributeSelector(text, (options == null ? undefined : options.exact) || false)}]`;
|
|
5466
5466
|
}
|
|
5467
5467
|
function getByTestIdSelector(testIdAttributeName, testId) {
|
|
5468
5468
|
return `internal:testid=[${testIdAttributeName}=${escapeForAttributeSelector(testId, true)}]`;
|
|
5469
5469
|
}
|
|
5470
5470
|
function getByLabelSelector(text, options) {
|
|
5471
|
-
return `internal:label=${escapeForTextSelector(text, !!(options == null ?
|
|
5471
|
+
return `internal:label=${escapeForTextSelector(text, !!(options == null ? undefined : options.exact))}`;
|
|
5472
5472
|
}
|
|
5473
5473
|
function getByAltTextSelector(text, options) {
|
|
5474
5474
|
return getByAttributeTextSelector("alt", text, options);
|
|
@@ -5480,32 +5480,32 @@ function getByPlaceholderSelector(text, options) {
|
|
|
5480
5480
|
return getByAttributeTextSelector("placeholder", text, options);
|
|
5481
5481
|
}
|
|
5482
5482
|
function getByTextSelector(text, options) {
|
|
5483
|
-
return `internal:text=${escapeForTextSelector(text, !!(options == null ?
|
|
5483
|
+
return `internal:text=${escapeForTextSelector(text, !!(options == null ? undefined : options.exact))}`;
|
|
5484
5484
|
}
|
|
5485
5485
|
function getByRoleSelector(role, options = {}) {
|
|
5486
5486
|
const props = [];
|
|
5487
|
-
if (options.checked !==
|
|
5487
|
+
if (options.checked !== undefined) {
|
|
5488
5488
|
props.push(["checked", String(options.checked)]);
|
|
5489
5489
|
}
|
|
5490
|
-
if (options.disabled !==
|
|
5490
|
+
if (options.disabled !== undefined) {
|
|
5491
5491
|
props.push(["disabled", String(options.disabled)]);
|
|
5492
5492
|
}
|
|
5493
|
-
if (options.selected !==
|
|
5493
|
+
if (options.selected !== undefined) {
|
|
5494
5494
|
props.push(["selected", String(options.selected)]);
|
|
5495
5495
|
}
|
|
5496
|
-
if (options.expanded !==
|
|
5496
|
+
if (options.expanded !== undefined) {
|
|
5497
5497
|
props.push(["expanded", String(options.expanded)]);
|
|
5498
5498
|
}
|
|
5499
|
-
if (options.includeHidden !==
|
|
5499
|
+
if (options.includeHidden !== undefined) {
|
|
5500
5500
|
props.push(["include-hidden", String(options.includeHidden)]);
|
|
5501
5501
|
}
|
|
5502
|
-
if (options.level !==
|
|
5502
|
+
if (options.level !== undefined) {
|
|
5503
5503
|
props.push(["level", String(options.level)]);
|
|
5504
5504
|
}
|
|
5505
|
-
if (options.name !==
|
|
5505
|
+
if (options.name !== undefined) {
|
|
5506
5506
|
props.push(["name", escapeForAttributeSelector(options.name, !!options.exact)]);
|
|
5507
5507
|
}
|
|
5508
|
-
if (options.pressed !==
|
|
5508
|
+
if (options.pressed !== undefined) {
|
|
5509
5509
|
props.push(["pressed", String(options.pressed)]);
|
|
5510
5510
|
}
|
|
5511
5511
|
return `internal:role=${role}${props.map(([n, v]) => `[${n}=${v}]`).join("")}`;
|
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-DldpEzVw.js';
|
|
3
3
|
import 'vitest/utils';
|
|
@@ -129,6 +129,10 @@ class PlaywrightBrowserProvider {
|
|
|
129
129
|
);
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
+
page.on("crash", () => {
|
|
133
|
+
const session = this.project.vitest._browserSessions.getSession(sessionId);
|
|
134
|
+
session?.reject(new Error("Page crashed when executing tests"));
|
|
135
|
+
});
|
|
132
136
|
return page;
|
|
133
137
|
}
|
|
134
138
|
async openPage(sessionId, url, beforeNavigate) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.1",
|
|
5
5
|
"description": "Browser running for Vitest",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"playwright": "*",
|
|
67
67
|
"webdriverio": "*",
|
|
68
|
-
"vitest": "3.0.
|
|
68
|
+
"vitest": "3.0.1"
|
|
69
69
|
},
|
|
70
70
|
"peerDependenciesMeta": {
|
|
71
71
|
"playwright": {
|
|
@@ -80,14 +80,14 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@testing-library/dom": "^10.4.0",
|
|
83
|
-
"@testing-library/user-event": "^14.
|
|
83
|
+
"@testing-library/user-event": "^14.6.0",
|
|
84
84
|
"magic-string": "^0.30.17",
|
|
85
85
|
"msw": "^2.7.0",
|
|
86
86
|
"sirv": "^3.0.0",
|
|
87
|
-
"tinyrainbow": "^
|
|
87
|
+
"tinyrainbow": "^2.0.0",
|
|
88
88
|
"ws": "^8.18.0",
|
|
89
|
-
"@vitest/mocker": "3.0.
|
|
90
|
-
"@vitest/utils": "3.0.
|
|
89
|
+
"@vitest/mocker": "3.0.1",
|
|
90
|
+
"@vitest/utils": "3.0.1"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -97,16 +97,16 @@
|
|
|
97
97
|
"flatted": "^3.3.2",
|
|
98
98
|
"ivya": "^1.1.1",
|
|
99
99
|
"mime": "^4.0.6",
|
|
100
|
-
"pathe": "^2.0.
|
|
100
|
+
"pathe": "^2.0.1",
|
|
101
101
|
"periscopic": "^4.0.2",
|
|
102
102
|
"playwright": "^1.49.1",
|
|
103
103
|
"playwright-core": "^1.49.1",
|
|
104
104
|
"safaridriver": "^1.0.0",
|
|
105
105
|
"webdriverio": "^8.41.0",
|
|
106
|
-
"@vitest/
|
|
107
|
-
"@vitest/
|
|
108
|
-
"
|
|
109
|
-
"vitest": "3.0.
|
|
106
|
+
"@vitest/ui": "3.0.1",
|
|
107
|
+
"@vitest/runner": "3.0.1",
|
|
108
|
+
"vitest": "3.0.1",
|
|
109
|
+
"@vitest/ws-client": "3.0.1"
|
|
110
110
|
},
|
|
111
111
|
"scripts": {
|
|
112
112
|
"build": "rimraf dist && pnpm build:node && pnpm build:client",
|