@testspectra/react 1.2.6 → 1.2.8
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/index.js +7 -1
- package/dist/setup.js +24 -24
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -197,6 +197,8 @@ function mockResponseBodyText(body) {
|
|
|
197
197
|
|
|
198
198
|
// ../../core/worker-runtime/src/dsl/selector_resolver.ts
|
|
199
199
|
function parseElementSentinel(selector) {
|
|
200
|
+
const nth = /^(.*)::nth\((-?\d+)\)$/.exec(selector);
|
|
201
|
+
if (nth) return { kind: "nth", base: nth[1], arg: nth[2] };
|
|
200
202
|
const closest = /^(.*)::closest\((.+)\)$/.exec(selector);
|
|
201
203
|
if (closest) return { kind: "closest", base: closest[1], arg: closest[2] };
|
|
202
204
|
const children = /^(.*)::children\((.*)\)$/.exec(selector);
|
|
@@ -429,6 +431,10 @@ function matchesSelector(el, selector) {
|
|
|
429
431
|
function resolveSentinelList(raw, parent) {
|
|
430
432
|
const sentinel = parseElementSentinel(raw);
|
|
431
433
|
if (!sentinel) return void 0;
|
|
434
|
+
if (sentinel.kind === "nth") {
|
|
435
|
+
const el = resolveScopedEl(sentinel.base, Number.parseInt(sentinel.arg, 10));
|
|
436
|
+
return el ? [el] : [];
|
|
437
|
+
}
|
|
432
438
|
const baseTarget = parent ? { selector: sentinel.base, index: null, parent } : sentinel.base;
|
|
433
439
|
const base = resolveScopedEl(baseTarget, null);
|
|
434
440
|
if (sentinel.kind === "parent") return base?.parentElement ? [base.parentElement] : [];
|
|
@@ -740,7 +746,7 @@ var DomDriverBridge = class {
|
|
|
740
746
|
async getText(selector, index = null) {
|
|
741
747
|
const el = resolveScopedEl(selector, index);
|
|
742
748
|
if (!el) return "";
|
|
743
|
-
return el.
|
|
749
|
+
return el.textContent ?? "";
|
|
744
750
|
}
|
|
745
751
|
async getValue(selector, index = null) {
|
|
746
752
|
const el = resolveScopedEl(selector, index);
|