@mtes-mct/monitor-ui 13.2.0 → 13.3.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 +7 -0
- package/cypress/global.d.ts +1 -0
- package/cypress/index.js +45 -19
- package/index.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [13.2.0](https://github.com/MTES-MCT/monitor-ui/compare/v13.1.0...v13.2.0) (2024-03-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **utils:** delete "(UTC)" from humanizePastDate function ([91507d1](https://github.com/MTES-MCT/monitor-ui/commit/91507d17426190f38fddba32c03c50937c0ba6f2))
|
|
7
|
+
|
|
1
8
|
## [13.1.0](https://github.com/MTES-MCT/monitor-ui/compare/v13.0.0...v13.1.0) (2024-03-07)
|
|
2
9
|
|
|
3
10
|
|
package/cypress/global.d.ts
CHANGED
package/cypress/index.js
CHANGED
|
@@ -204,6 +204,7 @@ function checkMultiRadioOption(fieldsetElement, value, _label, force) {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
const DEFAULT_OPTIONS = {
|
|
207
|
+
delay: 10,
|
|
207
208
|
force: true,
|
|
208
209
|
retries: 5
|
|
209
210
|
};
|
|
@@ -212,7 +213,7 @@ function throwError(message) {
|
|
|
212
213
|
throw new Error(`[monitor-ui > Cypress] ${message}`);
|
|
213
214
|
}
|
|
214
215
|
|
|
215
|
-
function fillDatePicker(fieldsetElement, dateOrDateWithTimeTuple, _label, force) {
|
|
216
|
+
function fillDatePicker(fieldsetElement, dateOrDateWithTimeTuple, _label, force, delay) {
|
|
216
217
|
Cypress.log({
|
|
217
218
|
consoleProps: ()=>({
|
|
218
219
|
'Applied to': fieldsetElement,
|
|
@@ -249,20 +250,25 @@ function fillDatePicker(fieldsetElement, dateOrDateWithTimeTuple, _label, force)
|
|
|
249
250
|
} else {
|
|
250
251
|
const [year, month, day] = dateOrDateWithTimeTuple;
|
|
251
252
|
cy.wrap(fieldsetElement).find('[aria-label="Jour"]').type(String(day).padStart(2, '0'), {
|
|
253
|
+
delay,
|
|
252
254
|
force
|
|
253
255
|
});
|
|
254
256
|
cy.wrap(fieldsetElement).find('[aria-label="Mois"]').type(String(month).padStart(2, '0'), {
|
|
257
|
+
delay,
|
|
255
258
|
force
|
|
256
259
|
});
|
|
257
260
|
cy.wrap(fieldsetElement).find('[aria-label="Année"]').type(String(year), {
|
|
261
|
+
delay,
|
|
258
262
|
force
|
|
259
263
|
});
|
|
260
264
|
if (hasTimeInputs) {
|
|
261
265
|
const [hour, minute] = dateOrDateWithTimeTuple.slice(3);
|
|
262
266
|
cy.wrap(fieldsetElement).find('[aria-label="Heure"]').type(String(hour).padStart(2, '0'), {
|
|
267
|
+
delay,
|
|
263
268
|
force
|
|
264
269
|
});
|
|
265
270
|
cy.wrap(fieldsetElement).find('[aria-label="Minute"]').type(String(minute).padStart(2, '0'), {
|
|
271
|
+
delay,
|
|
266
272
|
force
|
|
267
273
|
});
|
|
268
274
|
}
|
|
@@ -270,6 +276,7 @@ function fillDatePicker(fieldsetElement, dateOrDateWithTimeTuple, _label, force)
|
|
|
270
276
|
cy.wait(250);
|
|
271
277
|
// Close the calendar & ranged time picker popup by pressing the escape key
|
|
272
278
|
cy.get('body').type('{esc}', {
|
|
279
|
+
delay,
|
|
273
280
|
force
|
|
274
281
|
});
|
|
275
282
|
// TODO Create a util to handle the `fieldsetElement` re-creation cases.
|
|
@@ -279,7 +286,7 @@ function fillDatePicker(fieldsetElement, dateOrDateWithTimeTuple, _label, force)
|
|
|
279
286
|
// cy.wrap(fieldsetElement).find('.Field-DateRangePicker__RangedTimePicker').should('not.exist')
|
|
280
287
|
}
|
|
281
288
|
|
|
282
|
-
function fillDateRangePicker(fieldsetElement, dateOrDateWithTimeTupleRange, _label, force) {
|
|
289
|
+
function fillDateRangePicker(fieldsetElement, dateOrDateWithTimeTupleRange, _label, force, delay) {
|
|
283
290
|
Cypress.log({
|
|
284
291
|
consoleProps: ()=>({
|
|
285
292
|
'Applied to': fieldsetElement,
|
|
@@ -333,9 +340,11 @@ function fillDateRangePicker(fieldsetElement, dateOrDateWithTimeTupleRange, _lab
|
|
|
333
340
|
const [startYear, startMonth, startDay, startHour, startMinute] = startDateOrDateWithTimeTuple;
|
|
334
341
|
const [endYear, endMonth, endDay, endHour, endMinute] = endDateOrDateWithTimeTuple;
|
|
335
342
|
cy.wrap(fieldsetElement).find('[aria-label="Jour de début"]').type(String(startDay).padStart(2, '0'), {
|
|
343
|
+
delay,
|
|
336
344
|
force
|
|
337
345
|
});
|
|
338
346
|
cy.wrap(fieldsetElement).find('[aria-label="Mois de début"]').type(String(startMonth).padStart(2, '0'), {
|
|
347
|
+
delay,
|
|
339
348
|
force
|
|
340
349
|
});
|
|
341
350
|
cy.wrap(fieldsetElement).find('[aria-label="Année de début"]').type(String(startYear), {
|
|
@@ -343,6 +352,7 @@ function fillDateRangePicker(fieldsetElement, dateOrDateWithTimeTupleRange, _lab
|
|
|
343
352
|
});
|
|
344
353
|
if (hasTimeInput) {
|
|
345
354
|
cy.wrap(fieldsetElement).find('[aria-label="Heure de début"]').type(String(startHour).padStart(2, '0'), {
|
|
355
|
+
delay,
|
|
346
356
|
force
|
|
347
357
|
});
|
|
348
358
|
cy.wrap(fieldsetElement).find('[aria-label="Minute de début"]').type(String(startMinute).padStart(2, '0'), {
|
|
@@ -350,9 +360,11 @@ function fillDateRangePicker(fieldsetElement, dateOrDateWithTimeTupleRange, _lab
|
|
|
350
360
|
});
|
|
351
361
|
}
|
|
352
362
|
cy.wrap(fieldsetElement).find('[aria-label="Jour de fin"]').type(String(endDay).padStart(2, '0'), {
|
|
363
|
+
delay,
|
|
353
364
|
force
|
|
354
365
|
});
|
|
355
366
|
cy.wrap(fieldsetElement).find('[aria-label="Mois de fin"]').type(String(endMonth).padStart(2, '0'), {
|
|
367
|
+
delay,
|
|
356
368
|
force
|
|
357
369
|
});
|
|
358
370
|
cy.wrap(fieldsetElement).find('[aria-label="Année de fin"]').type(String(endYear), {
|
|
@@ -360,9 +372,11 @@ function fillDateRangePicker(fieldsetElement, dateOrDateWithTimeTupleRange, _lab
|
|
|
360
372
|
});
|
|
361
373
|
if (hasTimeInput) {
|
|
362
374
|
cy.wrap(fieldsetElement).find('[aria-label="Heure de fin"]').type(String(endHour).padStart(2, '0'), {
|
|
375
|
+
delay,
|
|
363
376
|
force
|
|
364
377
|
});
|
|
365
378
|
cy.wrap(fieldsetElement).find('[aria-label="Minute de fin"]').type(String(endMinute).padStart(2, '0'), {
|
|
379
|
+
delay,
|
|
366
380
|
force
|
|
367
381
|
});
|
|
368
382
|
}
|
|
@@ -370,6 +384,7 @@ function fillDateRangePicker(fieldsetElement, dateOrDateWithTimeTupleRange, _lab
|
|
|
370
384
|
cy.wait(250);
|
|
371
385
|
// Close the range calendar & ranged time picker popup by pressing the escape key
|
|
372
386
|
cy.get('body').type('{esc}', {
|
|
387
|
+
delay,
|
|
373
388
|
force
|
|
374
389
|
});
|
|
375
390
|
// TODO Create a util to handle the `fieldsetElement` re-creation cases.
|
|
@@ -379,7 +394,7 @@ function fillDateRangePicker(fieldsetElement, dateOrDateWithTimeTupleRange, _lab
|
|
|
379
394
|
// cy.wrap(fieldsetElement).find('.Field-DateRangePicker__RangedTimePicker').should('not.exist')
|
|
380
395
|
}
|
|
381
396
|
|
|
382
|
-
function fillNumberInput(fieldElement, value, _label, force) {
|
|
397
|
+
function fillNumberInput(fieldElement, value, _label, force, delay) {
|
|
383
398
|
Cypress.log({
|
|
384
399
|
consoleProps: ()=>({
|
|
385
400
|
'Applied to': fieldElement,
|
|
@@ -401,11 +416,12 @@ function fillNumberInput(fieldElement, value, _label, force) {
|
|
|
401
416
|
return;
|
|
402
417
|
}
|
|
403
418
|
cy.wrap(fieldElement).find('input[type="number"]').type(String(value), {
|
|
419
|
+
delay,
|
|
404
420
|
force
|
|
405
421
|
}).wait(250);
|
|
406
422
|
}
|
|
407
423
|
|
|
408
|
-
function fillTextarea(fieldElement, value, _label, force) {
|
|
424
|
+
function fillTextarea(fieldElement, value, _label, force, delay) {
|
|
409
425
|
Cypress.log({
|
|
410
426
|
consoleProps: ()=>({
|
|
411
427
|
'Applied to': fieldElement,
|
|
@@ -427,11 +443,12 @@ function fillTextarea(fieldElement, value, _label, force) {
|
|
|
427
443
|
return;
|
|
428
444
|
}
|
|
429
445
|
cy.wrap(fieldElement).find('textarea').type(value, {
|
|
446
|
+
delay,
|
|
430
447
|
force
|
|
431
448
|
}).wait(250);
|
|
432
449
|
}
|
|
433
450
|
|
|
434
|
-
function fillTextInput(fieldElement, value, _label, force) {
|
|
451
|
+
function fillTextInput(fieldElement, value, _label, force, delay) {
|
|
435
452
|
Cypress.log({
|
|
436
453
|
consoleProps: ()=>({
|
|
437
454
|
'Applied to': fieldElement,
|
|
@@ -453,11 +470,12 @@ function fillTextInput(fieldElement, value, _label, force) {
|
|
|
453
470
|
return;
|
|
454
471
|
}
|
|
455
472
|
cy.wrap(fieldElement).find('input').type(value, {
|
|
473
|
+
delay,
|
|
456
474
|
force
|
|
457
475
|
}).wait(250);
|
|
458
476
|
}
|
|
459
477
|
|
|
460
|
-
function pickCheckPickerOptions(fieldElement, values, label, force) {
|
|
478
|
+
function pickCheckPickerOptions(fieldElement, values, label, force, delay) {
|
|
461
479
|
Cypress.log({
|
|
462
480
|
consoleProps: ()=>({
|
|
463
481
|
'Applied to': fieldElement,
|
|
@@ -495,6 +513,7 @@ function pickCheckPickerOptions(fieldElement, values, label, force) {
|
|
|
495
513
|
values.forEach((value)=>{
|
|
496
514
|
if (maybeSearchInput) {
|
|
497
515
|
cy.wrap(rsuitePickerPopupElement).find('input[role="searchbox"]').type(value, {
|
|
516
|
+
delay,
|
|
498
517
|
force
|
|
499
518
|
}).wait(250);
|
|
500
519
|
}
|
|
@@ -504,6 +523,7 @@ function pickCheckPickerOptions(fieldElement, values, label, force) {
|
|
|
504
523
|
});
|
|
505
524
|
// Close the picker popup by pressing the escape key
|
|
506
525
|
cy.get('body').type('{esc}', {
|
|
526
|
+
delay,
|
|
507
527
|
force
|
|
508
528
|
});
|
|
509
529
|
// TODO Create a util to handle the `fieldElement` re-creation cases.
|
|
@@ -513,7 +533,7 @@ function pickCheckPickerOptions(fieldElement, values, label, force) {
|
|
|
513
533
|
});
|
|
514
534
|
}
|
|
515
535
|
|
|
516
|
-
function pickMultiSelectOptions(fieldElement, values, label, force) {
|
|
536
|
+
function pickMultiSelectOptions(fieldElement, values, label, force, delay) {
|
|
517
537
|
Cypress.log({
|
|
518
538
|
consoleProps: ()=>({
|
|
519
539
|
'Applied to': fieldElement,
|
|
@@ -550,6 +570,7 @@ function pickMultiSelectOptions(fieldElement, values, label, force) {
|
|
|
550
570
|
cy.wrap(fieldElement).find('.rs-picker-toggle').click({
|
|
551
571
|
force
|
|
552
572
|
}).wait(250).type(value, {
|
|
573
|
+
delay,
|
|
553
574
|
force
|
|
554
575
|
}).wait(250);
|
|
555
576
|
cy.wrap(rsuitePickerPopupElement).find('[role="option"]').contains(value).scrollIntoView().click({
|
|
@@ -557,7 +578,10 @@ function pickMultiSelectOptions(fieldElement, values, label, force) {
|
|
|
557
578
|
});
|
|
558
579
|
});
|
|
559
580
|
// Close the picker popup by pressing the escape key
|
|
560
|
-
cy.get('body').type('{esc}'
|
|
581
|
+
cy.get('body').type('{esc}', {
|
|
582
|
+
delay,
|
|
583
|
+
force
|
|
584
|
+
});
|
|
561
585
|
// TODO Create a util to handle the `fieldElement` re-creation cases.
|
|
562
586
|
// We to use a `wait` as a temporary fix to handle `fieldElement` re-creation cases.
|
|
563
587
|
cy.wait(250);
|
|
@@ -565,7 +589,7 @@ function pickMultiSelectOptions(fieldElement, values, label, force) {
|
|
|
565
589
|
});
|
|
566
590
|
}
|
|
567
591
|
|
|
568
|
-
function pickSearchOption(fieldElement, value, _label, force) {
|
|
592
|
+
function pickSearchOption(fieldElement, value, _label, force, delay) {
|
|
569
593
|
Cypress.log({
|
|
570
594
|
consoleProps: ()=>({
|
|
571
595
|
'Applied to': fieldElement,
|
|
@@ -592,6 +616,7 @@ function pickSearchOption(fieldElement, value, _label, force) {
|
|
|
592
616
|
}
|
|
593
617
|
// Search for the value
|
|
594
618
|
cy.wrap(fieldElement).find('input[role="combobox"]').type(value, {
|
|
619
|
+
delay,
|
|
595
620
|
force
|
|
596
621
|
});
|
|
597
622
|
// Wait for the picker to open
|
|
@@ -603,7 +628,7 @@ function pickSearchOption(fieldElement, value, _label, force) {
|
|
|
603
628
|
});
|
|
604
629
|
}
|
|
605
630
|
|
|
606
|
-
function pickSelectOption(fieldElement, value, label, force) {
|
|
631
|
+
function pickSelectOption(fieldElement, value, label, force, delay) {
|
|
607
632
|
Cypress.log({
|
|
608
633
|
consoleProps: ()=>({
|
|
609
634
|
'Applied to': fieldElement,
|
|
@@ -641,6 +666,7 @@ function pickSelectOption(fieldElement, value, label, force) {
|
|
|
641
666
|
const maybeSearchInput = rsuitePickerPopupElement.querySelector('input[role="searchbox"]');
|
|
642
667
|
if (maybeSearchInput) {
|
|
643
668
|
cy.wrap(rsuitePickerPopupElement).find('input[role="searchbox"]').type(value, {
|
|
669
|
+
delay,
|
|
644
670
|
force
|
|
645
671
|
}).wait(250);
|
|
646
672
|
}
|
|
@@ -739,43 +765,43 @@ function fill(label, value, options = {}) {
|
|
|
739
765
|
// CheckPicker
|
|
740
766
|
case fieldElement.classList.contains('Field-CheckPicker'):
|
|
741
767
|
assertStringArrayOrUndefined(value, 'CheckPicker');
|
|
742
|
-
pickCheckPickerOptions(fieldElement, value, label, controlledOptions.force);
|
|
768
|
+
pickCheckPickerOptions(fieldElement, value, label, controlledOptions.force, controlledOptions.delay);
|
|
743
769
|
return;
|
|
744
770
|
// ---------------------------------------------------------------------
|
|
745
771
|
// MultiSelect
|
|
746
772
|
case fieldElement.classList.contains('Field-MultiSelect'):
|
|
747
773
|
assertStringArrayOrUndefined(value, 'MultiSelect');
|
|
748
|
-
pickMultiSelectOptions(fieldElement, value, label, controlledOptions.force);
|
|
774
|
+
pickMultiSelectOptions(fieldElement, value, label, controlledOptions.force, controlledOptions.delay);
|
|
749
775
|
return;
|
|
750
776
|
// ---------------------------------------------------------------------
|
|
751
777
|
// Search
|
|
752
778
|
case fieldElement.classList.contains('Field-Search'):
|
|
753
779
|
assertStringOrUndefined(value, 'Search');
|
|
754
|
-
pickSearchOption(fieldElement, value, label, controlledOptions.force);
|
|
780
|
+
pickSearchOption(fieldElement, value, label, controlledOptions.force, controlledOptions.delay);
|
|
755
781
|
return;
|
|
756
782
|
// ---------------------------------------------------------------------
|
|
757
783
|
// Select
|
|
758
784
|
case fieldElement.classList.contains('Field-Select'):
|
|
759
785
|
assertStringOrUndefined(value, 'Select');
|
|
760
|
-
pickSelectOption(fieldElement, value, label, controlledOptions.force);
|
|
786
|
+
pickSelectOption(fieldElement, value, label, controlledOptions.force, controlledOptions.delay);
|
|
761
787
|
return;
|
|
762
788
|
// ---------------------------------------------------------------------
|
|
763
789
|
// NumberInput
|
|
764
790
|
case fieldElement.classList.contains('Field-NumberInput'):
|
|
765
791
|
assertNumberOrUndefined(value, 'TextInput');
|
|
766
|
-
fillNumberInput(fieldElement, value, label, controlledOptions.force);
|
|
792
|
+
fillNumberInput(fieldElement, value, label, controlledOptions.force, controlledOptions.delay);
|
|
767
793
|
return;
|
|
768
794
|
// ---------------------------------------------------------------------
|
|
769
795
|
// Textarea
|
|
770
796
|
case fieldElement.classList.contains('Field-Textarea'):
|
|
771
797
|
assertStringOrUndefined(value, 'Textarea');
|
|
772
|
-
fillTextarea(fieldElement, value, label, controlledOptions.force);
|
|
798
|
+
fillTextarea(fieldElement, value, label, controlledOptions.force, controlledOptions.delay);
|
|
773
799
|
return;
|
|
774
800
|
// ---------------------------------------------------------------------
|
|
775
801
|
// TextInput
|
|
776
802
|
case fieldElement.classList.contains('Field-TextInput'):
|
|
777
803
|
assertStringOrUndefined(value, 'TextInput');
|
|
778
|
-
fillTextInput(fieldElement, value, label, controlledOptions.force);
|
|
804
|
+
fillTextInput(fieldElement, value, label, controlledOptions.force, controlledOptions.delay);
|
|
779
805
|
return;
|
|
780
806
|
default:
|
|
781
807
|
throwError(`\`cy.fill()\` can't handle field with \`<label>\` "${label}".`);
|
|
@@ -794,13 +820,13 @@ function fill(label, value, options = {}) {
|
|
|
794
820
|
// DatePicker
|
|
795
821
|
case fieldsetElement.classList.contains('Field-DatePicker'):
|
|
796
822
|
assertDateTupleOrDateWithTimeTupleOrUndefined(value, 'DatePicker');
|
|
797
|
-
fillDatePicker(fieldsetElement, value, label, controlledOptions.force);
|
|
823
|
+
fillDatePicker(fieldsetElement, value, label, controlledOptions.force, controlledOptions.delay);
|
|
798
824
|
return;
|
|
799
825
|
// ---------------------------------------------------------------------
|
|
800
826
|
// DateRangePicker
|
|
801
827
|
case fieldsetElement.classList.contains('Field-DateRangePicker'):
|
|
802
828
|
assertDateRangeTupleOrDateWithTimeRangeTupleOrUndefined(value, 'DateRangePicker');
|
|
803
|
-
fillDateRangePicker(fieldsetElement, value, label, controlledOptions.force);
|
|
829
|
+
fillDateRangePicker(fieldsetElement, value, label, controlledOptions.force, controlledOptions.delay);
|
|
804
830
|
return;
|
|
805
831
|
// ---------------------------------------------------------------------
|
|
806
832
|
// MultiCheckbox
|
package/index.js
CHANGED
|
@@ -68109,6 +68109,7 @@ const StyledCloseButton = styled(IconButton)`
|
|
|
68109
68109
|
position: absolute;
|
|
68110
68110
|
right: 0;
|
|
68111
68111
|
top: 0;
|
|
68112
|
+
margin: ${(p)=>p.$size === Size.LARGE ? 9 : 5}px;
|
|
68112
68113
|
|
|
68113
68114
|
${(p)=>!p.$isSearchIconHidden && `
|
|
68114
68115
|
margin: ${p.$size === Size.LARGE ? '8.5px 50px 0 0' : '4px 39px 0 0'};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtes-mct/monitor-ui",
|
|
3
3
|
"description": "Common React components, hooks, utilities and CSS stylesheets for MonitorFish, MonitorEnv and RapportNav.",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.3.0",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|