@mtes-mct/monitor-ui 11.9.0 → 11.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/GlobalStyle.d.ts.map +1 -1
- package/assets/stylesheets/rsuite-override.css +2 -461
- package/components/Dialog/Action.d.ts.map +1 -1
- package/components/Dialog/index.d.ts +1 -1
- package/components/Dialog/index.d.ts.map +1 -1
- package/components/Message.d.ts +1 -1
- package/components/Message.d.ts.map +1 -1
- package/components/Notifier/index.d.ts +1 -1
- package/components/Notifier/index.d.ts.map +1 -1
- package/cypress/global.d.ts +18 -23
- package/cypress/index.js +420 -878
- package/cypress/index.js.map +1 -1
- package/elements/FieldError.d.ts +1 -1
- package/fields/CheckPicker.d.ts +5 -4
- package/fields/CheckPicker.d.ts.map +1 -1
- package/fields/Checkbox.d.ts +15 -2
- package/fields/Checkbox.d.ts.map +1 -1
- package/fields/CoordinatesInput/DDCoordinatesInput.d.ts +4 -3
- package/fields/CoordinatesInput/DDCoordinatesInput.d.ts.map +1 -1
- package/fields/CoordinatesInput/DMDCoordinatesInput.d.ts +4 -3
- package/fields/CoordinatesInput/DMDCoordinatesInput.d.ts.map +1 -1
- package/fields/CoordinatesInput/DMSCoordinatesInput.d.ts +4 -3
- package/fields/CoordinatesInput/DMSCoordinatesInput.d.ts.map +1 -1
- package/fields/CoordinatesInput/index.d.ts +11 -4
- package/fields/CoordinatesInput/index.d.ts.map +1 -1
- package/fields/DatePicker/CalendarPicker.d.ts +0 -1
- package/fields/DatePicker/CalendarPicker.d.ts.map +1 -1
- package/fields/DatePicker/index.d.ts +7 -4
- package/fields/DatePicker/index.d.ts.map +1 -1
- package/fields/DateRangePicker/DateInput.d.ts +6 -0
- package/fields/DateRangePicker/DateInput.d.ts.map +1 -1
- package/fields/DateRangePicker/NumberInput.d.ts +2 -0
- package/fields/DateRangePicker/NumberInput.d.ts.map +1 -1
- package/fields/DateRangePicker/RangeCalendarPicker.d.ts.map +1 -1
- package/fields/DateRangePicker/TimeInput.d.ts +6 -0
- package/fields/DateRangePicker/TimeInput.d.ts.map +1 -1
- package/fields/DateRangePicker/constants.d.ts.map +1 -1
- package/fields/DateRangePicker/index.d.ts +8 -5
- package/fields/DateRangePicker/index.d.ts.map +1 -1
- package/fields/MultiCascader/index.d.ts +21 -0
- package/fields/MultiCascader/index.d.ts.map +1 -0
- package/fields/MultiCascader/utils.d.ts +34 -0
- package/fields/MultiCascader/utils.d.ts.map +1 -0
- package/fields/MultiCheckbox.d.ts +4 -2
- package/fields/MultiCheckbox.d.ts.map +1 -1
- package/fields/MultiRadio.d.ts +5 -4
- package/fields/MultiRadio.d.ts.map +1 -1
- package/fields/MultiSelect.d.ts +5 -5
- package/fields/MultiSelect.d.ts.map +1 -1
- package/fields/MultiZoneEditor/index.d.ts +10 -6
- package/fields/MultiZoneEditor/index.d.ts.map +1 -1
- package/fields/NumberInput.d.ts +5 -2
- package/fields/NumberInput.d.ts.map +1 -1
- package/fields/Radio.d.ts +15 -0
- package/fields/Radio.d.ts.map +1 -0
- package/fields/RichBooleanCheckbox/index.d.ts +1 -1
- package/fields/RichBooleanCheckbox/index.d.ts.map +1 -1
- package/fields/Search.d.ts +9 -5
- package/fields/Search.d.ts.map +1 -1
- package/fields/Select.d.ts +6 -7
- package/fields/Select.d.ts.map +1 -1
- package/fields/TextInput.d.ts +3 -2
- package/fields/TextInput.d.ts.map +1 -1
- package/fields/Textarea.d.ts +5 -2
- package/fields/Textarea.d.ts.map +1 -1
- package/fields/Toggle/index.d.ts +16 -0
- package/fields/Toggle/index.d.ts.map +1 -0
- package/fields/Toggle/utils.d.ts +5 -0
- package/fields/Toggle/utils.d.ts.map +1 -0
- package/fields/shared/StyledRsuiteCalendarBox.d.ts +2 -0
- package/fields/shared/StyledRsuiteCalendarBox.d.ts.map +1 -0
- package/fields/shared/StyledRsuitePickerBox.d.ts +10 -0
- package/fields/shared/StyledRsuitePickerBox.d.ts.map +1 -0
- package/fields/shared/types.d.ts +14 -0
- package/fields/shared/types.d.ts.map +1 -0
- package/fields/shared/utils.d.ts +7 -0
- package/fields/shared/utils.d.ts.map +1 -0
- package/formiks/FormikCheckPicker.d.ts +5 -0
- package/formiks/FormikCheckPicker.d.ts.map +1 -0
- package/formiks/FormikCheckbox.d.ts.map +1 -1
- package/formiks/FormikCoordinatesInput.d.ts.map +1 -1
- package/formiks/FormikDatePicker.d.ts +2 -6
- package/formiks/FormikDatePicker.d.ts.map +1 -1
- package/formiks/FormikDateRangePicker.d.ts.map +1 -1
- package/formiks/FormikMultiCascader.d.ts +5 -0
- package/formiks/FormikMultiCascader.d.ts.map +1 -0
- package/formiks/FormikToggle.d.ts +4 -0
- package/formiks/FormikToggle.d.ts.map +1 -0
- package/hooks/usePressEscapeEffect.d.ts +2 -0
- package/hooks/usePressEscapeEffect.d.ts.map +1 -0
- package/index.d.ts +20 -8
- package/index.d.ts.map +1 -1
- package/index.js +16448 -15615
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/types/definitions.d.ts +17 -3
- package/types/definitions.d.ts.map +1 -1
- package/types/internals.d.ts +34 -4
- package/types/internals.d.ts.map +1 -1
- package/utils/assert.d.ts +18 -0
- package/utils/assert.d.ts.map +1 -0
- package/utils/ensure.d.ts +7 -0
- package/utils/ensure.d.ts.map +1 -0
- package/utils/getRsuiteDataItemValueFromOptionValue.d.ts +6 -0
- package/utils/getRsuiteDataItemValueFromOptionValue.d.ts.map +1 -0
- package/utils/getRsuiteDataItemValuesFromOptionValues.d.ts +7 -0
- package/utils/getRsuiteDataItemValuesFromOptionValues.d.ts.map +1 -0
- package/utils/getRsuiteDataItemsFromOptions.d.ts +7 -0
- package/utils/getRsuiteDataItemsFromOptions.d.ts.map +1 -0
- package/utils/getSelectedOptionValueFromSelectedRsuiteDataItemValue.d.ts +7 -0
- package/utils/getSelectedOptionValueFromSelectedRsuiteDataItemValue.d.ts.map +1 -0
- package/utils/getSelectedOptionValuesFromSelectedRsuiteDataItemValues.d.ts +7 -0
- package/utils/getSelectedOptionValuesFromSelectedRsuiteDataItemValues.d.ts.map +1 -0
- package/fields/Toggle.d.ts +0 -13
- package/fields/Toggle.d.ts.map +0 -1
- package/utils/getRsuiteDataFromOptions.d.ts +0 -4
- package/utils/getRsuiteDataFromOptions.d.ts.map +0 -1
- package/utils/getRsuiteValueFromOptionValue.d.ts +0 -3
- package/utils/getRsuiteValueFromOptionValue.d.ts.map +0 -1
- package/utils/getRsuiteValuesFromOptionValues.d.ts +0 -3
- package/utils/getRsuiteValuesFromOptionValues.d.ts.map +0 -1
package/cypress/index.js
CHANGED
|
@@ -45,7 +45,7 @@ function findElementBytext(selector, text, { fallbackSelector, index = 0, inElem
|
|
|
45
45
|
return foundElement;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const RETRIES$
|
|
48
|
+
const RETRIES$1 = 5;
|
|
49
49
|
function findButton(label, preSelector, { index, prevSubjectElement }) {
|
|
50
50
|
const buttonElement = findElementBytext(`${preSelector}button`, label, {
|
|
51
51
|
index,
|
|
@@ -71,7 +71,7 @@ function findButton(label, preSelector, { index, prevSubjectElement }) {
|
|
|
71
71
|
}
|
|
72
72
|
return undefined;
|
|
73
73
|
}
|
|
74
|
-
function clickButton(prevSubjectElements, label, { index = 0, withinSelector } = {}, leftRetries = RETRIES$
|
|
74
|
+
function clickButton(prevSubjectElements, label, { index = 0, withinSelector } = {}, leftRetries = RETRIES$1) {
|
|
75
75
|
const prevSubjectElement = prevSubjectElements ? prevSubjectElements[0] : undefined;
|
|
76
76
|
if (prevSubjectElements && !prevSubjectElements[0]) {
|
|
77
77
|
throw new Error('`prevSubjectElements[0]` is undefined.');
|
|
@@ -86,7 +86,7 @@ function clickButton(prevSubjectElements, label, { index = 0, withinSelector } =
|
|
|
86
86
|
}
|
|
87
87
|
if (leftRetries > 0) {
|
|
88
88
|
return cy.wait(250).then(()=>{
|
|
89
|
-
cy.log(`Retrying (${RETRIES$
|
|
89
|
+
cy.log(`Retrying (${RETRIES$1 - leftRetries + 1} / ${RETRIES$1})...`);
|
|
90
90
|
return clickButton(prevSubjectElements, label, {
|
|
91
91
|
index,
|
|
92
92
|
withinSelector
|
|
@@ -110,598 +110,85 @@ function clickLink(linkText) {
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
function
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
function _curry1(fn) {
|
|
127
|
-
return function f1(a) {
|
|
128
|
-
if (arguments.length === 0 || _isPlaceholder(a)) {
|
|
129
|
-
return f1;
|
|
130
|
-
} else {
|
|
131
|
-
return fn.apply(this, arguments);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Optimized internal two-arity curry function.
|
|
138
|
-
*
|
|
139
|
-
* @private
|
|
140
|
-
* @category Function
|
|
141
|
-
* @param {Function} fn The function to curry.
|
|
142
|
-
* @return {Function} The curried function.
|
|
143
|
-
*/
|
|
144
|
-
|
|
145
|
-
function _curry2(fn) {
|
|
146
|
-
return function f2(a, b) {
|
|
147
|
-
switch (arguments.length) {
|
|
148
|
-
case 0:
|
|
149
|
-
return f2;
|
|
150
|
-
|
|
151
|
-
case 1:
|
|
152
|
-
return _isPlaceholder(a) ? f2 : _curry1(function (_b) {
|
|
153
|
-
return fn(a, _b);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
default:
|
|
157
|
-
return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) {
|
|
158
|
-
return fn(_a, b);
|
|
159
|
-
}) : _isPlaceholder(b) ? _curry1(function (_b) {
|
|
160
|
-
return fn(a, _b);
|
|
161
|
-
}) : fn(a, b);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Tests whether or not an object is an array.
|
|
168
|
-
*
|
|
169
|
-
* @private
|
|
170
|
-
* @param {*} val The object to test.
|
|
171
|
-
* @return {Boolean} `true` if `val` is an array, `false` otherwise.
|
|
172
|
-
* @example
|
|
173
|
-
*
|
|
174
|
-
* _isArray([]); //=> true
|
|
175
|
-
* _isArray(null); //=> false
|
|
176
|
-
* _isArray({}); //=> false
|
|
177
|
-
*/
|
|
178
|
-
var _isArray = Array.isArray || function _isArray(val) {
|
|
179
|
-
return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]';
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
function _arrayFromIterator(iter) {
|
|
183
|
-
var list = [];
|
|
184
|
-
var next;
|
|
185
|
-
|
|
186
|
-
while (!(next = iter.next()).done) {
|
|
187
|
-
list.push(next.value);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return list;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function _includesWith(pred, x, list) {
|
|
194
|
-
var idx = 0;
|
|
195
|
-
var len = list.length;
|
|
196
|
-
|
|
197
|
-
while (idx < len) {
|
|
198
|
-
if (pred(x, list[idx])) {
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
idx += 1;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function _functionName(f) {
|
|
209
|
-
// String(x => x) evaluates to "x => x", so the pattern may not match.
|
|
210
|
-
var match = String(f).match(/^function (\w*)/);
|
|
211
|
-
return match == null ? '' : match[1];
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function _has(prop, obj) {
|
|
215
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
219
|
-
function _objectIs(a, b) {
|
|
220
|
-
// SameValue algorithm
|
|
221
|
-
if (a === b) {
|
|
222
|
-
// Steps 1-5, 7-10
|
|
223
|
-
// Steps 6.b-6.e: +0 != -0
|
|
224
|
-
return a !== 0 || 1 / a === 1 / b;
|
|
225
|
-
} else {
|
|
226
|
-
// Step 6.a: NaN == NaN
|
|
227
|
-
return a !== a && b !== b;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
|
|
232
|
-
|
|
233
|
-
var toString = Object.prototype.toString;
|
|
234
|
-
|
|
235
|
-
var _isArguments =
|
|
236
|
-
/*#__PURE__*/
|
|
237
|
-
function () {
|
|
238
|
-
return toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) {
|
|
239
|
-
return toString.call(x) === '[object Arguments]';
|
|
240
|
-
} : function _isArguments(x) {
|
|
241
|
-
return _has('callee', x);
|
|
242
|
-
};
|
|
243
|
-
}();
|
|
244
|
-
|
|
245
|
-
var hasEnumBug = !
|
|
246
|
-
/*#__PURE__*/
|
|
247
|
-
{
|
|
248
|
-
toString: null
|
|
249
|
-
}.propertyIsEnumerable('toString');
|
|
250
|
-
var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug
|
|
251
|
-
|
|
252
|
-
var hasArgsEnumBug =
|
|
253
|
-
/*#__PURE__*/
|
|
254
|
-
function () {
|
|
255
|
-
|
|
256
|
-
return arguments.propertyIsEnumerable('length');
|
|
257
|
-
}();
|
|
258
|
-
|
|
259
|
-
var contains = function contains(list, item) {
|
|
260
|
-
var idx = 0;
|
|
261
|
-
|
|
262
|
-
while (idx < list.length) {
|
|
263
|
-
if (list[idx] === item) {
|
|
264
|
-
return true;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
idx += 1;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return false;
|
|
271
|
-
};
|
|
272
|
-
/**
|
|
273
|
-
* Returns a list containing the names of all the enumerable own properties of
|
|
274
|
-
* the supplied object.
|
|
275
|
-
* Note that the order of the output array is not guaranteed to be consistent
|
|
276
|
-
* across different JS platforms.
|
|
277
|
-
*
|
|
278
|
-
* @func
|
|
279
|
-
* @memberOf R
|
|
280
|
-
* @since v0.1.0
|
|
281
|
-
* @category Object
|
|
282
|
-
* @sig {k: v} -> [k]
|
|
283
|
-
* @param {Object} obj The object to extract properties from
|
|
284
|
-
* @return {Array} An array of the object's own properties.
|
|
285
|
-
* @see R.keysIn, R.values, R.toPairs
|
|
286
|
-
* @example
|
|
287
|
-
*
|
|
288
|
-
* R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c']
|
|
289
|
-
*/
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
var keys = typeof Object.keys === 'function' && !hasArgsEnumBug ?
|
|
293
|
-
/*#__PURE__*/
|
|
294
|
-
_curry1(function keys(obj) {
|
|
295
|
-
return Object(obj) !== obj ? [] : Object.keys(obj);
|
|
296
|
-
}) :
|
|
297
|
-
/*#__PURE__*/
|
|
298
|
-
_curry1(function keys(obj) {
|
|
299
|
-
if (Object(obj) !== obj) {
|
|
300
|
-
return [];
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
var prop, nIdx;
|
|
304
|
-
var ks = [];
|
|
305
|
-
|
|
306
|
-
var checkArgsLength = hasArgsEnumBug && _isArguments(obj);
|
|
307
|
-
|
|
308
|
-
for (prop in obj) {
|
|
309
|
-
if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {
|
|
310
|
-
ks[ks.length] = prop;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if (hasEnumBug) {
|
|
315
|
-
nIdx = nonEnumerableProps.length - 1;
|
|
316
|
-
|
|
317
|
-
while (nIdx >= 0) {
|
|
318
|
-
prop = nonEnumerableProps[nIdx];
|
|
319
|
-
|
|
320
|
-
if (_has(prop, obj) && !contains(ks, prop)) {
|
|
321
|
-
ks[ks.length] = prop;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
nIdx -= 1;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return ks;
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Gives a single-word string description of the (native) type of a value,
|
|
333
|
-
* returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
|
|
334
|
-
* attempt to distinguish user Object types any further, reporting them all as
|
|
335
|
-
* 'Object'.
|
|
336
|
-
*
|
|
337
|
-
* @func
|
|
338
|
-
* @memberOf R
|
|
339
|
-
* @since v0.8.0
|
|
340
|
-
* @category Type
|
|
341
|
-
* @sig * -> String
|
|
342
|
-
* @param {*} val The value to test
|
|
343
|
-
* @return {String}
|
|
344
|
-
* @example
|
|
345
|
-
*
|
|
346
|
-
* R.type({}); //=> "Object"
|
|
347
|
-
* R.type(1); //=> "Number"
|
|
348
|
-
* R.type(false); //=> "Boolean"
|
|
349
|
-
* R.type('s'); //=> "String"
|
|
350
|
-
* R.type(null); //=> "Null"
|
|
351
|
-
* R.type([]); //=> "Array"
|
|
352
|
-
* R.type(/[A-z]/); //=> "RegExp"
|
|
353
|
-
* R.type(() => {}); //=> "Function"
|
|
354
|
-
* R.type(async () => {}); //=> "AsyncFunction"
|
|
355
|
-
* R.type(undefined); //=> "Undefined"
|
|
356
|
-
*/
|
|
357
|
-
|
|
358
|
-
var type =
|
|
359
|
-
/*#__PURE__*/
|
|
360
|
-
_curry1(function type(val) {
|
|
361
|
-
return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* private _uniqContentEquals function.
|
|
366
|
-
* That function is checking equality of 2 iterator contents with 2 assumptions
|
|
367
|
-
* - iterators lengths are the same
|
|
368
|
-
* - iterators values are unique
|
|
369
|
-
*
|
|
370
|
-
* false-positive result will be returned for comparison of, e.g.
|
|
371
|
-
* - [1,2,3] and [1,2,3,4]
|
|
372
|
-
* - [1,1,1] and [1,2,3]
|
|
373
|
-
* */
|
|
374
|
-
|
|
375
|
-
function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
|
|
376
|
-
var a = _arrayFromIterator(aIterator);
|
|
377
|
-
|
|
378
|
-
var b = _arrayFromIterator(bIterator);
|
|
379
|
-
|
|
380
|
-
function eq(_a, _b) {
|
|
381
|
-
return _equals(_a, _b, stackA.slice(), stackB.slice());
|
|
382
|
-
} // if *a* array contains any element that is not included in *b*
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
return !_includesWith(function (b, aItem) {
|
|
386
|
-
return !_includesWith(eq, aItem, b);
|
|
387
|
-
}, b, a);
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
function _equals(a, b, stackA, stackB) {
|
|
391
|
-
if (_objectIs$1(a, b)) {
|
|
392
|
-
return true;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
var typeA = type(a);
|
|
396
|
-
|
|
397
|
-
if (typeA !== type(b)) {
|
|
398
|
-
return false;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
|
|
402
|
-
return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
if (typeof a.equals === 'function' || typeof b.equals === 'function') {
|
|
406
|
-
return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
switch (typeA) {
|
|
410
|
-
case 'Arguments':
|
|
411
|
-
case 'Array':
|
|
412
|
-
case 'Object':
|
|
413
|
-
if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {
|
|
414
|
-
return a === b;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
break;
|
|
418
|
-
|
|
419
|
-
case 'Boolean':
|
|
420
|
-
case 'Number':
|
|
421
|
-
case 'String':
|
|
422
|
-
if (!(typeof a === typeof b && _objectIs$1(a.valueOf(), b.valueOf()))) {
|
|
423
|
-
return false;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
break;
|
|
427
|
-
|
|
428
|
-
case 'Date':
|
|
429
|
-
if (!_objectIs$1(a.valueOf(), b.valueOf())) {
|
|
430
|
-
return false;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
break;
|
|
434
|
-
|
|
435
|
-
case 'Error':
|
|
436
|
-
return a.name === b.name && a.message === b.message;
|
|
437
|
-
|
|
438
|
-
case 'RegExp':
|
|
439
|
-
if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {
|
|
440
|
-
return false;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
break;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
var idx = stackA.length - 1;
|
|
447
|
-
|
|
448
|
-
while (idx >= 0) {
|
|
449
|
-
if (stackA[idx] === a) {
|
|
450
|
-
return stackB[idx] === b;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
idx -= 1;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
switch (typeA) {
|
|
457
|
-
case 'Map':
|
|
458
|
-
if (a.size !== b.size) {
|
|
459
|
-
return false;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));
|
|
463
|
-
|
|
464
|
-
case 'Set':
|
|
465
|
-
if (a.size !== b.size) {
|
|
466
|
-
return false;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));
|
|
470
|
-
|
|
471
|
-
case 'Arguments':
|
|
472
|
-
case 'Array':
|
|
473
|
-
case 'Object':
|
|
474
|
-
case 'Boolean':
|
|
475
|
-
case 'Number':
|
|
476
|
-
case 'String':
|
|
477
|
-
case 'Date':
|
|
478
|
-
case 'Error':
|
|
479
|
-
case 'RegExp':
|
|
480
|
-
case 'Int8Array':
|
|
481
|
-
case 'Uint8Array':
|
|
482
|
-
case 'Uint8ClampedArray':
|
|
483
|
-
case 'Int16Array':
|
|
484
|
-
case 'Uint16Array':
|
|
485
|
-
case 'Int32Array':
|
|
486
|
-
case 'Uint32Array':
|
|
487
|
-
case 'Float32Array':
|
|
488
|
-
case 'Float64Array':
|
|
489
|
-
case 'ArrayBuffer':
|
|
490
|
-
break;
|
|
491
|
-
|
|
492
|
-
default:
|
|
493
|
-
// Values of other types are only equal if identical.
|
|
494
|
-
return false;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
var keysA = keys(a);
|
|
498
|
-
|
|
499
|
-
if (keysA.length !== keys(b).length) {
|
|
500
|
-
return false;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
var extendedStackA = stackA.concat([a]);
|
|
504
|
-
var extendedStackB = stackB.concat([b]);
|
|
505
|
-
idx = keysA.length - 1;
|
|
506
|
-
|
|
507
|
-
while (idx >= 0) {
|
|
508
|
-
var key = keysA[idx];
|
|
509
|
-
|
|
510
|
-
if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
|
|
511
|
-
return false;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
idx -= 1;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
return true;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
* Returns `true` if its arguments are equivalent, `false` otherwise. Handles
|
|
522
|
-
* cyclical data structures.
|
|
523
|
-
*
|
|
524
|
-
* Dispatches symmetrically to the `equals` methods of both arguments, if
|
|
525
|
-
* present.
|
|
526
|
-
*
|
|
527
|
-
* @func
|
|
528
|
-
* @memberOf R
|
|
529
|
-
* @since v0.15.0
|
|
530
|
-
* @category Relation
|
|
531
|
-
* @sig a -> b -> Boolean
|
|
532
|
-
* @param {*} a
|
|
533
|
-
* @param {*} b
|
|
534
|
-
* @return {Boolean}
|
|
535
|
-
* @example
|
|
536
|
-
*
|
|
537
|
-
* R.equals(1, 1); //=> true
|
|
538
|
-
* R.equals(1, '1'); //=> false
|
|
539
|
-
* R.equals([1, 2, 3], [1, 2, 3]); //=> true
|
|
540
|
-
*
|
|
541
|
-
* const a = {}; a.v = a;
|
|
542
|
-
* const b = {}; b.v = b;
|
|
543
|
-
* R.equals(a, b); //=> true
|
|
544
|
-
*/
|
|
545
|
-
|
|
546
|
-
var equals =
|
|
547
|
-
/*#__PURE__*/
|
|
548
|
-
_curry2(function equals(a, b) {
|
|
549
|
-
return _equals(a, b, [], []);
|
|
550
|
-
});
|
|
551
|
-
|
|
552
|
-
function _isObject(x) {
|
|
553
|
-
return Object.prototype.toString.call(x) === '[object Object]';
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
function _isString(x) {
|
|
557
|
-
return Object.prototype.toString.call(x) === '[object String]';
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
/**
|
|
561
|
-
* Tests whether or not an object is a typed array.
|
|
562
|
-
*
|
|
563
|
-
* @private
|
|
564
|
-
* @param {*} val The object to test.
|
|
565
|
-
* @return {Boolean} `true` if `val` is a typed array, `false` otherwise.
|
|
566
|
-
* @example
|
|
567
|
-
*
|
|
568
|
-
* _isTypedArray(new Uint8Array([])); //=> true
|
|
569
|
-
* _isTypedArray(new Float32Array([])); //=> true
|
|
570
|
-
* _isTypedArray([]); //=> false
|
|
571
|
-
* _isTypedArray(null); //=> false
|
|
572
|
-
* _isTypedArray({}); //=> false
|
|
573
|
-
*/
|
|
574
|
-
function _isTypedArray(val) {
|
|
575
|
-
var type = Object.prototype.toString.call(val);
|
|
576
|
-
return type === '[object Uint8ClampedArray]' || type === '[object Int8Array]' || type === '[object Uint8Array]' || type === '[object Int16Array]' || type === '[object Uint16Array]' || type === '[object Int32Array]' || type === '[object Uint32Array]' || type === '[object Float32Array]' || type === '[object Float64Array]' || type === '[object BigInt64Array]' || type === '[object BigUint64Array]';
|
|
113
|
+
function findElementParentBySelector(element, parentSelector, index = 0) {
|
|
114
|
+
let foundElement;
|
|
115
|
+
let foundElementIndex = 0;
|
|
116
|
+
const potentialParents = Cypress.$(element).parents(parentSelector);
|
|
117
|
+
potentialParents// eslint-disable-next-line func-names
|
|
118
|
+
.each(function() {
|
|
119
|
+
if (foundElementIndex === index) {
|
|
120
|
+
foundElement = this;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
foundElementIndex += 1;
|
|
124
|
+
});
|
|
125
|
+
return foundElement;
|
|
577
126
|
}
|
|
578
127
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
*
|
|
587
|
-
* Dispatches to the `empty` method of the first argument, if present.
|
|
588
|
-
*
|
|
589
|
-
* @func
|
|
590
|
-
* @memberOf R
|
|
591
|
-
* @since v0.3.0
|
|
592
|
-
* @category Function
|
|
593
|
-
* @sig a -> a
|
|
594
|
-
* @param {*} x
|
|
595
|
-
* @return {*}
|
|
596
|
-
* @example
|
|
597
|
-
*
|
|
598
|
-
* R.empty(Just(42)); //=> Nothing()
|
|
599
|
-
* R.empty([1, 2, 3]); //=> []
|
|
600
|
-
* R.empty('unicorns'); //=> ''
|
|
601
|
-
* R.empty({x: 1, y: 2}); //=> {}
|
|
602
|
-
* R.empty(Uint8Array.from('123')); //=> Uint8Array []
|
|
603
|
-
*/
|
|
604
|
-
|
|
605
|
-
var empty =
|
|
606
|
-
/*#__PURE__*/
|
|
607
|
-
_curry1(function empty(x) {
|
|
608
|
-
return x != null && typeof x['fantasy-land/empty'] === 'function' ? x['fantasy-land/empty']() : x != null && x.constructor != null && typeof x.constructor['fantasy-land/empty'] === 'function' ? x.constructor['fantasy-land/empty']() : x != null && typeof x.empty === 'function' ? x.empty() : x != null && x.constructor != null && typeof x.constructor.empty === 'function' ? x.constructor.empty() : _isArray(x) ? [] : _isString(x) ? '' : _isObject(x) ? {} : _isArguments(x) ? function () {
|
|
609
|
-
return arguments;
|
|
610
|
-
}() : _isTypedArray(x) ? x.constructor.from('') : void 0 // else
|
|
611
|
-
;
|
|
612
|
-
});
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* Returns `true` if the given value is its type's empty value; `false`
|
|
616
|
-
* otherwise.
|
|
617
|
-
*
|
|
618
|
-
* @func
|
|
619
|
-
* @memberOf R
|
|
620
|
-
* @since v0.1.0
|
|
621
|
-
* @category Logic
|
|
622
|
-
* @sig a -> Boolean
|
|
623
|
-
* @param {*} x
|
|
624
|
-
* @return {Boolean}
|
|
625
|
-
* @see R.empty
|
|
626
|
-
* @example
|
|
627
|
-
*
|
|
628
|
-
* R.isEmpty([1, 2, 3]); //=> false
|
|
629
|
-
* R.isEmpty([]); //=> true
|
|
630
|
-
* R.isEmpty(''); //=> true
|
|
631
|
-
* R.isEmpty(null); //=> false
|
|
632
|
-
* R.isEmpty({}); //=> true
|
|
633
|
-
* R.isEmpty({length: 0}); //=> false
|
|
634
|
-
* R.isEmpty(Uint8Array.from('')); //=> true
|
|
635
|
-
*/
|
|
636
|
-
|
|
637
|
-
var isEmpty =
|
|
638
|
-
/*#__PURE__*/
|
|
639
|
-
_curry1(function isEmpty(x) {
|
|
640
|
-
return x != null && equals(x, empty(x));
|
|
641
|
-
});
|
|
642
|
-
|
|
643
|
-
var isEmpty$1 = isEmpty;
|
|
644
|
-
|
|
645
|
-
function checkCheckbox(checkboxInputElement, value) {
|
|
128
|
+
function checkCheckbox(fieldElement, value, _label) {
|
|
129
|
+
cy.wrap(fieldElement).scrollIntoView({
|
|
130
|
+
offset: {
|
|
131
|
+
left: 0,
|
|
132
|
+
top: -100
|
|
133
|
+
}
|
|
134
|
+
});
|
|
646
135
|
if (value) {
|
|
647
|
-
cy.wrap(
|
|
136
|
+
cy.wrap(fieldElement).find('input[type="checkbox"]').check({
|
|
648
137
|
force: true
|
|
649
|
-
});
|
|
138
|
+
}).wait(250);
|
|
650
139
|
} else {
|
|
651
|
-
cy.wrap(
|
|
140
|
+
cy.wrap(fieldElement).find('input[type="checkbox"]').uncheck({
|
|
652
141
|
force: true
|
|
653
|
-
});
|
|
142
|
+
}).wait(250);
|
|
654
143
|
}
|
|
655
144
|
}
|
|
656
145
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
146
|
+
function checkMultiCheckboxOptions(fieldsetElement, values, _label) {
|
|
147
|
+
cy.wrap(fieldsetElement).scrollIntoView({
|
|
148
|
+
offset: {
|
|
149
|
+
left: 0,
|
|
150
|
+
top: -100
|
|
151
|
+
}
|
|
152
|
+
});
|
|
660
153
|
cy.wrap(fieldsetElement).find('input[type="checkbox"]').uncheck({
|
|
661
154
|
force: true
|
|
662
155
|
}).wait(250);
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
cy.log(`Retrying (${RETRIES$1 - leftRetries + 1} / ${RETRIES$1})...`);
|
|
666
|
-
checkMultiCheckboxOptions(fieldsetElement, values, leftRetries - 1);
|
|
667
|
-
});
|
|
156
|
+
// If `values` is undefined, we don't need to check anything
|
|
157
|
+
if (!values) {
|
|
668
158
|
return;
|
|
669
159
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
force: true
|
|
674
|
-
});
|
|
160
|
+
values.forEach((value)=>{
|
|
161
|
+
cy.wrap(fieldsetElement).find('label').contains(value).find('input[type="checkbox"]').check({
|
|
162
|
+
force: true
|
|
675
163
|
});
|
|
676
|
-
}
|
|
164
|
+
});
|
|
165
|
+
cy.wait(250);
|
|
677
166
|
}
|
|
678
167
|
|
|
679
|
-
function checkMultiRadioOption(fieldsetElement, value) {
|
|
680
|
-
cy.wrap(fieldsetElement).
|
|
681
|
-
|
|
682
|
-
|
|
168
|
+
function checkMultiRadioOption(fieldsetElement, value, _label) {
|
|
169
|
+
cy.wrap(fieldsetElement).scrollIntoView({
|
|
170
|
+
offset: {
|
|
171
|
+
left: 0,
|
|
172
|
+
top: -100
|
|
173
|
+
}
|
|
174
|
+
}).find('label').contains(value).forceClick().wait(250);
|
|
683
175
|
return fieldsetElement;
|
|
684
176
|
}
|
|
685
177
|
|
|
686
|
-
function
|
|
178
|
+
function throwError(message) {
|
|
179
|
+
throw new Error(`[monitor-ui > Cypress] ${message}`);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function fillDatePicker(fieldsetElement, dateOrDateWithTimeTuple, _label) {
|
|
687
183
|
const inputElements = fieldsetElement.querySelectorAll('input');
|
|
688
184
|
if (inputElements.length !== 4 && inputElements.length !== 6) {
|
|
689
|
-
|
|
185
|
+
throwError(`Expected to find 4 or 6 inputs within in DatePicker but found ${inputElements.length}.`);
|
|
690
186
|
}
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
if (!fieldsetElement.offsetParent) {
|
|
694
|
-
throw new Error('`fieldsetElement.offsetParent` is undefined.');
|
|
695
|
-
}
|
|
696
|
-
return fieldsetElement.offsetParent.offsetLeft;
|
|
697
|
-
})();
|
|
698
|
-
const fieldsetElementOffsetTop = fieldsetElement.offsetTop !== 0 ? fieldsetElement.offsetTop : (()=>{
|
|
699
|
-
if (!fieldsetElement.offsetParent) {
|
|
700
|
-
throw new Error('`fieldsetElement.offsetParent` is undefined.');
|
|
701
|
-
}
|
|
702
|
-
return fieldsetElement.offsetParent.offsetTop;
|
|
703
|
-
})();
|
|
187
|
+
const hasTimeInputs = inputElements.length === 6;
|
|
188
|
+
// Empty the inputs if `dateOrDateWithTimeTuple` is undefined
|
|
704
189
|
if (!dateOrDateWithTimeTuple) {
|
|
190
|
+
// -------------------------------------------------------------------------
|
|
191
|
+
// Date without time
|
|
705
192
|
cy.wrap(fieldsetElement).find('[aria-label="Jour"]').clear({
|
|
706
193
|
force: true
|
|
707
194
|
});
|
|
@@ -711,7 +198,7 @@ function fillDatePicker(fieldsetElement, dateOrDateWithTimeTuple) {
|
|
|
711
198
|
cy.wrap(fieldsetElement).find('[aria-label="Année"]').clear({
|
|
712
199
|
force: true
|
|
713
200
|
});
|
|
714
|
-
if (
|
|
201
|
+
if (hasTimeInputs) {
|
|
715
202
|
cy.wrap(fieldsetElement).find('[aria-label="Heure"]').clear({
|
|
716
203
|
force: true
|
|
717
204
|
});
|
|
@@ -719,40 +206,31 @@ function fillDatePicker(fieldsetElement, dateOrDateWithTimeTuple) {
|
|
|
719
206
|
force: true
|
|
720
207
|
});
|
|
721
208
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
cy.wrap(fieldsetElement).find('[aria-label="Minute"]').type(String(minute).padStart(2, '0'));
|
|
209
|
+
} else {
|
|
210
|
+
const [year, month, day] = dateOrDateWithTimeTuple;
|
|
211
|
+
cy.wrap(fieldsetElement).find('[aria-label="Jour"]').type(String(day).padStart(2, '0'));
|
|
212
|
+
cy.wrap(fieldsetElement).find('[aria-label="Mois"]').type(String(month).padStart(2, '0'));
|
|
213
|
+
cy.wrap(fieldsetElement).find('[aria-label="Année"]').type(String(year));
|
|
214
|
+
if (hasTimeInputs) {
|
|
215
|
+
const [hour, minute] = dateOrDateWithTimeTuple.slice(3);
|
|
216
|
+
cy.wrap(fieldsetElement).find('[aria-label="Heure"]').type(String(hour).padStart(2, '0'));
|
|
217
|
+
cy.wrap(fieldsetElement).find('[aria-label="Minute"]').type(String(minute).padStart(2, '0'));
|
|
218
|
+
}
|
|
733
219
|
}
|
|
734
|
-
cy.clickOutside(fieldsetElementOffsetLeft, fieldsetElementOffsetTop - 1);
|
|
735
220
|
cy.wait(250);
|
|
221
|
+
// Close the calendar & ranged time picker popup by pressing the escape key
|
|
222
|
+
cy.get('body').type('{esc}');
|
|
223
|
+
cy.wrap(fieldsetElement).find('.Field-DatePicker__CalendarPicker').should('not.be.visible');
|
|
224
|
+
cy.wrap(fieldsetElement).find('.Field-DateRangePicker__RangedTimePicker').should('not.exist');
|
|
736
225
|
}
|
|
737
226
|
|
|
738
|
-
function fillDateRangePicker(fieldsetElement, dateOrDateWithTimeTupleRange) {
|
|
227
|
+
function fillDateRangePicker(fieldsetElement, dateOrDateWithTimeTupleRange, _label) {
|
|
739
228
|
const inputElements = fieldsetElement.querySelectorAll('input');
|
|
740
229
|
if (inputElements.length !== 7 && inputElements.length !== 11) {
|
|
741
|
-
|
|
230
|
+
throwError(`Expected to find 7 or 11 inputs within in DatePicker but found ${inputElements.length}.`);
|
|
742
231
|
}
|
|
743
232
|
const hasTimeInput = inputElements.length !== 7;
|
|
744
|
-
|
|
745
|
-
if (!fieldsetElement.offsetParent) {
|
|
746
|
-
throw new Error('`fieldsetElement.offsetParent` is undefined.');
|
|
747
|
-
}
|
|
748
|
-
return fieldsetElement.offsetParent.offsetLeft;
|
|
749
|
-
})();
|
|
750
|
-
const fieldsetElementOffsetTop = fieldsetElement.offsetTop !== 0 ? fieldsetElement.offsetTop : (()=>{
|
|
751
|
-
if (!fieldsetElement.offsetParent) {
|
|
752
|
-
throw new Error('`fieldsetElement.offsetParent` is undefined.');
|
|
753
|
-
}
|
|
754
|
-
return fieldsetElement.offsetParent.offsetTop;
|
|
755
|
-
})();
|
|
233
|
+
// Empty the inputs if `dateOrDateWithTimeTupleRange` is undefined
|
|
756
234
|
if (!dateOrDateWithTimeTupleRange) {
|
|
757
235
|
cy.wrap(fieldsetElement).find('[aria-label="Jour de début"]').clear({
|
|
758
236
|
force: true
|
|
@@ -788,348 +266,405 @@ function fillDateRangePicker(fieldsetElement, dateOrDateWithTimeTupleRange) {
|
|
|
788
266
|
force: true
|
|
789
267
|
});
|
|
790
268
|
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
cy.wrap(fieldsetElement).find('[aria-label="
|
|
803
|
-
cy.wrap(fieldsetElement).find('[aria-label="
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
cy.wrap(fieldsetElement).find('[aria-label="Heure de fin"]').type(String(endHour).padStart(2, '0'));
|
|
810
|
-
cy.wrap(fieldsetElement).find('[aria-label="Minute de fin"]').type(String(endMinute).padStart(2, '0'));
|
|
269
|
+
} else {
|
|
270
|
+
const [startDateOrDateWithTimeTuple, endDateOrDateWithTimeTuple] = dateOrDateWithTimeTupleRange;
|
|
271
|
+
const [startYear, startMonth, startDay, startHour, startMinute] = startDateOrDateWithTimeTuple;
|
|
272
|
+
const [endYear, endMonth, endDay, endHour, endMinute] = endDateOrDateWithTimeTuple;
|
|
273
|
+
cy.wrap(fieldsetElement).find('[aria-label="Jour de début"]').type(String(startDay).padStart(2, '0'));
|
|
274
|
+
cy.wrap(fieldsetElement).find('[aria-label="Mois de début"]').type(String(startMonth).padStart(2, '0'));
|
|
275
|
+
cy.wrap(fieldsetElement).find('[aria-label="Année de début"]').type(String(startYear));
|
|
276
|
+
if (hasTimeInput) {
|
|
277
|
+
cy.wrap(fieldsetElement).find('[aria-label="Heure de début"]').type(String(startHour).padStart(2, '0'));
|
|
278
|
+
cy.wrap(fieldsetElement).find('[aria-label="Minute de début"]').type(String(startMinute).padStart(2, '0'));
|
|
279
|
+
}
|
|
280
|
+
cy.wrap(fieldsetElement).find('[aria-label="Jour de fin"]').type(String(endDay).padStart(2, '0'));
|
|
281
|
+
cy.wrap(fieldsetElement).find('[aria-label="Mois de fin"]').type(String(endMonth).padStart(2, '0'));
|
|
282
|
+
cy.wrap(fieldsetElement).find('[aria-label="Année de fin"]').type(String(endYear));
|
|
283
|
+
if (hasTimeInput) {
|
|
284
|
+
cy.wrap(fieldsetElement).find('[aria-label="Heure de fin"]').type(String(endHour).padStart(2, '0'));
|
|
285
|
+
cy.wrap(fieldsetElement).find('[aria-label="Minute de fin"]').type(String(endMinute).padStart(2, '0'));
|
|
286
|
+
}
|
|
811
287
|
}
|
|
812
|
-
cy.clickOutside(fieldsetElementOffsetLeft, fieldsetElementOffsetTop - 1);
|
|
813
288
|
cy.wait(250);
|
|
289
|
+
// Close the range calendar & ranged time picker popup by pressing the escape key
|
|
290
|
+
cy.get('body').type('{esc}');
|
|
291
|
+
cy.wrap(fieldsetElement).find('.Field-DateRangePicker__RangeCalendarPicker').should('not.be.visible');
|
|
292
|
+
cy.wrap(fieldsetElement).find('.Field-DateRangePicker__RangedTimePicker').should('not.exist');
|
|
814
293
|
}
|
|
815
294
|
|
|
816
|
-
function
|
|
817
|
-
cy.wrap(
|
|
818
|
-
|
|
295
|
+
function fillNumberInput(fieldElement, value, _label) {
|
|
296
|
+
cy.wrap(fieldElement).scrollIntoView({
|
|
297
|
+
offset: {
|
|
298
|
+
left: 0,
|
|
299
|
+
top: -100
|
|
300
|
+
}
|
|
819
301
|
});
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
302
|
+
cy.wrap(fieldElement).find('input[type="number"]').clear({
|
|
303
|
+
force: true
|
|
304
|
+
}).wait(250);
|
|
305
|
+
// If `value` is undefined, we don't need to input anything
|
|
306
|
+
if (!value) {
|
|
307
|
+
return;
|
|
825
308
|
}
|
|
309
|
+
cy.wrap(fieldElement).find('input[type="number"]').type(String(value), {
|
|
310
|
+
force: true
|
|
311
|
+
}).wait(250);
|
|
826
312
|
}
|
|
827
313
|
|
|
828
|
-
function
|
|
829
|
-
cy.wrap(
|
|
830
|
-
|
|
314
|
+
function fillTextarea(fieldElement, value, _label) {
|
|
315
|
+
cy.wrap(fieldElement).scrollIntoView({
|
|
316
|
+
offset: {
|
|
317
|
+
left: 0,
|
|
318
|
+
top: -100
|
|
319
|
+
}
|
|
831
320
|
});
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
321
|
+
cy.wrap(fieldElement).find('textarea').clear({
|
|
322
|
+
force: true
|
|
323
|
+
}).wait(250);
|
|
324
|
+
// If `value` is undefined, we don't need to input anything
|
|
325
|
+
if (!value) {
|
|
326
|
+
return;
|
|
836
327
|
}
|
|
328
|
+
cy.wrap(fieldElement).find('textarea').type(value, {
|
|
329
|
+
force: true
|
|
330
|
+
}).wait(250);
|
|
837
331
|
}
|
|
838
332
|
|
|
839
|
-
function
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
const fieldElementOffsetLeft = fieldElement.offsetLeft ? fieldElement.offsetLeft : (()=>{
|
|
845
|
-
if (!fieldElement.offsetParent) {
|
|
846
|
-
throw new Error('`fieldElement.offsetParent` is undefined.');
|
|
847
|
-
}
|
|
848
|
-
return fieldElement.offsetParent.offsetLeft;
|
|
849
|
-
})();
|
|
850
|
-
const fieldElementOffsetTop = fieldElement.offsetTop !== 0 ? fieldElement.offsetTop : (()=>{
|
|
851
|
-
if (!fieldElement.offsetParent) {
|
|
852
|
-
throw new Error('`fieldElement.offsetParent` is undefined.');
|
|
853
|
-
}
|
|
854
|
-
return fieldElement.offsetParent.offsetTop;
|
|
855
|
-
})();
|
|
856
|
-
cy.wrap(fieldElement).scrollIntoView();
|
|
857
|
-
const maybeCleanButton = fieldElement.querySelector('.rs-picker-toggle-clean');
|
|
858
|
-
if (maybeCleanButton) {
|
|
859
|
-
cy.wrap(fieldElement).find('.rs-picker-toggle-clean').forceClick().wait(250);
|
|
860
|
-
}
|
|
861
|
-
if (!values) {
|
|
862
|
-
return;
|
|
333
|
+
function fillTextInput(fieldElement, value, _label) {
|
|
334
|
+
cy.wrap(fieldElement).scrollIntoView({
|
|
335
|
+
offset: {
|
|
336
|
+
left: 0,
|
|
337
|
+
top: -100
|
|
863
338
|
}
|
|
864
|
-
cy.wrap(fieldElement).find('.rs-picker-toggle').forceClick();
|
|
865
|
-
cy.get('.rs-picker-check-menu').then(([CheckPickerMenuElement])=>{
|
|
866
|
-
if (!CheckPickerMenuElement) {
|
|
867
|
-
throw new Error('`CheckPickerMenuElement` is undefined.');
|
|
868
|
-
}
|
|
869
|
-
const maybeSearchInput = CheckPickerMenuElement.querySelector('.rs-picker-search-bar-input');
|
|
870
|
-
values.forEach((value)=>{
|
|
871
|
-
if (maybeSearchInput) {
|
|
872
|
-
cy.get('.rs-picker-check-menu').find('.rs-picker-search-bar-input').type(value);
|
|
873
|
-
}
|
|
874
|
-
cy.get('.rs-picker-check-menu').find('[role="option"]').contains(value).scrollIntoView().forceClick();
|
|
875
|
-
});
|
|
876
|
-
// TODO Investigate that (this should be -1).
|
|
877
|
-
cy.clickOutside(fieldElementOffsetLeft, fieldElementOffsetTop - 16);
|
|
878
|
-
cy.wait(250);
|
|
879
|
-
});
|
|
880
339
|
});
|
|
340
|
+
cy.wrap(fieldElement).find('input[type="text"]').clear({
|
|
341
|
+
force: true
|
|
342
|
+
}).wait(250);
|
|
343
|
+
// If `value` is undefined, we don't need to input anything
|
|
344
|
+
if (!value) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
cy.wrap(fieldElement).find('input[type="text"]').type(value, {
|
|
348
|
+
force: true
|
|
349
|
+
}).wait(250);
|
|
881
350
|
}
|
|
882
351
|
|
|
883
|
-
function
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
352
|
+
function pickCheckPickerOptions(fieldElement, values, label) {
|
|
353
|
+
cy.wrap(fieldElement).scrollIntoView({
|
|
354
|
+
offset: {
|
|
355
|
+
left: 0,
|
|
356
|
+
top: -100
|
|
887
357
|
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
if (!values) {
|
|
906
|
-
return;
|
|
358
|
+
});
|
|
359
|
+
// Clear the field if there is a clear button
|
|
360
|
+
const maybeClearButton = fieldElement.querySelector('.rs-stack > .rs-stack-item > .rs-picker-clean');
|
|
361
|
+
if (maybeClearButton) {
|
|
362
|
+
cy.wrap(fieldElement).find('.rs-stack > .rs-stack-item > .rs-picker-clean').click({
|
|
363
|
+
force: true
|
|
364
|
+
}).wait(250);
|
|
365
|
+
}
|
|
366
|
+
// If `values` is undefined, we don't need to select anything
|
|
367
|
+
if (!values) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
cy.wrap(fieldElement).find('.rs-picker-toggle').forceClick();
|
|
371
|
+
// Wait for the picker to open
|
|
372
|
+
cy.wrap(fieldElement).find('.rs-picker-popup').then(([rsuitePickerPopupElement])=>{
|
|
373
|
+
if (!rsuitePickerPopupElement) {
|
|
374
|
+
throwError(`Could not find '.rs-picker-popup' in in field with label "${label}". Did the picker open?`);
|
|
907
375
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
376
|
+
// Search for the value if there is a search input
|
|
377
|
+
const maybeSearchInput = rsuitePickerPopupElement.querySelector('input[role="searchbox"]');
|
|
378
|
+
values.forEach((value)=>{
|
|
379
|
+
if (maybeSearchInput) {
|
|
380
|
+
cy.wrap(rsuitePickerPopupElement).find('input[role="searchbox"]').type(value).wait(250);
|
|
912
381
|
}
|
|
913
|
-
|
|
914
|
-
values.forEach((value)=>{
|
|
915
|
-
if (maybeSearchInput) {
|
|
916
|
-
cy.get('.rs-picker-check-menu').find('.rs-picker-search-bar-input').type(value);
|
|
917
|
-
}
|
|
918
|
-
cy.get('.rs-picker-check-menu').find('.rs-checkbox-checker').contains(value).scrollIntoView().forceClick();
|
|
919
|
-
});
|
|
920
|
-
// TODO Investigate that (this should be -1).
|
|
921
|
-
cy.clickOutside(fieldElementOffsetLeft, fieldElementOffsetTop - 16);
|
|
922
|
-
cy.wait(250);
|
|
382
|
+
cy.wrap(rsuitePickerPopupElement).find('[role="option"]').contains(value).scrollIntoView().forceClick();
|
|
923
383
|
});
|
|
384
|
+
// Close the picker popup by pressing the escape key
|
|
385
|
+
cy.get('body').type('{esc}');
|
|
386
|
+
cy.wrap(fieldElement).find('.rs-picker-popup').should('not.exist');
|
|
924
387
|
});
|
|
925
388
|
}
|
|
926
389
|
|
|
927
|
-
function
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
390
|
+
function pickMultiSelectOptions(fieldElement, values, label) {
|
|
391
|
+
cy.wrap(fieldElement).scrollIntoView({
|
|
392
|
+
offset: {
|
|
393
|
+
left: 0,
|
|
394
|
+
top: -100
|
|
931
395
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
396
|
+
});
|
|
397
|
+
// Clear the field if there is a clear button
|
|
398
|
+
const maybeClearButton = fieldElement.querySelector('.rs-stack > .rs-stack-item > .rs-picker-clean');
|
|
399
|
+
if (maybeClearButton) {
|
|
400
|
+
cy.wrap(fieldElement).find('.rs-stack > .rs-stack-item > .rs-picker-clean').click({
|
|
401
|
+
force: true
|
|
402
|
+
}).wait(250);
|
|
403
|
+
}
|
|
404
|
+
// If `values` is undefined, we don't need to select anything
|
|
405
|
+
if (!values) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
cy.wrap(fieldElement).find('.rs-picker-toggle').forceClick();
|
|
409
|
+
// Wait for the picker to open
|
|
410
|
+
cy.wrap(fieldElement).get('.rs-picker-popup').then(([rsuitePickerPopupElement])=>{
|
|
411
|
+
if (!rsuitePickerPopupElement) {
|
|
412
|
+
throwError(`Could not find '.rs-picker-popup' in in field with label "${label}". Did the picker open?`);
|
|
939
413
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
if
|
|
943
|
-
throw new Error('`selectMenuElement` is undefined.');
|
|
944
|
-
}
|
|
945
|
-
const maybeSearchInput = selectMenuElement.querySelector('.rs-picker-search-bar-input');
|
|
414
|
+
const maybeSearchInput = rsuitePickerPopupElement.querySelector('input[role="searchbox"]');
|
|
415
|
+
values.forEach((value)=>{
|
|
416
|
+
// Search for the value if there is a search input
|
|
946
417
|
if (maybeSearchInput) {
|
|
947
|
-
cy.wrap(
|
|
418
|
+
cy.wrap(rsuitePickerPopupElement).find('input[role="searchbox"]').type(value).wait(250);
|
|
948
419
|
}
|
|
949
|
-
cy.wrap(
|
|
950
|
-
force: true
|
|
951
|
-
});
|
|
420
|
+
cy.wrap(rsuitePickerPopupElement).find('[role="option"]').contains(value).scrollIntoView().forceClick();
|
|
952
421
|
});
|
|
422
|
+
// Close the picker popup by pressing the escape key
|
|
423
|
+
cy.get('body').type('{esc}');
|
|
424
|
+
cy.wrap(fieldElement).find('.rs-picker-popup').should('not.exist');
|
|
953
425
|
});
|
|
954
426
|
}
|
|
955
427
|
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
let foundElement;
|
|
962
|
-
let foundElementIndex = 0;
|
|
963
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
964
|
-
Cypress.$(inElement).find(selector)// eslint-disable-next-line func-names
|
|
965
|
-
.each(function() {
|
|
966
|
-
if (!foundElement) {
|
|
967
|
-
if (foundElementIndex < index) {
|
|
968
|
-
foundElementIndex += 1;
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
foundElement = this;
|
|
972
|
-
}
|
|
973
|
-
});
|
|
974
|
-
if (!foundElement && fallbackSelector) {
|
|
975
|
-
cy.log(`⚠️ Using fallback selector: "${fallbackSelector}"`);
|
|
976
|
-
const foundElementByFallbackSelector = Cypress.$(inElement).find(fallbackSelector);
|
|
977
|
-
return foundElementByFallbackSelector;
|
|
428
|
+
function pickSearchOption(fieldElement, value, _label) {
|
|
429
|
+
cy.wrap(fieldElement).scrollIntoView({
|
|
430
|
+
offset: {
|
|
431
|
+
left: 0,
|
|
432
|
+
top: -100
|
|
978
433
|
}
|
|
979
|
-
|
|
434
|
+
});
|
|
435
|
+
// Clear the field if there is a clear button
|
|
436
|
+
const maybeClearButton = fieldElement.querySelector('.Field-Search__ClearButton');
|
|
437
|
+
if (maybeClearButton) {
|
|
438
|
+
cy.wrap(fieldElement).find('.Field-Search__ClearButton').click({
|
|
439
|
+
force: true
|
|
440
|
+
}).wait(250);
|
|
980
441
|
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
442
|
+
// If the value is undefined, we don't need to select anything
|
|
443
|
+
if (!value) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
// Search for the value
|
|
447
|
+
cy.wrap(fieldElement).find('input[role="combobox"]').type(value);
|
|
448
|
+
// Wait for the picker to open
|
|
449
|
+
cy.wrap(fieldElement).get('.rs-picker-popup').then(([rsuitePickerPopupElement])=>{
|
|
450
|
+
// Select the first picker option
|
|
451
|
+
cy.wrap(rsuitePickerPopupElement).find('[role="option"]').first().scrollIntoView().forceClick().wait(250);
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function pickSelectOption(fieldElement, value, label) {
|
|
456
|
+
cy.wrap(fieldElement).scrollIntoView({
|
|
457
|
+
offset: {
|
|
458
|
+
left: 0,
|
|
459
|
+
top: -100
|
|
991
460
|
}
|
|
992
461
|
});
|
|
993
|
-
if
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
462
|
+
// Clear the field if there is a clear button
|
|
463
|
+
const maybeClearButton = fieldElement.querySelector('.rs-stack > .rs-stack-item > .rs-picker-clean');
|
|
464
|
+
if (maybeClearButton) {
|
|
465
|
+
cy.wrap(fieldElement).find('.rs-stack > .rs-stack-item > .rs-picker-clean').click({
|
|
466
|
+
force: true
|
|
467
|
+
}).wait(250);
|
|
998
468
|
}
|
|
999
|
-
|
|
469
|
+
// If the value is undefined, we don't need to select anything
|
|
470
|
+
if (!value) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
// Open the picker
|
|
474
|
+
cy.wrap(fieldElement).find('.rs-stack > .rs-stack-item > .rs-picker-caret-icon').forceClick().wait(250);
|
|
475
|
+
// Wait for the picker to open
|
|
476
|
+
cy.wrap(fieldElement).get('.rs-picker-popup').then(([rsuitePickerPopupElement])=>{
|
|
477
|
+
if (!rsuitePickerPopupElement) {
|
|
478
|
+
throwError(`Could not find '.rs-picker-popup' in in field with label "${label}". Did the picker open?`);
|
|
479
|
+
}
|
|
480
|
+
// Search for the value if there is a search input
|
|
481
|
+
const maybeSearchInput = rsuitePickerPopupElement.querySelector('input[role="searchbox"]');
|
|
482
|
+
if (maybeSearchInput) {
|
|
483
|
+
cy.wrap(rsuitePickerPopupElement).find('input[role="searchbox"]').type(value).wait(250);
|
|
484
|
+
}
|
|
485
|
+
cy.wrap(rsuitePickerPopupElement).find('[role="option"]').contains(value).scrollIntoView().forceClick().wait(250);
|
|
486
|
+
});
|
|
1000
487
|
}
|
|
1001
488
|
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
489
|
+
const throwAssertionError = (expectedType, component)=>throwError(`\`value\` should be of type \`${expectedType}\` in \`cy.fill(label, value)\` when used on a <${component} />.`);
|
|
490
|
+
function assertBooleanOrUndefined(value, component) {
|
|
491
|
+
if (value === undefined || typeof value === 'boolean') {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
throwAssertionError('boolean | undefined', component);
|
|
495
|
+
}
|
|
496
|
+
function assertDateTupleOrDateWithTimeTupleOrUndefined(value, component) {
|
|
497
|
+
if (value === undefined) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
if (Array.isArray(value) && (value.length === 3 || value.length === 5) && value.every((valueItem)=>typeof valueItem === 'number')) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
throwAssertionError('DateTuple | DateWithTimeTuple | undefined', component);
|
|
504
|
+
}
|
|
505
|
+
function assertDateRangeTupleOrDateWithTimeRangeTupleOrUndefined(value, component) {
|
|
506
|
+
if (value === undefined) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (Array.isArray(value) && value.length === 2 && (Array.isArray(value[0]) && value[0].length === 3 && value[1].length === 3 || Array.isArray(value[0]) && value[0].length === 5 && value[1].length === 5) && value.every((valueItem)=>Array.isArray(valueItem) && valueItem.every((valueItemItem)=>typeof valueItemItem === 'number'))) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
throwAssertionError('DateRangeTuple | DateWithTimeRangeTuple | undefined', component);
|
|
513
|
+
}
|
|
514
|
+
function assertNumberOrUndefined(value, component) {
|
|
515
|
+
if (value === undefined || typeof value === 'number') {
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
throwAssertionError('number | undefined', component);
|
|
519
|
+
}
|
|
520
|
+
function assertString(value, component) {
|
|
521
|
+
if (typeof value === 'string') {
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
throwAssertionError('string', component);
|
|
525
|
+
}
|
|
526
|
+
function assertStringOrUndefined(value, component) {
|
|
527
|
+
if (value === undefined || typeof value === 'string') {
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
throwAssertionError('string | undefined', component);
|
|
531
|
+
}
|
|
532
|
+
function assertStringArrayOrUndefined(value, component) {
|
|
533
|
+
if (value === undefined) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
if (Array.isArray(value) && value.every((valueItem)=>typeof valueItem === 'string')) {
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
throwAssertionError('string[] | undefined', component);
|
|
1006
540
|
}
|
|
1007
541
|
|
|
1008
542
|
const RETRIES = 5;
|
|
1009
543
|
function fill(label, value, leftRetries = RETRIES) {
|
|
1010
544
|
try {
|
|
1011
|
-
//
|
|
1012
|
-
// If
|
|
545
|
+
// =========================================================================
|
|
546
|
+
// If it's a field labelled by a `<label />` element
|
|
1013
547
|
const labelElement = findElementBytext('label', label);
|
|
1014
548
|
if (labelElement) {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
const htmlforElement = findElementBySelector(`[id="${labelElement.htmlFor}"]`);
|
|
1019
|
-
if (!htmlforElement) {
|
|
1020
|
-
throw new Error(`Could not find the element with [id="${labelElement.htmlFor}"] targetted by label "${label}" (via its \`for\` attribute).`);
|
|
1021
|
-
}
|
|
1022
|
-
const cypressHtmlforElement = cy.get(`[id="${labelElement.htmlFor}"]`);
|
|
1023
|
-
cypressHtmlforElement.then(()=>{
|
|
1024
|
-
if (htmlforElement.classList.contains('rs-picker-toggle-textbox')) {
|
|
1025
|
-
const rsuitePickerElement = htmlforElement.parentElement && htmlforElement.parentElement.parentElement && htmlforElement.parentElement.parentElement.parentElement ? htmlforElement.parentElement.parentElement.parentElement.parentElement : undefined;
|
|
1026
|
-
if (!rsuitePickerElement) {
|
|
1027
|
-
throw new Error('This should never happen.');
|
|
1028
|
-
}
|
|
1029
|
-
switch(true){
|
|
1030
|
-
// Select
|
|
1031
|
-
case rsuitePickerElement.classList.contains('rs-picker-select'):
|
|
1032
|
-
pickSelectOption(cypressHtmlforElement, value !== undefined ? String(value) : value);
|
|
1033
|
-
break;
|
|
1034
|
-
// Multi Select
|
|
1035
|
-
case rsuitePickerElement.classList.contains('rs-picker-tag'):
|
|
1036
|
-
pickMultiSelectOptions(cypressHtmlforElement, Array.isArray(value) && value.length > 0 ? value : undefined);
|
|
1037
|
-
break;
|
|
1038
|
-
// Check Picker
|
|
1039
|
-
case rsuitePickerElement.classList.contains('rs-picker-check'):
|
|
1040
|
-
pickCheckPickerOptions(cypressHtmlforElement, Array.isArray(value) && value.length > 0 ? value : undefined);
|
|
1041
|
-
break;
|
|
1042
|
-
default:
|
|
1043
|
-
throw new Error(`\`cy.fill()\` can't handle Rsuite picker with class "${rsuitePickerElement.className}" elements.`);
|
|
1044
|
-
}
|
|
1045
|
-
return;
|
|
1046
|
-
}
|
|
1047
|
-
switch(htmlforElement.tagName){
|
|
1048
|
-
// Text/Number Input
|
|
1049
|
-
case 'INPUT':
|
|
1050
|
-
fillTextInput(htmlforElement, value !== undefined ? String(value) : value);
|
|
1051
|
-
break;
|
|
1052
|
-
// Textarea
|
|
1053
|
-
case 'TEXTAREA':
|
|
1054
|
-
fillTextarea(htmlforElement, value !== undefined ? String(value) : value);
|
|
1055
|
-
break;
|
|
1056
|
-
default:
|
|
1057
|
-
throw new Error(`\`cy.fill()\` doesn't handle "${htmlforElement.tagName}" elements.`);
|
|
1058
|
-
}
|
|
1059
|
-
});
|
|
1060
|
-
return;
|
|
1061
|
-
}
|
|
1062
|
-
// -------------------------------------------------------------------------
|
|
1063
|
-
// If the label doesn't have a `for` attribute
|
|
1064
|
-
// Checkbox Input
|
|
1065
|
-
const checkboxInputElement = labelElement.querySelector('input[type="checkbox"]');
|
|
1066
|
-
if (checkboxInputElement) {
|
|
1067
|
-
checkCheckbox(checkboxInputElement, Boolean(value));
|
|
1068
|
-
return;
|
|
1069
|
-
}
|
|
1070
|
-
// Text Input
|
|
1071
|
-
const textInputElement = labelElement.querySelector('input[type="text"]');
|
|
1072
|
-
if (textInputElement) {
|
|
1073
|
-
fillTextInput(textInputElement, String(value));
|
|
1074
|
-
return;
|
|
549
|
+
const fieldElement = findElementParentBySelector(labelElement, '.Element-Field');
|
|
550
|
+
if (!fieldElement) {
|
|
551
|
+
throwError(`Could not find '.Element-Field' in field with label "${label}".`);
|
|
1075
552
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
553
|
+
switch(true){
|
|
554
|
+
// ---------------------------------------------------------------------
|
|
555
|
+
// Checkbox
|
|
556
|
+
case fieldElement.classList.contains('Field-Checkbox'):
|
|
557
|
+
assertBooleanOrUndefined(value, 'Checkbox');
|
|
558
|
+
checkCheckbox(fieldElement, value, label);
|
|
559
|
+
return;
|
|
560
|
+
// ---------------------------------------------------------------------
|
|
561
|
+
// CheckPicker
|
|
562
|
+
case fieldElement.classList.contains('Field-CheckPicker'):
|
|
563
|
+
assertStringArrayOrUndefined(value, 'CheckPicker');
|
|
564
|
+
pickCheckPickerOptions(fieldElement, value, label);
|
|
565
|
+
return;
|
|
566
|
+
// ---------------------------------------------------------------------
|
|
567
|
+
// MultiSelect
|
|
568
|
+
case fieldElement.classList.contains('Field-MultiSelect'):
|
|
569
|
+
assertStringArrayOrUndefined(value, 'MultiSelect');
|
|
570
|
+
pickMultiSelectOptions(fieldElement, value, label);
|
|
571
|
+
return;
|
|
572
|
+
// ---------------------------------------------------------------------
|
|
573
|
+
// Search
|
|
574
|
+
case fieldElement.classList.contains('Field-Search'):
|
|
575
|
+
assertStringOrUndefined(value, 'Search');
|
|
576
|
+
pickSearchOption(fieldElement, value, label);
|
|
577
|
+
return;
|
|
578
|
+
// ---------------------------------------------------------------------
|
|
579
|
+
// Select
|
|
580
|
+
case fieldElement.classList.contains('Field-Select'):
|
|
581
|
+
assertStringOrUndefined(value, 'Select');
|
|
582
|
+
pickSelectOption(fieldElement, value, label);
|
|
583
|
+
return;
|
|
584
|
+
// ---------------------------------------------------------------------
|
|
585
|
+
// NumberInput
|
|
586
|
+
case fieldElement.classList.contains('Field-NumberInput'):
|
|
587
|
+
assertNumberOrUndefined(value, 'TextInput');
|
|
588
|
+
fillNumberInput(fieldElement, value, label);
|
|
589
|
+
return;
|
|
590
|
+
// ---------------------------------------------------------------------
|
|
591
|
+
// Textarea
|
|
592
|
+
case fieldElement.classList.contains('Field-Textarea'):
|
|
593
|
+
assertStringOrUndefined(value, 'Textarea');
|
|
594
|
+
fillTextarea(fieldElement, value, label);
|
|
595
|
+
return;
|
|
596
|
+
// ---------------------------------------------------------------------
|
|
597
|
+
// TextInput
|
|
598
|
+
case fieldElement.classList.contains('Field-TextInput'):
|
|
599
|
+
assertStringOrUndefined(value, 'TextInput');
|
|
600
|
+
fillTextInput(fieldElement, value, label);
|
|
601
|
+
return;
|
|
602
|
+
default:
|
|
603
|
+
throwError(`\`cy.fill()\` can't handle field with \`<label>\` "${label}".`);
|
|
1081
604
|
}
|
|
1082
|
-
throw new Error(`Could find neither a checkbox, an input nor a textarea with the label "${label}".`);
|
|
1083
605
|
}
|
|
1084
|
-
//
|
|
1085
|
-
// If
|
|
606
|
+
// =========================================================================
|
|
607
|
+
// If it's a field labelled by a `<legend />` element
|
|
1086
608
|
const legendElement = findElementBytext('legend', label);
|
|
1087
609
|
if (legendElement) {
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
}
|
|
1099
|
-
fillDatePicker(fieldsetElement, value);
|
|
610
|
+
const fieldsetElement = findElementParentBySelector(legendElement, '.Element-Fieldset');
|
|
611
|
+
if (!fieldsetElement) {
|
|
612
|
+
throwError(`Could not find '.Element-Fieldset' in field with \`<legend />\` "${label}".`);
|
|
613
|
+
}
|
|
614
|
+
switch(true){
|
|
615
|
+
// ---------------------------------------------------------------------
|
|
616
|
+
// DatePicker
|
|
617
|
+
case fieldsetElement.classList.contains('Field-DatePicker'):
|
|
618
|
+
assertDateTupleOrDateWithTimeTupleOrUndefined(value, 'DatePicker');
|
|
619
|
+
fillDatePicker(fieldsetElement, value, label);
|
|
1100
620
|
return;
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
fillDateRangePicker(fieldsetElement, value);
|
|
621
|
+
// ---------------------------------------------------------------------
|
|
622
|
+
// DateRangePicker
|
|
623
|
+
case fieldsetElement.classList.contains('Field-DateRangePicker'):
|
|
624
|
+
assertDateRangeTupleOrDateWithTimeRangeTupleOrUndefined(value, 'DateRangePicker');
|
|
625
|
+
fillDateRangePicker(fieldsetElement, value, label);
|
|
1107
626
|
return;
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
checkMultiCheckboxOptions(fieldsetElement,
|
|
627
|
+
// ---------------------------------------------------------------------
|
|
628
|
+
// MultiCheckbox
|
|
629
|
+
case fieldsetElement.classList.contains('Field-MultiCheckbox'):
|
|
630
|
+
assertStringArrayOrUndefined(value, 'MultiCheckbox');
|
|
631
|
+
checkMultiCheckboxOptions(fieldsetElement, value, label);
|
|
1113
632
|
return;
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
633
|
+
// ---------------------------------------------------------------------
|
|
634
|
+
// MultiRadio
|
|
635
|
+
case fieldsetElement.classList.contains('Field-MultiRadio'):
|
|
636
|
+
assertString(value, 'MultiRadio');
|
|
637
|
+
checkMultiRadioOption(fieldsetElement, value, label);
|
|
1117
638
|
return;
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
}
|
|
1121
|
-
return;
|
|
639
|
+
default:
|
|
640
|
+
throwError(`\`cy.fill()\` can't handle the input element in field with \`<legend>\` "${label}".`);
|
|
641
|
+
}
|
|
1122
642
|
}
|
|
1123
|
-
|
|
643
|
+
throwError(`Could not find a field labelled by a \`<label />\` or \`<legend />\` "${label}".`);
|
|
1124
644
|
} catch (err) {
|
|
1125
645
|
if (leftRetries > 0) {
|
|
1126
646
|
cy.wait(250).then(()=>{
|
|
1127
|
-
cy.log(`Retrying (${RETRIES - leftRetries + 1} / ${RETRIES})...`);
|
|
647
|
+
cy.log(`[monitor-ui > Cypress] Retrying (${RETRIES - leftRetries + 1} / ${RETRIES})...`);
|
|
1128
648
|
fill(label, value, leftRetries - 1);
|
|
1129
649
|
});
|
|
1130
650
|
return;
|
|
1131
651
|
}
|
|
1132
|
-
|
|
652
|
+
const normalizedError = err instanceof Error ? err : new Error(String(err));
|
|
653
|
+
Cypress.log({
|
|
654
|
+
consoleProps: ()=>({
|
|
655
|
+
err,
|
|
656
|
+
label,
|
|
657
|
+
value
|
|
658
|
+
}),
|
|
659
|
+
displayName: 'ERROR',
|
|
660
|
+
message: String(normalizedError.message),
|
|
661
|
+
name: 'fill'
|
|
662
|
+
}).error(normalizedError);
|
|
663
|
+
throwError([
|
|
664
|
+
`Could not find or fill field with label or legend "${label}" after ${RETRIES} attempts.`,
|
|
665
|
+
`This error was thrown: “${normalizedError.message}”`,
|
|
666
|
+
`Please check the Cypress "- ERROR" log above for more details.`
|
|
667
|
+
].join('\n'));
|
|
1133
668
|
}
|
|
1134
669
|
}
|
|
1135
670
|
|
|
@@ -1137,6 +672,13 @@ function forceClick([subject]) {
|
|
|
1137
672
|
if (!subject) {
|
|
1138
673
|
throw new Error(`Could not find subject.`);
|
|
1139
674
|
}
|
|
675
|
+
Cypress.log({
|
|
676
|
+
consoleProps: ()=>({
|
|
677
|
+
'Applied to': subject,
|
|
678
|
+
Elements: 1
|
|
679
|
+
}),
|
|
680
|
+
name: 'forceClick'
|
|
681
|
+
});
|
|
1140
682
|
try {
|
|
1141
683
|
return subject.click({
|
|
1142
684
|
force: true
|