@letsrunit/playwright 0.18.1 → 0.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +704 -175
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/browser.ts +7 -5
- package/src/field/aria-select.ts +117 -13
- package/src/field/calendar.ts +77 -11
- package/src/field/composite-date.ts +121 -0
- package/src/field/composite-select.ts +182 -0
- package/src/field/composite-slider.ts +87 -0
- package/src/field/composite-toggle.ts +49 -0
- package/src/field/date-group.ts +99 -69
- package/src/field/date-text-input.ts +49 -31
- package/src/field/index.ts +17 -8
- package/src/field/native-date.ts +7 -4
- package/src/field/radio-group.ts +74 -12
- package/src/field/slider.ts +9 -4
- package/src/field/toggle.ts +28 -5
- package/src/scrub-html.ts +5 -5
- package/src/suppress-interferences.ts +7 -5
- package/src/wait.ts +22 -8
package/dist/index.js
CHANGED
|
@@ -2535,10 +2535,10 @@ var require_kind_of = __commonJS({
|
|
|
2535
2535
|
if (type === "function") {
|
|
2536
2536
|
return isGeneratorFn(val) ? "generatorfunction" : "function";
|
|
2537
2537
|
}
|
|
2538
|
-
if (
|
|
2538
|
+
if (isArray5(val)) return "array";
|
|
2539
2539
|
if (isBuffer(val)) return "buffer";
|
|
2540
2540
|
if (isArguments(val)) return "arguments";
|
|
2541
|
-
if (
|
|
2541
|
+
if (isDate5(val)) return "date";
|
|
2542
2542
|
if (isError(val)) return "error";
|
|
2543
2543
|
if (isRegexp(val)) return "regexp";
|
|
2544
2544
|
switch (ctorName(val)) {
|
|
@@ -2599,14 +2599,14 @@ var require_kind_of = __commonJS({
|
|
|
2599
2599
|
function ctorName(val) {
|
|
2600
2600
|
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
2601
2601
|
}
|
|
2602
|
-
function
|
|
2602
|
+
function isArray5(val) {
|
|
2603
2603
|
if (Array.isArray) return Array.isArray(val);
|
|
2604
2604
|
return val instanceof Array;
|
|
2605
2605
|
}
|
|
2606
2606
|
function isError(val) {
|
|
2607
2607
|
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
2608
2608
|
}
|
|
2609
|
-
function
|
|
2609
|
+
function isDate5(val) {
|
|
2610
2610
|
if (val instanceof Date) return true;
|
|
2611
2611
|
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
2612
2612
|
}
|
|
@@ -15078,10 +15078,10 @@ var require_cjs = __commonJS({
|
|
|
15078
15078
|
// ../../node_modules/isostring/index.js
|
|
15079
15079
|
var require_isostring = __commonJS({
|
|
15080
15080
|
"../../node_modules/isostring/index.js"(exports, module) {
|
|
15081
|
-
module.exports =
|
|
15081
|
+
module.exports = isDate5;
|
|
15082
15082
|
var isoformat = "^\\d{4}-\\d{2}-\\d{2}((T\\d{2}:\\d{2}(:\\d{2})?)(\\.\\d{1,6})?(Z|(\\+|-)\\d{2}:\\d{2})?)?$";
|
|
15083
15083
|
var matcher = new RegExp(isoformat);
|
|
15084
|
-
function
|
|
15084
|
+
function isDate5(val) {
|
|
15085
15085
|
return typeof val === "string" && matcher.test(val) && !isNaN(Date.parse(val));
|
|
15086
15086
|
}
|
|
15087
15087
|
}
|
|
@@ -18177,7 +18177,7 @@ var require_lodash = __commonJS({
|
|
|
18177
18177
|
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
|
|
18178
18178
|
var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
|
|
18179
18179
|
function lodash(value) {
|
|
18180
|
-
if (isObjectLike(value) && !
|
|
18180
|
+
if (isObjectLike(value) && !isArray5(value) && !(value instanceof LazyWrapper)) {
|
|
18181
18181
|
if (value instanceof LodashWrapper) {
|
|
18182
18182
|
return value;
|
|
18183
18183
|
}
|
|
@@ -18292,7 +18292,7 @@ var require_lodash = __commonJS({
|
|
|
18292
18292
|
return result2;
|
|
18293
18293
|
}
|
|
18294
18294
|
function lazyValue() {
|
|
18295
|
-
var array = this.__wrapped__.value(), dir = this.__dir__, isArr =
|
|
18295
|
+
var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray5(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__);
|
|
18296
18296
|
if (!isArr || !isRight && arrLength == length && takeCount == length) {
|
|
18297
18297
|
return baseWrapperValue(array, this.__actions__);
|
|
18298
18298
|
}
|
|
@@ -18501,7 +18501,7 @@ var require_lodash = __commonJS({
|
|
|
18501
18501
|
Stack.prototype.has = stackHas;
|
|
18502
18502
|
Stack.prototype.set = stackSet;
|
|
18503
18503
|
function arrayLikeKeys(value, inherited) {
|
|
18504
|
-
var isArr =
|
|
18504
|
+
var isArr = isArray5(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
|
|
18505
18505
|
for (var key in value) {
|
|
18506
18506
|
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
18507
18507
|
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
@@ -18596,7 +18596,7 @@ var require_lodash = __commonJS({
|
|
|
18596
18596
|
if (!isObject(value)) {
|
|
18597
18597
|
return value;
|
|
18598
18598
|
}
|
|
18599
|
-
var isArr =
|
|
18599
|
+
var isArr = isArray5(value);
|
|
18600
18600
|
if (isArr) {
|
|
18601
18601
|
result2 = initCloneArray(value);
|
|
18602
18602
|
if (!isDeep) {
|
|
@@ -18793,7 +18793,7 @@ var require_lodash = __commonJS({
|
|
|
18793
18793
|
}
|
|
18794
18794
|
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
18795
18795
|
var result2 = keysFunc(object);
|
|
18796
|
-
return
|
|
18796
|
+
return isArray5(object) ? result2 : arrayPush(result2, symbolsFunc(object));
|
|
18797
18797
|
}
|
|
18798
18798
|
function baseGetTag(value) {
|
|
18799
18799
|
if (value == null) {
|
|
@@ -18876,7 +18876,7 @@ var require_lodash = __commonJS({
|
|
|
18876
18876
|
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
18877
18877
|
}
|
|
18878
18878
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
18879
|
-
var objIsArr =
|
|
18879
|
+
var objIsArr = isArray5(object), othIsArr = isArray5(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
|
|
18880
18880
|
objTag = objTag == argsTag ? objectTag : objTag;
|
|
18881
18881
|
othTag = othTag == argsTag ? objectTag : othTag;
|
|
18882
18882
|
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
@@ -18963,7 +18963,7 @@ var require_lodash = __commonJS({
|
|
|
18963
18963
|
return identity;
|
|
18964
18964
|
}
|
|
18965
18965
|
if (typeof value == "object") {
|
|
18966
|
-
return
|
|
18966
|
+
return isArray5(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
|
|
18967
18967
|
}
|
|
18968
18968
|
return property(value);
|
|
18969
18969
|
}
|
|
@@ -19045,10 +19045,10 @@ var require_lodash = __commonJS({
|
|
|
19045
19045
|
var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
|
|
19046
19046
|
var isCommon = newValue === undefined2;
|
|
19047
19047
|
if (isCommon) {
|
|
19048
|
-
var isArr =
|
|
19048
|
+
var isArr = isArray5(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
|
19049
19049
|
newValue = srcValue;
|
|
19050
19050
|
if (isArr || isBuff || isTyped) {
|
|
19051
|
-
if (
|
|
19051
|
+
if (isArray5(objValue)) {
|
|
19052
19052
|
newValue = objValue;
|
|
19053
19053
|
} else if (isArrayLikeObject(objValue)) {
|
|
19054
19054
|
newValue = copyArray(objValue);
|
|
@@ -19090,7 +19090,7 @@ var require_lodash = __commonJS({
|
|
|
19090
19090
|
function baseOrderBy(collection, iteratees, orders) {
|
|
19091
19091
|
if (iteratees.length) {
|
|
19092
19092
|
iteratees = arrayMap(iteratees, function(iteratee2) {
|
|
19093
|
-
if (
|
|
19093
|
+
if (isArray5(iteratee2)) {
|
|
19094
19094
|
return function(value) {
|
|
19095
19095
|
return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
|
|
19096
19096
|
};
|
|
@@ -19335,7 +19335,7 @@ var require_lodash = __commonJS({
|
|
|
19335
19335
|
if (typeof value == "string") {
|
|
19336
19336
|
return value;
|
|
19337
19337
|
}
|
|
19338
|
-
if (
|
|
19338
|
+
if (isArray5(value)) {
|
|
19339
19339
|
return arrayMap(value, baseToString) + "";
|
|
19340
19340
|
}
|
|
19341
19341
|
if (isSymbol(value)) {
|
|
@@ -19438,7 +19438,7 @@ var require_lodash = __commonJS({
|
|
|
19438
19438
|
return typeof value == "function" ? value : identity;
|
|
19439
19439
|
}
|
|
19440
19440
|
function castPath(value, object) {
|
|
19441
|
-
if (
|
|
19441
|
+
if (isArray5(value)) {
|
|
19442
19442
|
return value;
|
|
19443
19443
|
}
|
|
19444
19444
|
return isKey(value, object) ? [value] : stringToPath(toString2(value));
|
|
@@ -19573,7 +19573,7 @@ var require_lodash = __commonJS({
|
|
|
19573
19573
|
}
|
|
19574
19574
|
function createAggregator(setter, initializer) {
|
|
19575
19575
|
return function(collection, iteratee2) {
|
|
19576
|
-
var func =
|
|
19576
|
+
var func = isArray5(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
|
|
19577
19577
|
return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
|
|
19578
19578
|
};
|
|
19579
19579
|
}
|
|
@@ -19740,7 +19740,7 @@ var require_lodash = __commonJS({
|
|
|
19740
19740
|
}
|
|
19741
19741
|
return function() {
|
|
19742
19742
|
var args = arguments, value = args[0];
|
|
19743
|
-
if (wrapper && args.length == 1 &&
|
|
19743
|
+
if (wrapper && args.length == 1 && isArray5(value)) {
|
|
19744
19744
|
return wrapper.plant(value).value();
|
|
19745
19745
|
}
|
|
19746
19746
|
var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
|
|
@@ -19883,8 +19883,8 @@ var require_lodash = __commonJS({
|
|
|
19883
19883
|
function createRelationalOperation(operator) {
|
|
19884
19884
|
return function(value, other) {
|
|
19885
19885
|
if (!(typeof value == "string" && typeof other == "string")) {
|
|
19886
|
-
value =
|
|
19887
|
-
other =
|
|
19886
|
+
value = toNumber3(value);
|
|
19887
|
+
other = toNumber3(other);
|
|
19888
19888
|
}
|
|
19889
19889
|
return operator(value, other);
|
|
19890
19890
|
};
|
|
@@ -19918,7 +19918,7 @@ var require_lodash = __commonJS({
|
|
|
19918
19918
|
function createRound(methodName) {
|
|
19919
19919
|
var func = Math2[methodName];
|
|
19920
19920
|
return function(number, precision) {
|
|
19921
|
-
number =
|
|
19921
|
+
number = toNumber3(number);
|
|
19922
19922
|
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
|
19923
19923
|
if (precision && nativeIsFinite(number)) {
|
|
19924
19924
|
var pair = (toString2(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
|
|
@@ -20287,7 +20287,7 @@ var require_lodash = __commonJS({
|
|
|
20287
20287
|
return result2;
|
|
20288
20288
|
}
|
|
20289
20289
|
length = object == null ? 0 : object.length;
|
|
20290
|
-
return !!length && isLength(length) && isIndex(key, length) && (
|
|
20290
|
+
return !!length && isLength(length) && isIndex(key, length) && (isArray5(object) || isArguments(object));
|
|
20291
20291
|
}
|
|
20292
20292
|
function initCloneArray(array) {
|
|
20293
20293
|
var length = array.length, result2 = new array.constructor(length);
|
|
@@ -20344,7 +20344,7 @@ var require_lodash = __commonJS({
|
|
|
20344
20344
|
return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
|
|
20345
20345
|
}
|
|
20346
20346
|
function isFlattenable(value) {
|
|
20347
|
-
return
|
|
20347
|
+
return isArray5(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
20348
20348
|
}
|
|
20349
20349
|
function isIndex(value, length) {
|
|
20350
20350
|
var type = typeof value;
|
|
@@ -20362,7 +20362,7 @@ var require_lodash = __commonJS({
|
|
|
20362
20362
|
return false;
|
|
20363
20363
|
}
|
|
20364
20364
|
function isKey(value, object) {
|
|
20365
|
-
if (
|
|
20365
|
+
if (isArray5(value)) {
|
|
20366
20366
|
return false;
|
|
20367
20367
|
}
|
|
20368
20368
|
var type = typeof value;
|
|
@@ -20618,7 +20618,7 @@ var require_lodash = __commonJS({
|
|
|
20618
20618
|
while (index--) {
|
|
20619
20619
|
args[index - 1] = arguments[index];
|
|
20620
20620
|
}
|
|
20621
|
-
return arrayPush(
|
|
20621
|
+
return arrayPush(isArray5(array) ? copyArray(array) : [array], baseFlatten(args, 1));
|
|
20622
20622
|
}
|
|
20623
20623
|
var difference = baseRest(function(array, values2) {
|
|
20624
20624
|
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
|
|
@@ -21069,14 +21069,14 @@ var require_lodash = __commonJS({
|
|
|
21069
21069
|
}
|
|
21070
21070
|
});
|
|
21071
21071
|
function every(collection, predicate, guard) {
|
|
21072
|
-
var func =
|
|
21072
|
+
var func = isArray5(collection) ? arrayEvery : baseEvery;
|
|
21073
21073
|
if (guard && isIterateeCall(collection, predicate, guard)) {
|
|
21074
21074
|
predicate = undefined2;
|
|
21075
21075
|
}
|
|
21076
21076
|
return func(collection, getIteratee(predicate, 3));
|
|
21077
21077
|
}
|
|
21078
21078
|
function filter(collection, predicate) {
|
|
21079
|
-
var func =
|
|
21079
|
+
var func = isArray5(collection) ? arrayFilter : baseFilter;
|
|
21080
21080
|
return func(collection, getIteratee(predicate, 3));
|
|
21081
21081
|
}
|
|
21082
21082
|
var find = createFind(findIndex);
|
|
@@ -21092,11 +21092,11 @@ var require_lodash = __commonJS({
|
|
|
21092
21092
|
return baseFlatten(map(collection, iteratee2), depth);
|
|
21093
21093
|
}
|
|
21094
21094
|
function forEach(collection, iteratee2) {
|
|
21095
|
-
var func =
|
|
21095
|
+
var func = isArray5(collection) ? arrayEach : baseEach;
|
|
21096
21096
|
return func(collection, getIteratee(iteratee2, 3));
|
|
21097
21097
|
}
|
|
21098
21098
|
function forEachRight(collection, iteratee2) {
|
|
21099
|
-
var func =
|
|
21099
|
+
var func = isArray5(collection) ? arrayEachRight : baseEachRight;
|
|
21100
21100
|
return func(collection, getIteratee(iteratee2, 3));
|
|
21101
21101
|
}
|
|
21102
21102
|
var groupBy = createAggregator(function(result2, value, key) {
|
|
@@ -21126,18 +21126,18 @@ var require_lodash = __commonJS({
|
|
|
21126
21126
|
baseAssignValue(result2, key, value);
|
|
21127
21127
|
});
|
|
21128
21128
|
function map(collection, iteratee2) {
|
|
21129
|
-
var func =
|
|
21129
|
+
var func = isArray5(collection) ? arrayMap : baseMap;
|
|
21130
21130
|
return func(collection, getIteratee(iteratee2, 3));
|
|
21131
21131
|
}
|
|
21132
21132
|
function orderBy(collection, iteratees, orders, guard) {
|
|
21133
21133
|
if (collection == null) {
|
|
21134
21134
|
return [];
|
|
21135
21135
|
}
|
|
21136
|
-
if (!
|
|
21136
|
+
if (!isArray5(iteratees)) {
|
|
21137
21137
|
iteratees = iteratees == null ? [] : [iteratees];
|
|
21138
21138
|
}
|
|
21139
21139
|
orders = guard ? undefined2 : orders;
|
|
21140
|
-
if (!
|
|
21140
|
+
if (!isArray5(orders)) {
|
|
21141
21141
|
orders = orders == null ? [] : [orders];
|
|
21142
21142
|
}
|
|
21143
21143
|
return baseOrderBy(collection, iteratees, orders);
|
|
@@ -21148,19 +21148,19 @@ var require_lodash = __commonJS({
|
|
|
21148
21148
|
return [[], []];
|
|
21149
21149
|
});
|
|
21150
21150
|
function reduce(collection, iteratee2, accumulator) {
|
|
21151
|
-
var func =
|
|
21151
|
+
var func = isArray5(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
|
|
21152
21152
|
return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
|
|
21153
21153
|
}
|
|
21154
21154
|
function reduceRight(collection, iteratee2, accumulator) {
|
|
21155
|
-
var func =
|
|
21155
|
+
var func = isArray5(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
|
|
21156
21156
|
return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
|
|
21157
21157
|
}
|
|
21158
21158
|
function reject(collection, predicate) {
|
|
21159
|
-
var func =
|
|
21159
|
+
var func = isArray5(collection) ? arrayFilter : baseFilter;
|
|
21160
21160
|
return func(collection, negate(getIteratee(predicate, 3)));
|
|
21161
21161
|
}
|
|
21162
21162
|
function sample(collection) {
|
|
21163
|
-
var func =
|
|
21163
|
+
var func = isArray5(collection) ? arraySample : baseSample;
|
|
21164
21164
|
return func(collection);
|
|
21165
21165
|
}
|
|
21166
21166
|
function sampleSize(collection, n, guard) {
|
|
@@ -21169,11 +21169,11 @@ var require_lodash = __commonJS({
|
|
|
21169
21169
|
} else {
|
|
21170
21170
|
n = toInteger(n);
|
|
21171
21171
|
}
|
|
21172
|
-
var func =
|
|
21172
|
+
var func = isArray5(collection) ? arraySampleSize : baseSampleSize;
|
|
21173
21173
|
return func(collection, n);
|
|
21174
21174
|
}
|
|
21175
21175
|
function shuffle(collection) {
|
|
21176
|
-
var func =
|
|
21176
|
+
var func = isArray5(collection) ? arrayShuffle : baseShuffle;
|
|
21177
21177
|
return func(collection);
|
|
21178
21178
|
}
|
|
21179
21179
|
function size(collection) {
|
|
@@ -21190,7 +21190,7 @@ var require_lodash = __commonJS({
|
|
|
21190
21190
|
return baseKeys(collection).length;
|
|
21191
21191
|
}
|
|
21192
21192
|
function some(collection, predicate, guard) {
|
|
21193
|
-
var func =
|
|
21193
|
+
var func = isArray5(collection) ? arraySome : baseSome;
|
|
21194
21194
|
if (guard && isIterateeCall(collection, predicate, guard)) {
|
|
21195
21195
|
predicate = undefined2;
|
|
21196
21196
|
}
|
|
@@ -21276,11 +21276,11 @@ var require_lodash = __commonJS({
|
|
|
21276
21276
|
if (typeof func != "function") {
|
|
21277
21277
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
21278
21278
|
}
|
|
21279
|
-
wait =
|
|
21279
|
+
wait = toNumber3(wait) || 0;
|
|
21280
21280
|
if (isObject(options)) {
|
|
21281
21281
|
leading = !!options.leading;
|
|
21282
21282
|
maxing = "maxWait" in options;
|
|
21283
|
-
maxWait = maxing ? nativeMax(
|
|
21283
|
+
maxWait = maxing ? nativeMax(toNumber3(options.maxWait) || 0, wait) : maxWait;
|
|
21284
21284
|
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
21285
21285
|
}
|
|
21286
21286
|
function invokeFunc(time) {
|
|
@@ -21356,7 +21356,7 @@ var require_lodash = __commonJS({
|
|
|
21356
21356
|
return baseDelay(func, 1, args);
|
|
21357
21357
|
});
|
|
21358
21358
|
var delay = baseRest(function(func, wait, args) {
|
|
21359
|
-
return baseDelay(func,
|
|
21359
|
+
return baseDelay(func, toNumber3(wait) || 0, args);
|
|
21360
21360
|
});
|
|
21361
21361
|
function flip(func) {
|
|
21362
21362
|
return createWrap(func, WRAP_FLIP_FLAG);
|
|
@@ -21401,7 +21401,7 @@ var require_lodash = __commonJS({
|
|
|
21401
21401
|
return before(2, func);
|
|
21402
21402
|
}
|
|
21403
21403
|
var overArgs = castRest(function(func, transforms) {
|
|
21404
|
-
transforms = transforms.length == 1 &&
|
|
21404
|
+
transforms = transforms.length == 1 && isArray5(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
|
|
21405
21405
|
var funcsLength = transforms.length;
|
|
21406
21406
|
return baseRest(function(args) {
|
|
21407
21407
|
var index = -1, length = nativeMin(args.length, funcsLength);
|
|
@@ -21468,7 +21468,7 @@ var require_lodash = __commonJS({
|
|
|
21468
21468
|
return [];
|
|
21469
21469
|
}
|
|
21470
21470
|
var value = arguments[0];
|
|
21471
|
-
return
|
|
21471
|
+
return isArray5(value) ? value : [value];
|
|
21472
21472
|
}
|
|
21473
21473
|
function clone(value) {
|
|
21474
21474
|
return baseClone(value, CLONE_SYMBOLS_FLAG);
|
|
@@ -21499,7 +21499,7 @@ var require_lodash = __commonJS({
|
|
|
21499
21499
|
})()) ? baseIsArguments : function(value) {
|
|
21500
21500
|
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
21501
21501
|
};
|
|
21502
|
-
var
|
|
21502
|
+
var isArray5 = Array2.isArray;
|
|
21503
21503
|
var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
|
|
21504
21504
|
function isArrayLike(value) {
|
|
21505
21505
|
return value != null && isLength(value.length) && !isFunction(value);
|
|
@@ -21511,7 +21511,7 @@ var require_lodash = __commonJS({
|
|
|
21511
21511
|
return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
|
|
21512
21512
|
}
|
|
21513
21513
|
var isBuffer = nativeIsBuffer || stubFalse;
|
|
21514
|
-
var
|
|
21514
|
+
var isDate5 = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
|
|
21515
21515
|
function isElement(value) {
|
|
21516
21516
|
return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
|
|
21517
21517
|
}
|
|
@@ -21519,7 +21519,7 @@ var require_lodash = __commonJS({
|
|
|
21519
21519
|
if (value == null) {
|
|
21520
21520
|
return true;
|
|
21521
21521
|
}
|
|
21522
|
-
if (isArrayLike(value) && (
|
|
21522
|
+
if (isArrayLike(value) && (isArray5(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
|
|
21523
21523
|
return !value.length;
|
|
21524
21524
|
}
|
|
21525
21525
|
var tag = getTag(value);
|
|
@@ -21617,7 +21617,7 @@ var require_lodash = __commonJS({
|
|
|
21617
21617
|
}
|
|
21618
21618
|
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
21619
21619
|
function isString(value) {
|
|
21620
|
-
return typeof value == "string" || !
|
|
21620
|
+
return typeof value == "string" || !isArray5(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
|
|
21621
21621
|
}
|
|
21622
21622
|
function isSymbol(value) {
|
|
21623
21623
|
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
@@ -21653,7 +21653,7 @@ var require_lodash = __commonJS({
|
|
|
21653
21653
|
if (!value) {
|
|
21654
21654
|
return value === 0 ? value : 0;
|
|
21655
21655
|
}
|
|
21656
|
-
value =
|
|
21656
|
+
value = toNumber3(value);
|
|
21657
21657
|
if (value === INFINITY || value === -INFINITY) {
|
|
21658
21658
|
var sign = value < 0 ? -1 : 1;
|
|
21659
21659
|
return sign * MAX_INTEGER;
|
|
@@ -21667,7 +21667,7 @@ var require_lodash = __commonJS({
|
|
|
21667
21667
|
function toLength(value) {
|
|
21668
21668
|
return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
|
|
21669
21669
|
}
|
|
21670
|
-
function
|
|
21670
|
+
function toNumber3(value) {
|
|
21671
21671
|
if (typeof value == "number") {
|
|
21672
21672
|
return value;
|
|
21673
21673
|
}
|
|
@@ -21891,7 +21891,7 @@ var require_lodash = __commonJS({
|
|
|
21891
21891
|
var toPairs = createToPairs(keys);
|
|
21892
21892
|
var toPairsIn = createToPairs(keysIn);
|
|
21893
21893
|
function transform(object, iteratee2, accumulator) {
|
|
21894
|
-
var isArr =
|
|
21894
|
+
var isArr = isArray5(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
|
|
21895
21895
|
iteratee2 = getIteratee(iteratee2, 4);
|
|
21896
21896
|
if (accumulator == null) {
|
|
21897
21897
|
var Ctor = object && object.constructor;
|
|
@@ -21930,14 +21930,14 @@ var require_lodash = __commonJS({
|
|
|
21930
21930
|
lower = undefined2;
|
|
21931
21931
|
}
|
|
21932
21932
|
if (upper !== undefined2) {
|
|
21933
|
-
upper =
|
|
21933
|
+
upper = toNumber3(upper);
|
|
21934
21934
|
upper = upper === upper ? upper : 0;
|
|
21935
21935
|
}
|
|
21936
21936
|
if (lower !== undefined2) {
|
|
21937
|
-
lower =
|
|
21937
|
+
lower = toNumber3(lower);
|
|
21938
21938
|
lower = lower === lower ? lower : 0;
|
|
21939
21939
|
}
|
|
21940
|
-
return baseClamp(
|
|
21940
|
+
return baseClamp(toNumber3(number), lower, upper);
|
|
21941
21941
|
}
|
|
21942
21942
|
function inRange(number, start, end) {
|
|
21943
21943
|
start = toFinite(start);
|
|
@@ -21947,7 +21947,7 @@ var require_lodash = __commonJS({
|
|
|
21947
21947
|
} else {
|
|
21948
21948
|
end = toFinite(end);
|
|
21949
21949
|
}
|
|
21950
|
-
number =
|
|
21950
|
+
number = toNumber3(number);
|
|
21951
21951
|
return baseInRange(number, start, end);
|
|
21952
21952
|
}
|
|
21953
21953
|
function random(lower, upper, floating) {
|
|
@@ -22394,7 +22394,7 @@ var require_lodash = __commonJS({
|
|
|
22394
22394
|
return result2;
|
|
22395
22395
|
}
|
|
22396
22396
|
function toPath(value) {
|
|
22397
|
-
if (
|
|
22397
|
+
if (isArray5(value)) {
|
|
22398
22398
|
return arrayMap(value, toKey);
|
|
22399
22399
|
}
|
|
22400
22400
|
return isSymbol(value) ? [value] : copyArray(stringToPath(toString2(value)));
|
|
@@ -22640,13 +22640,13 @@ var require_lodash = __commonJS({
|
|
|
22640
22640
|
lodash.inRange = inRange;
|
|
22641
22641
|
lodash.invoke = invoke;
|
|
22642
22642
|
lodash.isArguments = isArguments;
|
|
22643
|
-
lodash.isArray =
|
|
22643
|
+
lodash.isArray = isArray5;
|
|
22644
22644
|
lodash.isArrayBuffer = isArrayBuffer;
|
|
22645
22645
|
lodash.isArrayLike = isArrayLike;
|
|
22646
22646
|
lodash.isArrayLikeObject = isArrayLikeObject;
|
|
22647
22647
|
lodash.isBoolean = isBoolean;
|
|
22648
22648
|
lodash.isBuffer = isBuffer;
|
|
22649
|
-
lodash.isDate =
|
|
22649
|
+
lodash.isDate = isDate5;
|
|
22650
22650
|
lodash.isElement = isElement;
|
|
22651
22651
|
lodash.isEmpty = isEmpty;
|
|
22652
22652
|
lodash.isEqual = isEqual2;
|
|
@@ -22733,7 +22733,7 @@ var require_lodash = __commonJS({
|
|
|
22733
22733
|
lodash.toInteger = toInteger;
|
|
22734
22734
|
lodash.toLength = toLength;
|
|
22735
22735
|
lodash.toLower = toLower;
|
|
22736
|
-
lodash.toNumber =
|
|
22736
|
+
lodash.toNumber = toNumber3;
|
|
22737
22737
|
lodash.toSafeInteger = toSafeInteger;
|
|
22738
22738
|
lodash.toString = toString2;
|
|
22739
22739
|
lodash.toUpper = toUpper;
|
|
@@ -22852,7 +22852,7 @@ var require_lodash = __commonJS({
|
|
|
22852
22852
|
return;
|
|
22853
22853
|
}
|
|
22854
22854
|
lodash.prototype[methodName] = function() {
|
|
22855
|
-
var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy ||
|
|
22855
|
+
var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray5(value);
|
|
22856
22856
|
var interceptor = function(value2) {
|
|
22857
22857
|
var result3 = lodashFunc.apply(lodash, arrayPush([value2], args));
|
|
22858
22858
|
return isTaker && chainAll ? result3[0] : result3;
|
|
@@ -22880,10 +22880,10 @@ var require_lodash = __commonJS({
|
|
|
22880
22880
|
var args = arguments;
|
|
22881
22881
|
if (retUnwrapped && !this.__chain__) {
|
|
22882
22882
|
var value = this.value();
|
|
22883
|
-
return func.apply(
|
|
22883
|
+
return func.apply(isArray5(value) ? value : [], args);
|
|
22884
22884
|
}
|
|
22885
22885
|
return this[chainName](function(value2) {
|
|
22886
|
-
return func.apply(
|
|
22886
|
+
return func.apply(isArray5(value2) ? value2 : [], args);
|
|
22887
22887
|
});
|
|
22888
22888
|
};
|
|
22889
22889
|
});
|
|
@@ -23198,7 +23198,7 @@ var require_src9 = __commonJS({
|
|
|
23198
23198
|
get,
|
|
23199
23199
|
invoke,
|
|
23200
23200
|
isBoolean,
|
|
23201
|
-
isDate:
|
|
23201
|
+
isDate: isDate5,
|
|
23202
23202
|
isEmpty,
|
|
23203
23203
|
isNumber,
|
|
23204
23204
|
isString,
|
|
@@ -23368,7 +23368,7 @@ var require_src9 = __commonJS({
|
|
|
23368
23368
|
};
|
|
23369
23369
|
var getISODate = (date2) => date2 && !Number.isNaN(date2.getTime()) ? date2.toISOString() : void 0;
|
|
23370
23370
|
var date = (value) => {
|
|
23371
|
-
if (
|
|
23371
|
+
if (isDate5(value)) return value.toISOString();
|
|
23372
23372
|
if (!(isString(value) || isNumber(value))) return;
|
|
23373
23373
|
if (isString(value)) value = condenseWhitespace(value);
|
|
23374
23374
|
if (isIso(value)) return new Date(value).toISOString();
|
|
@@ -30807,10 +30807,10 @@ var require_extract = __commonJS({
|
|
|
30807
30807
|
const ret = {};
|
|
30808
30808
|
for (const key in map) {
|
|
30809
30809
|
const descr = map[key];
|
|
30810
|
-
const
|
|
30811
|
-
const { selector, value } = getExtractDescr(
|
|
30810
|
+
const isArray5 = Array.isArray(descr);
|
|
30811
|
+
const { selector, value } = getExtractDescr(isArray5 ? descr[0] : descr);
|
|
30812
30812
|
const fn = typeof value === "function" ? value : typeof value === "string" ? (el) => this._make(el).prop(value) : (el) => this._make(el).extract(value);
|
|
30813
|
-
if (
|
|
30813
|
+
if (isArray5) {
|
|
30814
30814
|
ret[key] = this._findBySelector(selector, Number.POSITIVE_INFINITY).map((_, el) => fn(el, key, ret)).get();
|
|
30815
30815
|
} else {
|
|
30816
30816
|
const $ = this._findBySelector(selector, 1);
|
|
@@ -67004,7 +67004,7 @@ async function browse(browser, options = {}) {
|
|
|
67004
67004
|
...options
|
|
67005
67005
|
});
|
|
67006
67006
|
await context.addInitScript(
|
|
67007
|
-
/* v8 ignore next */
|
|
67007
|
+
/* v8 ignore next — callback runs in browser context, not Node */
|
|
67008
67008
|
() => {
|
|
67009
67009
|
window.__name = window.__name || ((fn) => fn);
|
|
67010
67010
|
}
|
|
@@ -67047,6 +67047,104 @@ async function pickFieldElement(elements) {
|
|
|
67047
67047
|
}
|
|
67048
67048
|
return elements;
|
|
67049
67049
|
}
|
|
67050
|
+
|
|
67051
|
+
// src/field/aria-select.ts
|
|
67052
|
+
function cssAttrEquals(name, value) {
|
|
67053
|
+
return `[${name}=${JSON.stringify(value)}]`;
|
|
67054
|
+
}
|
|
67055
|
+
function caseInsensitiveExact(value) {
|
|
67056
|
+
const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
67057
|
+
return new RegExp(`^${escaped}$`, "i");
|
|
67058
|
+
}
|
|
67059
|
+
async function getComboboxRoot(el, options) {
|
|
67060
|
+
const role = await el.getAttribute("role", options).catch(
|
|
67061
|
+
/* v8 ignore next — attribute might be missing or element might have detached during the check */
|
|
67062
|
+
() => null
|
|
67063
|
+
);
|
|
67064
|
+
if (role === "combobox") return el;
|
|
67065
|
+
const byRole = el.locator('[role="combobox"]').first();
|
|
67066
|
+
if (await byRole.count() > 0) return byRole;
|
|
67067
|
+
const popupInput = el.locator("input[aria-controls], input[aria-owns], input[aria-haspopup], textarea[aria-controls], textarea[aria-owns], textarea[aria-haspopup]").first();
|
|
67068
|
+
if (await popupInput.count() > 0) return popupInput;
|
|
67069
|
+
return null;
|
|
67070
|
+
}
|
|
67071
|
+
async function getControlledListbox(el, options) {
|
|
67072
|
+
const ids = [];
|
|
67073
|
+
for (const attr of ["aria-controls", "aria-owns"]) {
|
|
67074
|
+
const raw = await el.getAttribute(attr, options).catch(
|
|
67075
|
+
/* v8 ignore next — attribute might be missing or element might have detached during the check */
|
|
67076
|
+
() => null
|
|
67077
|
+
);
|
|
67078
|
+
if (!raw) continue;
|
|
67079
|
+
ids.push(...raw.split(/\s+/).filter(Boolean));
|
|
67080
|
+
}
|
|
67081
|
+
for (const id of ids) {
|
|
67082
|
+
const listbox = el.page().locator(`[role="listbox"]${cssAttrEquals("id", id)}`).first();
|
|
67083
|
+
if (await listbox.count() > 0) return listbox;
|
|
67084
|
+
}
|
|
67085
|
+
return null;
|
|
67086
|
+
}
|
|
67087
|
+
async function getVisibleListbox(el, options) {
|
|
67088
|
+
const listboxes = el.page().locator('[role="listbox"]:visible');
|
|
67089
|
+
await listboxes.first().waitFor({ state: "visible", timeout: options?.timeout }).catch(() => null);
|
|
67090
|
+
if (await listboxes.count() > 0) return listboxes.first();
|
|
67091
|
+
return null;
|
|
67092
|
+
}
|
|
67093
|
+
async function didSelectionApply(root, option, before, options) {
|
|
67094
|
+
const ariaSelected = await option.getAttribute("aria-selected", options).catch(() => null);
|
|
67095
|
+
if (ariaSelected === "true") return true;
|
|
67096
|
+
const optionId = await option.getAttribute("id", options).catch(() => null);
|
|
67097
|
+
const activeDescendant = await root.getAttribute("aria-activedescendant", options).catch(() => null);
|
|
67098
|
+
if (optionId && activeDescendant === optionId) return true;
|
|
67099
|
+
const after = await root.evaluate((node) => {
|
|
67100
|
+
if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) {
|
|
67101
|
+
return node.value;
|
|
67102
|
+
}
|
|
67103
|
+
return node.textContent?.trim() ?? "";
|
|
67104
|
+
}, options).catch(() => null);
|
|
67105
|
+
if (before !== null && after !== null && after !== before) return true;
|
|
67106
|
+
const listbox = await getVisibleListbox(root, options);
|
|
67107
|
+
if (!listbox) return true;
|
|
67108
|
+
return false;
|
|
67109
|
+
}
|
|
67110
|
+
async function selectAria({ el }, value, options) {
|
|
67111
|
+
if (typeof value !== "string" && typeof value !== "number") return false;
|
|
67112
|
+
const root = await getComboboxRoot(el, options);
|
|
67113
|
+
if (!root) return false;
|
|
67114
|
+
let listbox = await getControlledListbox(root, options);
|
|
67115
|
+
const ariaExpanded = await root.getAttribute("aria-expanded", options).catch(
|
|
67116
|
+
/* v8 ignore next — attribute might be missing or element might have detached during the check */
|
|
67117
|
+
() => null
|
|
67118
|
+
);
|
|
67119
|
+
if (ariaExpanded !== "true") {
|
|
67120
|
+
await root.click(options);
|
|
67121
|
+
listbox = listbox ?? await getControlledListbox(root, options);
|
|
67122
|
+
}
|
|
67123
|
+
listbox = listbox ?? await getVisibleListbox(root, options);
|
|
67124
|
+
if (!listbox) return false;
|
|
67125
|
+
const stringValue = String(value);
|
|
67126
|
+
const before = await root.evaluate((node) => {
|
|
67127
|
+
if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement) {
|
|
67128
|
+
return node.value;
|
|
67129
|
+
}
|
|
67130
|
+
return node.textContent?.trim() ?? "";
|
|
67131
|
+
}, options).catch(() => null);
|
|
67132
|
+
const byValue = listbox.locator(
|
|
67133
|
+
`[role="option"]${cssAttrEquals("value", stringValue)}, [role="option"]${cssAttrEquals("data-value", stringValue)}, [role="option"]${cssAttrEquals("ng-reflect-value", stringValue)}`
|
|
67134
|
+
);
|
|
67135
|
+
if (await byValue.count() >= 1) {
|
|
67136
|
+
const option = byValue.first();
|
|
67137
|
+
await option.click(options);
|
|
67138
|
+
return await didSelectionApply(root, option, before, options);
|
|
67139
|
+
}
|
|
67140
|
+
const byName = listbox.getByRole("option", { name: caseInsensitiveExact(stringValue) });
|
|
67141
|
+
if (await byName.count() >= 1) {
|
|
67142
|
+
const option = byName.first();
|
|
67143
|
+
await option.click(options);
|
|
67144
|
+
return await didSelectionApply(root, option, before, options);
|
|
67145
|
+
}
|
|
67146
|
+
return false;
|
|
67147
|
+
}
|
|
67050
67148
|
function formatDateForInput(date, type) {
|
|
67051
67149
|
const pad = (n) => String(n).padStart(2, "0");
|
|
67052
67150
|
const yyyy = date.getFullYear();
|
|
@@ -67093,7 +67191,7 @@ async function waitForMeta(page, timeout = 2500) {
|
|
|
67093
67191
|
await waitForIdle(page);
|
|
67094
67192
|
page.getByRole("navigation");
|
|
67095
67193
|
await page.waitForFunction(
|
|
67096
|
-
/* v8 ignore start */
|
|
67194
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
67097
67195
|
() => {
|
|
67098
67196
|
const head = document.head;
|
|
67099
67197
|
if (!head) return false;
|
|
@@ -67108,7 +67206,7 @@ async function waitForMeta(page, timeout = 2500) {
|
|
|
67108
67206
|
}
|
|
67109
67207
|
async function waitForDomIdle(page, { quiet = 500, timeout = 1e4 } = {}) {
|
|
67110
67208
|
await page.waitForFunction(
|
|
67111
|
-
/* v8 ignore start */
|
|
67209
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
67112
67210
|
(q) => new Promise((resolve) => {
|
|
67113
67211
|
let last = performance.now();
|
|
67114
67212
|
const obs = new MutationObserver(() => last = performance.now());
|
|
@@ -67135,7 +67233,7 @@ async function waitForDomIdle(page, { quiet = 500, timeout = 1e4 } = {}) {
|
|
|
67135
67233
|
}
|
|
67136
67234
|
async function waitForAnimationsToFinish(root) {
|
|
67137
67235
|
await root.page().waitForFunction(
|
|
67138
|
-
/* v8 ignore start */
|
|
67236
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
67139
67237
|
(el) => {
|
|
67140
67238
|
const animations = el.getAnimations?.({ subtree: true }) ?? [];
|
|
67141
67239
|
return animations.every((a) => a.playState !== "running");
|
|
@@ -67143,12 +67241,15 @@ async function waitForAnimationsToFinish(root) {
|
|
|
67143
67241
|
/* v8 ignore stop */
|
|
67144
67242
|
await root.elementHandle()
|
|
67145
67243
|
);
|
|
67146
|
-
await root.evaluate(
|
|
67244
|
+
await root.evaluate(
|
|
67245
|
+
/* v8 ignore next — callback runs in browser context, not Node */
|
|
67246
|
+
() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())))
|
|
67247
|
+
);
|
|
67147
67248
|
}
|
|
67148
67249
|
async function waitForUrlChange(page, prevUrl, timeout) {
|
|
67149
67250
|
try {
|
|
67150
67251
|
await page.waitForFunction(
|
|
67151
|
-
/* v8 ignore next */
|
|
67252
|
+
/* v8 ignore next — callback runs in browser context, not Node */
|
|
67152
67253
|
(u) => location.href !== u,
|
|
67153
67254
|
prevUrl,
|
|
67154
67255
|
{ timeout }
|
|
@@ -67164,7 +67265,7 @@ async function waitUntilEnabled(page, target, timeout) {
|
|
|
67164
67265
|
const handle = await target.elementHandle().catch(() => null);
|
|
67165
67266
|
if (!handle) return;
|
|
67166
67267
|
await page.waitForFunction(
|
|
67167
|
-
/* v8 ignore start */
|
|
67268
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
67168
67269
|
(el) => {
|
|
67169
67270
|
if (!el || !el.isConnected) return true;
|
|
67170
67271
|
const aria = el.getAttribute("aria-disabled");
|
|
@@ -67219,7 +67320,7 @@ async function elementKind(target) {
|
|
|
67219
67320
|
if (role === "link") return "link";
|
|
67220
67321
|
if (role === "button") return "button";
|
|
67221
67322
|
const tag = await target.evaluate(
|
|
67222
|
-
/* v8 ignore next */
|
|
67323
|
+
/* v8 ignore next — callback runs in browser context, not Node */
|
|
67223
67324
|
(el) => el.tagName.toLowerCase(),
|
|
67224
67325
|
null,
|
|
67225
67326
|
{ timeout: PROBE }
|
|
@@ -67256,12 +67357,33 @@ async function isCalendarGrid(grid) {
|
|
|
67256
67357
|
const last = days.reduce((max, cur) => cur === max + 1 ? cur : max, 0);
|
|
67257
67358
|
return last >= 28;
|
|
67258
67359
|
}
|
|
67360
|
+
function isDayToken(text) {
|
|
67361
|
+
const day = Number(text.trim());
|
|
67362
|
+
return Number.isInteger(day) && day >= 1 && day <= 31;
|
|
67363
|
+
}
|
|
67364
|
+
async function isStructuralCalendar(root) {
|
|
67365
|
+
const candidates = root.locator('button, [role="button"], [tabindex], div, span').filter({ visible: true });
|
|
67366
|
+
const count = await candidates.count();
|
|
67367
|
+
if (count < 28) return false;
|
|
67368
|
+
const tokens = (await candidates.allInnerTexts()).map((text) => text.trim()).filter(isDayToken);
|
|
67369
|
+
if (tokens.length < 28 || tokens.length > 120) return false;
|
|
67370
|
+
const daySet = new Set(tokens.map(Number));
|
|
67371
|
+
const hasStart = [1, 2, 3, 4, 5, 6, 7].some((day) => daySet.has(day));
|
|
67372
|
+
const hasMiddle = [22, 23, 24, 25, 26, 27, 28].some((day) => daySet.has(day));
|
|
67373
|
+
return daySet.size >= 28 && hasStart && hasMiddle;
|
|
67374
|
+
}
|
|
67375
|
+
function dayCellSelector(hasGridCells) {
|
|
67376
|
+
return hasGridCells ? 'td, [role="gridcell"]' : 'button, [role="button"], [tabindex], div, span';
|
|
67377
|
+
}
|
|
67259
67378
|
async function getCalendar(root, options) {
|
|
67260
67379
|
const gridSelector = 'table, [role="grid"]';
|
|
67261
67380
|
let container = await root.locator(gridSelector).count() > 0 ? root : await getDialog(root, options);
|
|
67262
67381
|
if (!container && await isCalendarGrid(root)) {
|
|
67263
67382
|
return { calendar: root, tables: [root] };
|
|
67264
67383
|
}
|
|
67384
|
+
if (!container && await isStructuralCalendar(root)) {
|
|
67385
|
+
return { calendar: root, tables: [root] };
|
|
67386
|
+
}
|
|
67265
67387
|
if (!container) return null;
|
|
67266
67388
|
const found = await container.locator(gridSelector).all();
|
|
67267
67389
|
const tables = [];
|
|
@@ -67272,7 +67394,13 @@ async function getCalendar(root, options) {
|
|
|
67272
67394
|
}
|
|
67273
67395
|
}
|
|
67274
67396
|
const uniqueTables = tables.filter((t, i, self2) => self2.indexOf(t) === i);
|
|
67275
|
-
|
|
67397
|
+
if (uniqueTables.length > 0) {
|
|
67398
|
+
return { calendar: container, tables: uniqueTables };
|
|
67399
|
+
}
|
|
67400
|
+
if (await isStructuralCalendar(container)) {
|
|
67401
|
+
return { calendar: container, tables: [container] };
|
|
67402
|
+
}
|
|
67403
|
+
return null;
|
|
67276
67404
|
}
|
|
67277
67405
|
function uniqueMonthYearPairs(pairs) {
|
|
67278
67406
|
const map = pairs.reduce(
|
|
@@ -67324,7 +67452,28 @@ async function navigateToMonth(root, target, options) {
|
|
|
67324
67452
|
}
|
|
67325
67453
|
const firstMonthTotal = currentMonths[0].year * 12 + currentMonths[0].month;
|
|
67326
67454
|
const diff = targetTotal - firstMonthTotal;
|
|
67327
|
-
const
|
|
67455
|
+
const prevSelector = [
|
|
67456
|
+
'[aria-label*="prev"]',
|
|
67457
|
+
'[aria-label*="Prev"]',
|
|
67458
|
+
'[aria-label*="previous"]',
|
|
67459
|
+
'[aria-label*="Previous"]',
|
|
67460
|
+
'[class*="prev"]',
|
|
67461
|
+
'[class*="Prev"]',
|
|
67462
|
+
'[title*="prev"]',
|
|
67463
|
+
'[title*="Prev"]',
|
|
67464
|
+
'button:has-text("Previous")',
|
|
67465
|
+
'button:has-text("Prev")'
|
|
67466
|
+
].join(", ");
|
|
67467
|
+
const nextSelector = [
|
|
67468
|
+
'[aria-label*="next"]',
|
|
67469
|
+
'[aria-label*="Next"]',
|
|
67470
|
+
'[class*="next"]',
|
|
67471
|
+
'[class*="Next"]',
|
|
67472
|
+
'[title*="next"]',
|
|
67473
|
+
'[title*="Next"]',
|
|
67474
|
+
'button:has-text("Next")'
|
|
67475
|
+
].join(", ");
|
|
67476
|
+
const btn = diff < 0 ? root.locator(prevSelector).filter({ visible: true }).first() : root.locator(nextSelector).filter({ visible: true }).first();
|
|
67328
67477
|
if (!await btn.count()) return false;
|
|
67329
67478
|
for (let i = 0; i < Math.abs(diff); i++) {
|
|
67330
67479
|
await btn.click(options);
|
|
@@ -67368,13 +67517,22 @@ async function setDayByAriaLabel(table, value, options) {
|
|
|
67368
67517
|
}
|
|
67369
67518
|
async function setDayByByCellText(table, value, options) {
|
|
67370
67519
|
const day = value.getDate();
|
|
67371
|
-
const
|
|
67520
|
+
const gridCells = table.locator('td, [role="gridcell"]').filter({ visible: true });
|
|
67521
|
+
const hasGridCells = await gridCells.count() > 0;
|
|
67522
|
+
const cells = table.locator(dayCellSelector(hasGridCells)).filter({ visible: true });
|
|
67372
67523
|
const allTexts = await cells.allInnerTexts();
|
|
67373
67524
|
const foundIndices = allTexts.map((text, i) => text.trim() === String(day) ? i : -1).filter((i) => i !== -1);
|
|
67374
67525
|
if (foundIndices.length === 0) return false;
|
|
67375
|
-
const
|
|
67376
|
-
|
|
67377
|
-
|
|
67526
|
+
const ordered = foundIndices.length === 1 || day < 15 ? foundIndices : [...foundIndices].reverse();
|
|
67527
|
+
for (const index of ordered) {
|
|
67528
|
+
const cell = cells.nth(index);
|
|
67529
|
+
try {
|
|
67530
|
+
await cell.click(options);
|
|
67531
|
+
return true;
|
|
67532
|
+
} catch {
|
|
67533
|
+
}
|
|
67534
|
+
}
|
|
67535
|
+
return false;
|
|
67378
67536
|
}
|
|
67379
67537
|
async function setDates(calendar, tables, dates, options) {
|
|
67380
67538
|
let method = void 0;
|
|
@@ -67412,6 +67570,341 @@ async function setCalendarDate({ el, tag }, value, options) {
|
|
|
67412
67570
|
}
|
|
67413
67571
|
return true;
|
|
67414
67572
|
}
|
|
67573
|
+
function toDates(value) {
|
|
67574
|
+
if (isRange(value)) return [value.from, value.to];
|
|
67575
|
+
if (isArray(value, isDate)) return value;
|
|
67576
|
+
return [value];
|
|
67577
|
+
}
|
|
67578
|
+
function formatDate2(date, pattern) {
|
|
67579
|
+
const y = date.getFullYear();
|
|
67580
|
+
const m = date.getMonth() + 1;
|
|
67581
|
+
const d = date.getDate();
|
|
67582
|
+
const mm = String(m).padStart(2, "0");
|
|
67583
|
+
const dd = String(d).padStart(2, "0");
|
|
67584
|
+
if (pattern === "iso" || pattern === "ymd") return `${y}-${mm}-${dd}`;
|
|
67585
|
+
if (pattern === "dmy") return `${dd}/${mm}/${y}`;
|
|
67586
|
+
return `${mm}/${dd}/${y}`;
|
|
67587
|
+
}
|
|
67588
|
+
function digits(value) {
|
|
67589
|
+
return (value.match(/\d+/g) ?? []).map((v) => Number.parseInt(v, 10));
|
|
67590
|
+
}
|
|
67591
|
+
function matchesDateLoosely(value, target) {
|
|
67592
|
+
const nums = digits(value);
|
|
67593
|
+
if (nums.length < 3) return false;
|
|
67594
|
+
return nums.includes(target.getFullYear()) && nums.includes(target.getMonth() + 1) && nums.includes(target.getDate());
|
|
67595
|
+
}
|
|
67596
|
+
async function commitInput(input, text, options) {
|
|
67597
|
+
await input.click(options);
|
|
67598
|
+
await input.clear(options);
|
|
67599
|
+
await input.fill(text, options);
|
|
67600
|
+
await input.press("Enter", options).catch(() => null);
|
|
67601
|
+
await input.evaluate((node) => node.blur(), options).catch(() => null);
|
|
67602
|
+
await input.evaluate(() => new Promise(requestAnimationFrame)).catch(() => null);
|
|
67603
|
+
return input.inputValue(options).catch(() => "");
|
|
67604
|
+
}
|
|
67605
|
+
async function setSingleInputDate(input, value, options) {
|
|
67606
|
+
const patterns = ["iso", "dmy", "mdy", "ymd"];
|
|
67607
|
+
for (const pattern of patterns) {
|
|
67608
|
+
const readBack = await commitInput(input, formatDate2(value, pattern), options);
|
|
67609
|
+
if (matchesDateLoosely(readBack, value)) return true;
|
|
67610
|
+
}
|
|
67611
|
+
return false;
|
|
67612
|
+
}
|
|
67613
|
+
async function getDateInputs(el, options) {
|
|
67614
|
+
const rootTag = await el.evaluate((node) => node.tagName.toLowerCase(), options);
|
|
67615
|
+
if (rootTag === "input") return [el];
|
|
67616
|
+
const inputs = el.locator('input[type="text"], input:not([type]), input');
|
|
67617
|
+
const count = await inputs.count();
|
|
67618
|
+
if (count === 0) return [];
|
|
67619
|
+
const result = [];
|
|
67620
|
+
for (let i = 0; i < count; i++) {
|
|
67621
|
+
const candidate = inputs.nth(i);
|
|
67622
|
+
const visible = await candidate.isVisible(options).catch(() => false);
|
|
67623
|
+
if (!visible) continue;
|
|
67624
|
+
result.push(candidate);
|
|
67625
|
+
}
|
|
67626
|
+
return result;
|
|
67627
|
+
}
|
|
67628
|
+
async function asLoc(el, options) {
|
|
67629
|
+
const tag = await el.evaluate((node) => node.tagName.toLowerCase(), options);
|
|
67630
|
+
const type = await el.getAttribute("type", options).then((s) => s && s.toLowerCase()).catch(() => null);
|
|
67631
|
+
return { el, tag, type };
|
|
67632
|
+
}
|
|
67633
|
+
async function getPickerRootFromInput(input) {
|
|
67634
|
+
const picker = input.locator('xpath=ancestor::*[.//input and .//*[@aria-label="calendar"]][1]').first();
|
|
67635
|
+
if (await picker.count() > 0) return picker;
|
|
67636
|
+
return null;
|
|
67637
|
+
}
|
|
67638
|
+
async function setByCalendar(input, date, options) {
|
|
67639
|
+
const picker = await getPickerRootFromInput(input);
|
|
67640
|
+
if (!picker) return false;
|
|
67641
|
+
const pickerLoc = await asLoc(picker, options);
|
|
67642
|
+
return setCalendarDate(pickerLoc, date, options);
|
|
67643
|
+
}
|
|
67644
|
+
async function setCompositeDate({ el }, value, options) {
|
|
67645
|
+
if (!(value instanceof Date) && !isArray(value, isDate) && !isRange(value, isDate)) return false;
|
|
67646
|
+
const dates = toDates(value);
|
|
67647
|
+
const inputs = await getDateInputs(el, options);
|
|
67648
|
+
if (inputs.length === 0) return false;
|
|
67649
|
+
if (dates.length === 1) {
|
|
67650
|
+
const singleInput = await setSingleInputDate(inputs[0], dates[0], options);
|
|
67651
|
+
if (singleInput) return true;
|
|
67652
|
+
return setByCalendar(inputs[0], dates[0], options);
|
|
67653
|
+
}
|
|
67654
|
+
if (inputs.length < 2) return false;
|
|
67655
|
+
const first = await setSingleInputDate(inputs[0], dates[0], options);
|
|
67656
|
+
const second = await setSingleInputDate(inputs[1], dates[1], options);
|
|
67657
|
+
if (first && second) return true;
|
|
67658
|
+
const firstCal = await setByCalendar(inputs[0], dates[0], options);
|
|
67659
|
+
const secondCal = await setByCalendar(inputs[1], dates[1], options);
|
|
67660
|
+
return firstCal && secondCal;
|
|
67661
|
+
}
|
|
67662
|
+
|
|
67663
|
+
// src/field/composite-select.ts
|
|
67664
|
+
function caseInsensitiveExact2(value) {
|
|
67665
|
+
const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
67666
|
+
return new RegExp(`^${escaped}$`, "i");
|
|
67667
|
+
}
|
|
67668
|
+
async function openControl(el, options) {
|
|
67669
|
+
const activator = el.locator('button[aria-haspopup], [role="button"][aria-haspopup], input[readonly]').first();
|
|
67670
|
+
if (await activator.count() > 0) {
|
|
67671
|
+
await activator.click(options);
|
|
67672
|
+
return;
|
|
67673
|
+
}
|
|
67674
|
+
await el.click(options);
|
|
67675
|
+
}
|
|
67676
|
+
function getPopupCandidates(page) {
|
|
67677
|
+
return page.locator(
|
|
67678
|
+
[
|
|
67679
|
+
'[role="listbox"]:visible',
|
|
67680
|
+
'[role="menu"]:visible',
|
|
67681
|
+
'[role="dialog"]:visible',
|
|
67682
|
+
'[role="presentation"]:visible',
|
|
67683
|
+
".cdk-overlay-pane:visible"
|
|
67684
|
+
].join(", ")
|
|
67685
|
+
);
|
|
67686
|
+
}
|
|
67687
|
+
async function looksLikeCompositeSelect(el, options) {
|
|
67688
|
+
const role = await el.getAttribute("role", options).catch(() => null);
|
|
67689
|
+
if (role === "combobox" || role === "listbox") return false;
|
|
67690
|
+
if (await el.locator('input[type="radio"], input[type="checkbox"]').count() > 0) return false;
|
|
67691
|
+
if (await el.locator('[role="slider"], [aria-valuenow]').count() > 0) return false;
|
|
67692
|
+
const cues = el.locator(
|
|
67693
|
+
[
|
|
67694
|
+
"[aria-haspopup]",
|
|
67695
|
+
"[aria-controls]",
|
|
67696
|
+
"[aria-owns]",
|
|
67697
|
+
"input[readonly]",
|
|
67698
|
+
"button[aria-haspopup]"
|
|
67699
|
+
].join(", ")
|
|
67700
|
+
);
|
|
67701
|
+
return await cues.count() > 0;
|
|
67702
|
+
}
|
|
67703
|
+
async function getOptionFromPopup(popup, value, options) {
|
|
67704
|
+
const byValue = popup.locator(
|
|
67705
|
+
`[value=${JSON.stringify(value)}], [data-value=${JSON.stringify(value)}], [aria-label=${JSON.stringify(value)}]`
|
|
67706
|
+
);
|
|
67707
|
+
if (await byValue.count() > 0) return byValue.first();
|
|
67708
|
+
const byRole = popup.getByRole("option", { name: caseInsensitiveExact2(value) });
|
|
67709
|
+
if (await byRole.count() > 0) return byRole.first();
|
|
67710
|
+
const byText = popup.getByText(caseInsensitiveExact2(value), { exact: true });
|
|
67711
|
+
if (await byText.count() > 0) return byText.first();
|
|
67712
|
+
return null;
|
|
67713
|
+
}
|
|
67714
|
+
async function getPopupOptions(popup) {
|
|
67715
|
+
return popup.locator(
|
|
67716
|
+
[
|
|
67717
|
+
'[role="option"]',
|
|
67718
|
+
"[title]"
|
|
67719
|
+
].join(", ")
|
|
67720
|
+
);
|
|
67721
|
+
}
|
|
67722
|
+
function toNumber(value) {
|
|
67723
|
+
if (!value) return null;
|
|
67724
|
+
const n = Number.parseFloat(value);
|
|
67725
|
+
return Number.isFinite(n) ? n : null;
|
|
67726
|
+
}
|
|
67727
|
+
async function getContextNumericValue(el, options) {
|
|
67728
|
+
const labelled = el.page().getByLabel("result").first();
|
|
67729
|
+
if (await labelled.count() > 0) {
|
|
67730
|
+
const text = await labelled.textContent(options).catch(() => null);
|
|
67731
|
+
const parsed = toNumber(text);
|
|
67732
|
+
if (parsed !== null) return parsed;
|
|
67733
|
+
}
|
|
67734
|
+
return null;
|
|
67735
|
+
}
|
|
67736
|
+
async function getRootText(el, options) {
|
|
67737
|
+
return await el.evaluate((node) => (node.textContent ?? "").replace(/\s+/g, " ").trim(), options).catch(() => "") || "";
|
|
67738
|
+
}
|
|
67739
|
+
async function setCompositeSelect({ el }, value, options) {
|
|
67740
|
+
if (typeof value !== "string" && typeof value !== "number") return false;
|
|
67741
|
+
if (!await looksLikeCompositeSelect(el, options)) return false;
|
|
67742
|
+
const stringValue = String(value);
|
|
67743
|
+
const before = await getRootText(el, options);
|
|
67744
|
+
const popupsBefore = await getPopupCandidates(el.page()).count();
|
|
67745
|
+
await openControl(el, options);
|
|
67746
|
+
const popups = await getPopupCandidates(el.page());
|
|
67747
|
+
await popups.first().waitFor({ state: "visible", timeout: options?.timeout }).catch(() => null);
|
|
67748
|
+
const count = await popups.count();
|
|
67749
|
+
if (count === 0) return false;
|
|
67750
|
+
const popup = popups.nth(Math.max(0, count - 1));
|
|
67751
|
+
const option = await getOptionFromPopup(popup, stringValue);
|
|
67752
|
+
if (option) {
|
|
67753
|
+
await option.click({ ...options, force: true });
|
|
67754
|
+
}
|
|
67755
|
+
const after = await getRootText(el, options);
|
|
67756
|
+
if (after && before && after !== before) return true;
|
|
67757
|
+
const popupsAfter = await getPopupCandidates(el.page()).count();
|
|
67758
|
+
if (option && (popupsAfter < popupsBefore || popupsAfter < count)) return true;
|
|
67759
|
+
const targetNum = toNumber(stringValue);
|
|
67760
|
+
if (targetNum === null) return false;
|
|
67761
|
+
const optionsLoc = await getPopupOptions(popup);
|
|
67762
|
+
const totalOptions = await optionsLoc.count();
|
|
67763
|
+
if (totalOptions === 0) return false;
|
|
67764
|
+
const labels = [];
|
|
67765
|
+
for (let i = 0; i < totalOptions; i++) {
|
|
67766
|
+
const candidate = optionsLoc.nth(i);
|
|
67767
|
+
const label = await candidate.getAttribute("title", options).catch(() => null) || await candidate.textContent(options).catch(() => "") || "";
|
|
67768
|
+
const normalized = label.replace(/\s+/g, " ").trim();
|
|
67769
|
+
if (!normalized) continue;
|
|
67770
|
+
if (!labels.includes(normalized)) labels.push(normalized);
|
|
67771
|
+
}
|
|
67772
|
+
for (const label of labels) {
|
|
67773
|
+
await openControl(el, options);
|
|
67774
|
+
const activePopups = getPopupCandidates(el.page());
|
|
67775
|
+
const activePopupCount = await activePopups.count();
|
|
67776
|
+
if (activePopupCount === 0) continue;
|
|
67777
|
+
const activePopup = activePopups.nth(Math.max(0, activePopupCount - 1));
|
|
67778
|
+
let candidate = activePopup.locator(`[title=${JSON.stringify(label)}]`).first();
|
|
67779
|
+
if (await candidate.count() === 0) {
|
|
67780
|
+
candidate = activePopup.getByText(caseInsensitiveExact2(label), { exact: true }).first();
|
|
67781
|
+
}
|
|
67782
|
+
if (await candidate.count() === 0) continue;
|
|
67783
|
+
await candidate.click({ ...options, force: true });
|
|
67784
|
+
const numeric = await getContextNumericValue(el, options);
|
|
67785
|
+
if (numeric !== null && Math.abs(numeric - targetNum) < 1e-3) return true;
|
|
67786
|
+
}
|
|
67787
|
+
const current = await getContextNumericValue(el, options);
|
|
67788
|
+
if (current === null) return false;
|
|
67789
|
+
await openControl(el, options);
|
|
67790
|
+
await el.focus(options).catch(() => null);
|
|
67791
|
+
const page = el.page();
|
|
67792
|
+
const key = targetNum > current ? "ArrowDown" : "ArrowUp";
|
|
67793
|
+
for (let i = 0; i < 20; i++) {
|
|
67794
|
+
await page.keyboard.press(key);
|
|
67795
|
+
await page.keyboard.press("Enter");
|
|
67796
|
+
const numeric = await getContextNumericValue(el, options);
|
|
67797
|
+
if (numeric !== null && Math.abs(numeric - targetNum) < 1e-3) return true;
|
|
67798
|
+
await openControl(el, options);
|
|
67799
|
+
await el.focus(options).catch(() => null);
|
|
67800
|
+
}
|
|
67801
|
+
return false;
|
|
67802
|
+
}
|
|
67803
|
+
|
|
67804
|
+
// src/field/composite-slider.ts
|
|
67805
|
+
async function getSliderHandle(el, options) {
|
|
67806
|
+
const byAria = el.locator('[aria-valuenow], [role="slider"]').first();
|
|
67807
|
+
if (await byAria.count() > 0) return byAria;
|
|
67808
|
+
const focusables = el.locator("[tabindex]");
|
|
67809
|
+
if (await focusables.count() > 0) return focusables.first();
|
|
67810
|
+
const buttons = el.locator("button");
|
|
67811
|
+
if (await buttons.count() > 0) return buttons.first();
|
|
67812
|
+
return null;
|
|
67813
|
+
}
|
|
67814
|
+
function toNumber2(value) {
|
|
67815
|
+
if (!value) return null;
|
|
67816
|
+
const n = Number.parseFloat(value);
|
|
67817
|
+
return Number.isFinite(n) ? n : null;
|
|
67818
|
+
}
|
|
67819
|
+
async function getValueFromHandle(handle, options) {
|
|
67820
|
+
const fromAria = await handle.getAttribute("aria-valuenow", options).catch(() => null);
|
|
67821
|
+
const parsedAria = toNumber2(fromAria);
|
|
67822
|
+
if (parsedAria !== null) return parsedAria;
|
|
67823
|
+
const fromText = await handle.textContent(options).catch(() => null);
|
|
67824
|
+
return toNumber2(fromText);
|
|
67825
|
+
}
|
|
67826
|
+
async function getValueFromContext(el, options) {
|
|
67827
|
+
const labelled = el.page().getByLabel("result").first();
|
|
67828
|
+
if (await labelled.count() > 0) {
|
|
67829
|
+
const text = await labelled.textContent(options).catch(() => null);
|
|
67830
|
+
const parsed = toNumber2(text);
|
|
67831
|
+
if (parsed !== null) return parsed;
|
|
67832
|
+
}
|
|
67833
|
+
const siblingNumber = await el.evaluate((node) => {
|
|
67834
|
+
const parent = node.parentElement;
|
|
67835
|
+
if (!parent) return null;
|
|
67836
|
+
for (const child of Array.from(parent.children)) {
|
|
67837
|
+
if (child === node) continue;
|
|
67838
|
+
const text = (child.textContent ?? "").trim();
|
|
67839
|
+
if (!text) continue;
|
|
67840
|
+
const n = Number.parseFloat(text);
|
|
67841
|
+
if (Number.isFinite(n)) return n;
|
|
67842
|
+
}
|
|
67843
|
+
return null;
|
|
67844
|
+
}, options).catch(() => null);
|
|
67845
|
+
return typeof siblingNumber === "number" ? siblingNumber : null;
|
|
67846
|
+
}
|
|
67847
|
+
async function readValue(el, handle, options) {
|
|
67848
|
+
const fromHandle = await getValueFromHandle(handle, options);
|
|
67849
|
+
if (fromHandle !== null) return fromHandle;
|
|
67850
|
+
return getValueFromContext(el, options);
|
|
67851
|
+
}
|
|
67852
|
+
async function setCompositeSlider({ el }, value, options) {
|
|
67853
|
+
if (typeof value !== "number") return false;
|
|
67854
|
+
const handle = await getSliderHandle(el);
|
|
67855
|
+
if (!handle) return false;
|
|
67856
|
+
const initial = await readValue(el, handle, options);
|
|
67857
|
+
if (initial === null) return false;
|
|
67858
|
+
if (Math.abs(initial - value) < 1e-3) return true;
|
|
67859
|
+
await handle.focus(options);
|
|
67860
|
+
const page = el.page();
|
|
67861
|
+
const key = value > initial ? "ArrowRight" : "ArrowLeft";
|
|
67862
|
+
const maxPresses = Math.max(1, Math.min(200, Math.abs(Math.round(value - initial)) * 2));
|
|
67863
|
+
for (let i = 0; i < maxPresses; i++) {
|
|
67864
|
+
await page.keyboard.press(key);
|
|
67865
|
+
const current = await readValue(el, handle, options);
|
|
67866
|
+
if (current !== null && Math.abs(current - value) < 1e-3) return true;
|
|
67867
|
+
}
|
|
67868
|
+
const finalValue = await readValue(el, handle, options);
|
|
67869
|
+
return finalValue !== null && Math.abs(finalValue - value) < 1e-3;
|
|
67870
|
+
}
|
|
67871
|
+
|
|
67872
|
+
// src/field/composite-toggle.ts
|
|
67873
|
+
async function getToggleTarget(el, options) {
|
|
67874
|
+
const candidates = el.locator('button, [role="button"], [role="switch"], [role="checkbox"], [aria-checked], [tabindex]');
|
|
67875
|
+
if (await candidates.count() === 0) return null;
|
|
67876
|
+
const visible = candidates.filter({ visible: true });
|
|
67877
|
+
if (await visible.count() > 0) return visible.first();
|
|
67878
|
+
return candidates.first();
|
|
67879
|
+
}
|
|
67880
|
+
async function readToggleState(target, options) {
|
|
67881
|
+
const ariaChecked = await target.getAttribute("aria-checked", options).catch(() => null);
|
|
67882
|
+
if (ariaChecked === "true") return true;
|
|
67883
|
+
if (ariaChecked === "false") return false;
|
|
67884
|
+
const checked = await target.getAttribute("checked", options).catch(() => null);
|
|
67885
|
+
if (checked !== null) return checked !== "false";
|
|
67886
|
+
const className = await target.getAttribute("class", options).catch(() => null);
|
|
67887
|
+
if (className) {
|
|
67888
|
+
const lower = className.toLowerCase();
|
|
67889
|
+
if (/(^|\s|-)checked(\s|$|-)/.test(lower)) return true;
|
|
67890
|
+
if (/(^|\s|-)unchecked(\s|$|-)/.test(lower)) return false;
|
|
67891
|
+
if (/switch/.test(lower)) return /checked/.test(lower);
|
|
67892
|
+
}
|
|
67893
|
+
return null;
|
|
67894
|
+
}
|
|
67895
|
+
async function setCompositeToggle({ el }, value, options) {
|
|
67896
|
+
if (typeof value !== "boolean" && value !== null) return false;
|
|
67897
|
+
const target = await getToggleTarget(el);
|
|
67898
|
+
if (!target) return false;
|
|
67899
|
+
const initial = await readToggleState(target, options);
|
|
67900
|
+
if (initial === null) return false;
|
|
67901
|
+
const desired = Boolean(value);
|
|
67902
|
+
if (initial !== desired) {
|
|
67903
|
+
await target.click(options);
|
|
67904
|
+
}
|
|
67905
|
+
const next = await readToggleState(target, options);
|
|
67906
|
+
return next === desired;
|
|
67907
|
+
}
|
|
67415
67908
|
async function clearSelect(el, opts) {
|
|
67416
67909
|
const isMultiple = await el.evaluate((e) => e.multiple, opts);
|
|
67417
67910
|
const options = await el.evaluate(
|
|
@@ -67476,7 +67969,7 @@ async function getCandidateLocs(el, options) {
|
|
|
67476
67969
|
return Promise.all(
|
|
67477
67970
|
candidates.map(async (c) => {
|
|
67478
67971
|
const info = await c.evaluate(
|
|
67479
|
-
/* v8 ignore start */
|
|
67972
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
67480
67973
|
(node) => {
|
|
67481
67974
|
const e = node;
|
|
67482
67975
|
const attrs = {};
|
|
@@ -67504,6 +67997,7 @@ async function getCandidateLocs(el, options) {
|
|
|
67504
67997
|
options: options2
|
|
67505
67998
|
};
|
|
67506
67999
|
},
|
|
68000
|
+
/* v8 ignore stop */
|
|
67507
68001
|
options
|
|
67508
68002
|
);
|
|
67509
68003
|
return { el: c, ...info };
|
|
@@ -67542,7 +68036,7 @@ async function behavioralProbe(candidateLocs, scores, options) {
|
|
|
67542
68036
|
const loc = candidateLocs[i];
|
|
67543
68037
|
if (loc.tag === "input") {
|
|
67544
68038
|
const can_be_day = await loc.el.evaluate(
|
|
67545
|
-
/* v8 ignore start */
|
|
68039
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
67546
68040
|
(node) => {
|
|
67547
68041
|
const e = node;
|
|
67548
68042
|
const old = e.value;
|
|
@@ -67551,11 +68045,12 @@ async function behavioralProbe(candidateLocs, scores, options) {
|
|
|
67551
68045
|
e.value = old;
|
|
67552
68046
|
return valid;
|
|
67553
68047
|
},
|
|
68048
|
+
/* v8 ignore stop */
|
|
67554
68049
|
options
|
|
67555
68050
|
);
|
|
67556
68051
|
if (can_be_day) scores[i].day += 1;
|
|
67557
68052
|
const cannot_be_day = await loc.el.evaluate(
|
|
67558
|
-
/* v8 ignore start */
|
|
68053
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
67559
68054
|
(node) => {
|
|
67560
68055
|
const e = node;
|
|
67561
68056
|
const old = e.value;
|
|
@@ -67564,11 +68059,12 @@ async function behavioralProbe(candidateLocs, scores, options) {
|
|
|
67564
68059
|
e.value = old;
|
|
67565
68060
|
return valid;
|
|
67566
68061
|
},
|
|
68062
|
+
/* v8 ignore stop */
|
|
67567
68063
|
options
|
|
67568
68064
|
);
|
|
67569
68065
|
if (cannot_be_day) scores[i].day += 1;
|
|
67570
68066
|
const can_be_month = await loc.el.evaluate(
|
|
67571
|
-
/* v8 ignore start */
|
|
68067
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
67572
68068
|
(node) => {
|
|
67573
68069
|
const e = node;
|
|
67574
68070
|
const old = e.value;
|
|
@@ -67577,11 +68073,12 @@ async function behavioralProbe(candidateLocs, scores, options) {
|
|
|
67577
68073
|
e.value = old;
|
|
67578
68074
|
return valid;
|
|
67579
68075
|
},
|
|
68076
|
+
/* v8 ignore stop */
|
|
67580
68077
|
options
|
|
67581
68078
|
);
|
|
67582
68079
|
if (can_be_month) scores[i].month += 1;
|
|
67583
68080
|
const cannot_be_month = await loc.el.evaluate(
|
|
67584
|
-
/* v8 ignore start */
|
|
68081
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
67585
68082
|
(node) => {
|
|
67586
68083
|
const e = node;
|
|
67587
68084
|
const old = e.value;
|
|
@@ -67590,19 +68087,21 @@ async function behavioralProbe(candidateLocs, scores, options) {
|
|
|
67590
68087
|
e.value = old;
|
|
67591
68088
|
return valid;
|
|
67592
68089
|
},
|
|
68090
|
+
/* v8 ignore stop */
|
|
67593
68091
|
options
|
|
67594
68092
|
);
|
|
67595
68093
|
if (cannot_be_month) scores[i].month += 1;
|
|
67596
68094
|
const can_be_year = await loc.el.evaluate(
|
|
67597
|
-
/* v8 ignore start */
|
|
68095
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
67598
68096
|
(node) => {
|
|
67599
68097
|
const e = node;
|
|
67600
68098
|
const old = e.value;
|
|
67601
|
-
e.value = "
|
|
68099
|
+
e.value = "2033";
|
|
67602
68100
|
const valid = e.checkValidity();
|
|
67603
68101
|
e.value = old;
|
|
67604
68102
|
return valid;
|
|
67605
68103
|
},
|
|
68104
|
+
/* v8 ignore stop */
|
|
67606
68105
|
options
|
|
67607
68106
|
);
|
|
67608
68107
|
if (can_be_year) scores[i].year += 1;
|
|
@@ -67719,9 +68218,17 @@ function parseDateString(value, order, sep) {
|
|
|
67719
68218
|
if (dt.getFullYear() !== year || dt.getMonth() !== month - 1 || dt.getDate() !== day) return null;
|
|
67720
68219
|
return dt;
|
|
67721
68220
|
}
|
|
68221
|
+
function matchesDateLoosely2(value, date) {
|
|
68222
|
+
const digits2 = (value.match(/\d+/g) ?? []).map((d) => Number.parseInt(d, 10));
|
|
68223
|
+
if (digits2.length < 3) return false;
|
|
68224
|
+
const year = date.getFullYear();
|
|
68225
|
+
const month = date.getMonth() + 1;
|
|
68226
|
+
const day = date.getDate();
|
|
68227
|
+
return digits2.includes(year) && digits2.includes(month) && digits2.includes(day);
|
|
68228
|
+
}
|
|
67722
68229
|
async function inferLocaleAndPattern(el, options) {
|
|
67723
68230
|
return el.evaluate(
|
|
67724
|
-
/* v8 ignore start */
|
|
68231
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
67725
68232
|
() => {
|
|
67726
68233
|
const lang = document.documentElement.getAttribute("lang") || navigator.language || "en-US";
|
|
67727
68234
|
const dtf = new Intl.DateTimeFormat(lang, { year: "numeric", month: "2-digit", day: "2-digit" });
|
|
@@ -67738,6 +68245,7 @@ async function inferLocaleAndPattern(el, options) {
|
|
|
67738
68245
|
const finalOrder = order.length === 3 ? order : ["day", "month", "year"];
|
|
67739
68246
|
return { locale: lang, order: finalOrder, sep };
|
|
67740
68247
|
},
|
|
68248
|
+
/* v8 ignore stop */
|
|
67741
68249
|
options
|
|
67742
68250
|
);
|
|
67743
68251
|
}
|
|
@@ -67747,16 +68255,9 @@ async function fillAndReadBack(el, s, options, nextInput) {
|
|
|
67747
68255
|
if (nextInput) {
|
|
67748
68256
|
await nextInput.focus(options);
|
|
67749
68257
|
} else {
|
|
67750
|
-
await el.evaluate(
|
|
67751
|
-
/* v8 ignore next */
|
|
67752
|
-
(el2) => el2.blur(),
|
|
67753
|
-
options
|
|
67754
|
-
);
|
|
68258
|
+
await el.evaluate((el2) => el2.blur(), options);
|
|
67755
68259
|
}
|
|
67756
|
-
await el.evaluate(
|
|
67757
|
-
/* v8 ignore next */
|
|
67758
|
-
() => new Promise(requestAnimationFrame)
|
|
67759
|
-
);
|
|
68260
|
+
await el.evaluate(() => new Promise(requestAnimationFrame));
|
|
67760
68261
|
return await el.inputValue(options);
|
|
67761
68262
|
}
|
|
67762
68263
|
function isAmbiguous(value, value2) {
|
|
@@ -67775,8 +68276,10 @@ async function setDateValue(el, value, order, sep, pad, options, nextInput) {
|
|
|
67775
68276
|
const backParts = back.split(glue);
|
|
67776
68277
|
const failed = backParts.length !== dates.length || dates.some((date, i) => {
|
|
67777
68278
|
const part = backParts[i]?.trim();
|
|
68279
|
+
if (!part) return true;
|
|
67778
68280
|
const parsed = parseDateString(part, order, sep);
|
|
67779
|
-
|
|
68281
|
+
if (parsed && sameYMD(parsed, date)) return false;
|
|
68282
|
+
return !matchesDateLoosely2(part, date);
|
|
67780
68283
|
});
|
|
67781
68284
|
return !failed;
|
|
67782
68285
|
}
|
|
@@ -67897,7 +68400,7 @@ async function setSingleDate({ el, tag, type }, value, options) {
|
|
|
67897
68400
|
);
|
|
67898
68401
|
if (await inputs.count() === 1) {
|
|
67899
68402
|
const isVisible = await inputs.evaluate(
|
|
67900
|
-
/* v8 ignore next */
|
|
68403
|
+
/* v8 ignore next — callback runs in browser context, not Node */
|
|
67901
68404
|
(e) => {
|
|
67902
68405
|
const style = window.getComputedStyle(e);
|
|
67903
68406
|
return style.display !== "none" && style.visibility !== "hidden" && e.getAttribute("type") !== "hidden";
|
|
@@ -67952,39 +68455,6 @@ async function setNativeInput({ el, tag }, value, options) {
|
|
|
67952
68455
|
return false;
|
|
67953
68456
|
}
|
|
67954
68457
|
|
|
67955
|
-
// src/field/aria-select.ts
|
|
67956
|
-
async function selectAria({ el }, value, options) {
|
|
67957
|
-
if (typeof value !== "string" && typeof value !== "number") return false;
|
|
67958
|
-
const role = await el.getAttribute("role", options).catch(
|
|
67959
|
-
/* v8 ignore next */
|
|
67960
|
-
() => null
|
|
67961
|
-
);
|
|
67962
|
-
if (role !== "combobox") return false;
|
|
67963
|
-
const ariaControls = await el.getAttribute("aria-controls", options).catch(
|
|
67964
|
-
/* v8 ignore next */
|
|
67965
|
-
() => null
|
|
67966
|
-
);
|
|
67967
|
-
if (!ariaControls) return false;
|
|
67968
|
-
const ariaExpanded = await el.getAttribute("aria-expanded", options).catch(
|
|
67969
|
-
/* v8 ignore next */
|
|
67970
|
-
() => null
|
|
67971
|
-
);
|
|
67972
|
-
if (ariaExpanded !== "true") await el.click(options);
|
|
67973
|
-
const stringValue = String(value);
|
|
67974
|
-
const listbox = el.page().locator(`#${ariaControls}`);
|
|
67975
|
-
const byValue = listbox.locator(`[role="option"][value="${stringValue}"]`);
|
|
67976
|
-
if (await byValue.count() >= 1) {
|
|
67977
|
-
await byValue.first().click(options);
|
|
67978
|
-
return true;
|
|
67979
|
-
}
|
|
67980
|
-
const byName = listbox.getByRole("option", { name: stringValue });
|
|
67981
|
-
if (await byName.count() >= 1) {
|
|
67982
|
-
await byName.first().click(options);
|
|
67983
|
-
return true;
|
|
67984
|
-
}
|
|
67985
|
-
return false;
|
|
67986
|
-
}
|
|
67987
|
-
|
|
67988
68458
|
// src/field/otp.ts
|
|
67989
68459
|
async function setOtpValue({ el, tag }, value, options) {
|
|
67990
68460
|
if (typeof value !== "string") return false;
|
|
@@ -68000,6 +68470,14 @@ async function setOtpValue({ el, tag }, value, options) {
|
|
|
68000
68470
|
}
|
|
68001
68471
|
|
|
68002
68472
|
// src/field/radio-group.ts
|
|
68473
|
+
function caseInsensitiveExact3(value) {
|
|
68474
|
+
const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
68475
|
+
return new RegExp(`^${escaped}$`, "i");
|
|
68476
|
+
}
|
|
68477
|
+
function caseInsensitiveLooseExact(value) {
|
|
68478
|
+
const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
68479
|
+
return new RegExp(`^\\s*${escaped}\\s*$`, "i");
|
|
68480
|
+
}
|
|
68003
68481
|
async function setRadioGroup({ el }, value, options) {
|
|
68004
68482
|
if (typeof value !== "string" && typeof value !== "number") return false;
|
|
68005
68483
|
const stringValue = String(value);
|
|
@@ -68014,24 +68492,58 @@ async function setRadioGroup({ el }, value, options) {
|
|
|
68014
68492
|
await radioByLabel.check(options);
|
|
68015
68493
|
return true;
|
|
68016
68494
|
}
|
|
68017
|
-
const
|
|
68018
|
-
if (await
|
|
68019
|
-
const
|
|
68020
|
-
|
|
68021
|
-
/* v8 ignore next */
|
|
68022
|
-
() => null
|
|
68023
|
-
);
|
|
68024
|
-
if (ariaChecked !== "true") await item.click(options);
|
|
68495
|
+
const wrappedRadio = el.locator("label").filter({ hasText: caseInsensitiveLooseExact(stringValue) }).locator("input[type=radio]");
|
|
68496
|
+
if (await wrappedRadio.count() >= 1) {
|
|
68497
|
+
const wrappedLabel = el.locator("label").filter({ hasText: caseInsensitiveLooseExact(stringValue) }).first();
|
|
68498
|
+
await wrappedLabel.click({ ...options, force: true });
|
|
68025
68499
|
return true;
|
|
68026
68500
|
}
|
|
68027
|
-
const
|
|
68028
|
-
|
|
68029
|
-
|
|
68030
|
-
const
|
|
68031
|
-
|
|
68032
|
-
()
|
|
68501
|
+
const ariaRadios = el.getByRole("radio");
|
|
68502
|
+
const hasAriaRadios = await ariaRadios.count() > 0;
|
|
68503
|
+
if (hasAriaRadios) {
|
|
68504
|
+
const ariaRadioByName = el.getByRole("radio", { name: caseInsensitiveExact3(stringValue) });
|
|
68505
|
+
if (await ariaRadioByName.count() >= 1) {
|
|
68506
|
+
const item = ariaRadioByName.first();
|
|
68507
|
+
const ariaChecked = await item.getAttribute("aria-checked", options).catch(
|
|
68508
|
+
/* v8 ignore next — attribute might be missing or element might have detached during the check */
|
|
68509
|
+
() => null
|
|
68510
|
+
);
|
|
68511
|
+
if (ariaChecked !== "true") await item.click(options);
|
|
68512
|
+
const nextAriaChecked = await item.getAttribute("aria-checked", options).catch(
|
|
68513
|
+
/* v8 ignore next — attribute might be missing or element might have detached during the check */
|
|
68514
|
+
() => null
|
|
68515
|
+
);
|
|
68516
|
+
return nextAriaChecked === "true";
|
|
68517
|
+
}
|
|
68518
|
+
const ariaRadioByValue = el.locator(
|
|
68519
|
+
`[role="radio"][value="${stringValue}"], [role="radio"][data-value="${stringValue}"], [role="radio"][aria-label="${stringValue}"]`
|
|
68033
68520
|
);
|
|
68034
|
-
if (
|
|
68521
|
+
if (await ariaRadioByValue.count() >= 1) {
|
|
68522
|
+
const item = ariaRadioByValue.first();
|
|
68523
|
+
const ariaChecked = await item.getAttribute("aria-checked", options).catch(
|
|
68524
|
+
/* v8 ignore next — attribute might be missing or element might have detached during the check */
|
|
68525
|
+
() => null
|
|
68526
|
+
);
|
|
68527
|
+
if (ariaChecked !== "true") await item.click(options);
|
|
68528
|
+
const nextAriaChecked = await item.getAttribute("aria-checked", options).catch(
|
|
68529
|
+
/* v8 ignore next — attribute might be missing or element might have detached during the check */
|
|
68530
|
+
() => null
|
|
68531
|
+
);
|
|
68532
|
+
return nextAriaChecked === "true";
|
|
68533
|
+
}
|
|
68534
|
+
}
|
|
68535
|
+
const roleRadio = el.getByRole("radio", { name: caseInsensitiveLooseExact(stringValue) });
|
|
68536
|
+
if (await roleRadio.count() >= 1) {
|
|
68537
|
+
await roleRadio.first().click(options);
|
|
68538
|
+
return await roleRadio.first().isChecked(options).catch(() => false);
|
|
68539
|
+
}
|
|
68540
|
+
const labels = el.locator("label");
|
|
68541
|
+
const labelCount = await labels.count();
|
|
68542
|
+
for (let i = 0; i < labelCount; i++) {
|
|
68543
|
+
const label = labels.nth(i);
|
|
68544
|
+
const text = (await label.textContent(options).catch(() => ""))?.replace(/\s+/g, " ").trim().toLowerCase();
|
|
68545
|
+
if (text !== stringValue.trim().toLowerCase()) continue;
|
|
68546
|
+
await label.click({ ...options, force: true });
|
|
68035
68547
|
return true;
|
|
68036
68548
|
}
|
|
68037
68549
|
return false;
|
|
@@ -68109,10 +68621,12 @@ async function calculateRatio(slider, initialValue, targetValue, centerX, center
|
|
|
68109
68621
|
async function getSliderElement(el, options) {
|
|
68110
68622
|
const role = await el.getAttribute("role", options).catch(() => null);
|
|
68111
68623
|
if (role === "slider") return el;
|
|
68112
|
-
const
|
|
68113
|
-
if (await
|
|
68114
|
-
|
|
68115
|
-
|
|
68624
|
+
const sliderByRole = el.getByRole("slider");
|
|
68625
|
+
if (await sliderByRole.count() > 0) return sliderByRole.first();
|
|
68626
|
+
const sliderByAria = el.locator("[aria-valuenow][aria-valuemin][aria-valuemax]");
|
|
68627
|
+
if (await sliderByAria.count() > 0) return sliderByAria.first();
|
|
68628
|
+
const sliderByValueNow = el.locator("[aria-valuenow]");
|
|
68629
|
+
if (await sliderByValueNow.count() > 0) return sliderByValueNow.first();
|
|
68116
68630
|
return null;
|
|
68117
68631
|
}
|
|
68118
68632
|
async function getSliderAttributes(slider, options) {
|
|
@@ -68152,20 +68666,33 @@ async function setSliderByKeyboard(slider, initialValue, targetValue, options) {
|
|
|
68152
68666
|
}
|
|
68153
68667
|
|
|
68154
68668
|
// src/field/toggle.ts
|
|
68155
|
-
async function
|
|
68156
|
-
if (typeof value !== "boolean" && value !== null) return false;
|
|
68669
|
+
async function getToggleTarget2(el, options) {
|
|
68157
68670
|
const role = await el.getAttribute("role", options).catch(
|
|
68158
|
-
/* v8 ignore next */
|
|
68671
|
+
/* v8 ignore next — attribute might be missing or element might have detached during the check */
|
|
68159
68672
|
() => null
|
|
68160
68673
|
);
|
|
68161
|
-
if (role
|
|
68162
|
-
const
|
|
68163
|
-
|
|
68674
|
+
if (role === "checkbox" || role === "switch") return el;
|
|
68675
|
+
const byRole = el.locator('[role="switch"], [role="checkbox"]').first();
|
|
68676
|
+
if (await byRole.count() > 0) return byRole;
|
|
68677
|
+
const byState = el.locator("[aria-checked]").first();
|
|
68678
|
+
if (await byState.count() > 0) return byState;
|
|
68679
|
+
return null;
|
|
68680
|
+
}
|
|
68681
|
+
async function setToggle({ el }, value, options) {
|
|
68682
|
+
if (typeof value !== "boolean" && value !== null) return false;
|
|
68683
|
+
const target = await getToggleTarget2(el, options);
|
|
68684
|
+
if (!target) return false;
|
|
68685
|
+
const ariaChecked = await target.getAttribute("aria-checked", options).catch(
|
|
68686
|
+
/* v8 ignore next — attribute might be missing or element might have detached during the check */
|
|
68164
68687
|
() => null
|
|
68165
68688
|
);
|
|
68166
68689
|
const isChecked = ariaChecked === "true";
|
|
68167
|
-
if (Boolean(value) !== isChecked) await
|
|
68168
|
-
|
|
68690
|
+
if (Boolean(value) !== isChecked) await target.click(options);
|
|
68691
|
+
const nextAriaChecked = await target.getAttribute("aria-checked", options).catch(
|
|
68692
|
+
/* v8 ignore next — attribute might be missing or element might have detached during the check */
|
|
68693
|
+
() => null
|
|
68694
|
+
);
|
|
68695
|
+
return nextAriaChecked === String(Boolean(value));
|
|
68169
68696
|
}
|
|
68170
68697
|
|
|
68171
68698
|
// src/field/index.ts
|
|
@@ -68194,6 +68721,11 @@ async function setFieldValue(el, value, options) {
|
|
|
68194
68721
|
setCalendarDate,
|
|
68195
68722
|
setOtpValue,
|
|
68196
68723
|
setSliderValue,
|
|
68724
|
+
// generic non-semantic composite controls
|
|
68725
|
+
setCompositeToggle,
|
|
68726
|
+
setCompositeSelect,
|
|
68727
|
+
setCompositeSlider,
|
|
68728
|
+
setCompositeDate,
|
|
68197
68729
|
// fallback (eg contenteditable or will fail)
|
|
68198
68730
|
setFallback
|
|
68199
68731
|
);
|
|
@@ -68201,11 +68733,11 @@ async function setFieldValue(el, value, options) {
|
|
|
68201
68733
|
el = await pickFieldElement(el);
|
|
68202
68734
|
}
|
|
68203
68735
|
const tag = await el.evaluate((e) => e.tagName.toLowerCase(), options);
|
|
68204
|
-
const type = await el.getAttribute("type", options).
|
|
68205
|
-
/* v8 ignore next */
|
|
68736
|
+
const type = (await el.getAttribute("type", options).catch(
|
|
68737
|
+
/* v8 ignore next — attribute might be missing or element might have detached during the check */
|
|
68206
68738
|
() => null
|
|
68207
|
-
);
|
|
68208
|
-
const loc = { el, tag, type };
|
|
68739
|
+
))?.toLowerCase();
|
|
68740
|
+
const loc = { el, tag, type: type || null };
|
|
68209
68741
|
await setValue(loc, value, options);
|
|
68210
68742
|
}
|
|
68211
68743
|
async function formatHtml(page) {
|
|
@@ -68812,7 +69344,7 @@ async function realScrubHtml({ html, url }, opts = {}) {
|
|
|
68812
69344
|
const dom = new JSDOM(htmlForDom, { url });
|
|
68813
69345
|
const doc = dom.window.document;
|
|
68814
69346
|
if (o.pickMain) pickMain(doc);
|
|
68815
|
-
dropInfraAndSvg(doc,
|
|
69347
|
+
dropInfraAndSvg(doc, Boolean(o.dropSvg));
|
|
68816
69348
|
if (o.dropHidden) dropHiddenTrees(doc);
|
|
68817
69349
|
if (o.stripAttributes) stripAttributesAndSanitize(doc, o.stripAttributes);
|
|
68818
69350
|
if (o.dropComments) dropHtmlComments(doc);
|
|
@@ -68997,9 +69529,9 @@ function isUtilityClass(token) {
|
|
|
68997
69529
|
}
|
|
68998
69530
|
function stripUtilityClasses(doc) {
|
|
68999
69531
|
for (const el of doc.body.querySelectorAll("[class]")) {
|
|
69000
|
-
const kept = el.
|
|
69532
|
+
const kept = [...el.classList].filter((t) => t && !isUtilityClass(t));
|
|
69001
69533
|
if (kept.length === 0) el.removeAttribute("class");
|
|
69002
|
-
else el.
|
|
69534
|
+
else el.setAttribute("class", kept.join(" "));
|
|
69003
69535
|
}
|
|
69004
69536
|
}
|
|
69005
69537
|
function limitListsAndRows(doc, limit) {
|
|
@@ -70390,7 +70922,7 @@ async function tryClick(page, selectors, _label) {
|
|
|
70390
70922
|
async function closeNativeJsAlerts(page) {
|
|
70391
70923
|
page.on(
|
|
70392
70924
|
"dialog",
|
|
70393
|
-
/* v8 ignore next */
|
|
70925
|
+
/* v8 ignore next — callback runs in browser context, not Node */
|
|
70394
70926
|
(d) => d.accept().catch(() => {
|
|
70395
70927
|
})
|
|
70396
70928
|
);
|
|
@@ -70472,7 +71004,7 @@ async function sweepOverlays(page, regex) {
|
|
|
70472
71004
|
const acceptRxSource = regex.accept.source;
|
|
70473
71005
|
const acceptRxFlags = regex.accept.flags;
|
|
70474
71006
|
return await page.evaluate(
|
|
70475
|
-
/* v8 ignore start */
|
|
71007
|
+
/* v8 ignore start — callback runs in browser context, not Node */
|
|
70476
71008
|
([source, flags]) => {
|
|
70477
71009
|
const acceptRx = new RegExp(source, flags);
|
|
70478
71010
|
const isBig = (el) => {
|
|
@@ -70515,10 +71047,7 @@ async function sweepOverlays(page, regex) {
|
|
|
70515
71047
|
},
|
|
70516
71048
|
/* v8 ignore stop */
|
|
70517
71049
|
[acceptRxSource, acceptRxFlags]
|
|
70518
|
-
).catch(
|
|
70519
|
-
/* v8 ignore next */
|
|
70520
|
-
() => false
|
|
70521
|
-
);
|
|
71050
|
+
).catch(() => false);
|
|
70522
71051
|
}
|
|
70523
71052
|
async function suppressInterferences(page, opts = {}) {
|
|
70524
71053
|
const timeoutMs = opts.timeoutMs ?? 4e3;
|