@baloise/ds-testing 16.0.3-nightly.20240417 → 16.1.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/bal-input-stepper.command.esm.js +19 -13
- package/helpers.esm.js +4 -1
- package/index.esm2.js +14 -0
- package/package.json +2 -2
- package/src/commands/helpers.d.ts +1 -0
- package/src/selectors/index.d.ts +18 -0
- package/type.command.esm.js +101 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b as byTestId, s as selectors } from './index.esm2.js';
|
|
2
|
-
import { w as wrapOptions, l as log, c as checkAriaLabel, a as waitAfterFramePaint, b as waitAfterIdleCallback, d as areComponentsReady, e as deepReady, _ as _extends } from './helpers.esm.js';
|
|
2
|
+
import { w as wrapOptions, l as log, c as checkAriaLabel, a as waitAfterFramePaint, b as waitAfterIdleCallback, d as areComponentsReady, e as deepReady, _ as _extends, f as isDropDown } from './helpers.esm.js';
|
|
3
3
|
import { balViewport } from './viewports.esm.js';
|
|
4
4
|
|
|
5
5
|
Cypress.Commands.add("getByTestId", function(testID, options) {
|
|
@@ -50,13 +50,13 @@ Cypress.Commands.add("getByLabelText", {
|
|
|
50
50
|
if (subject) {
|
|
51
51
|
return cy.wrap(subject, o).contains("label", labelText, o).invoke(o, "attr", "for").then(function(forAttributeValue) {
|
|
52
52
|
return cy.get('input[id="' + forAttributeValue + '"], textarea[id="' + forAttributeValue + '"], button[id="' + forAttributeValue + '"]', o);
|
|
53
|
-
}).then(o, function($el) {
|
|
53
|
+
}).first(o).then(o, function($el) {
|
|
54
54
|
return log(!!subject ? "-getByLabelText" : "getByLabelText", labelText, $el, options);
|
|
55
55
|
});
|
|
56
56
|
} else {
|
|
57
57
|
return cy.contains("label", labelText, o).invoke(o, "attr", "for").then(function(forAttributeValue) {
|
|
58
58
|
return cy.get('input[id="' + forAttributeValue + '"], textarea[id="' + forAttributeValue + '"], button[id="' + forAttributeValue + '"]', o);
|
|
59
|
-
}).then(o, function($el) {
|
|
59
|
+
}).first(o).then(o, function($el) {
|
|
60
60
|
return log(!!subject ? "-getByLabelText" : "getByLabelText", labelText, $el, options);
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -67,7 +67,8 @@ Cypress.Commands.add("getByPlaceholder", {
|
|
|
67
67
|
]
|
|
68
68
|
}, function(subject, placeholder, options) {
|
|
69
69
|
var o = wrapOptions(options);
|
|
70
|
-
var
|
|
70
|
+
var selector = 'input[placeholder="' + placeholder + '"], textarea[placeholder="' + placeholder + '"], [data-placeholder="' + placeholder + '"]';
|
|
71
|
+
var element = subject ? cy.wrap(subject, o).find(selector, o).first(o).waitForComponents(o) : cy.get(selector, o).first(o).waitForComponents(o);
|
|
71
72
|
element.then(o, function($el) {
|
|
72
73
|
return log(!!subject ? "-getByPlaceholder" : "getByPlaceholder", placeholder, $el, options);
|
|
73
74
|
});
|
|
@@ -83,7 +84,7 @@ Cypress.Commands.add("getByRole", {
|
|
|
83
84
|
};
|
|
84
85
|
var filterVisibleElements = function filterVisibleElements(elements) {
|
|
85
86
|
return elements.filter(function(element) {
|
|
86
|
-
var isElementAriaHidden = options.hidden === true ? false :
|
|
87
|
+
var isElementAriaHidden = options.hidden === true ? false : Cypress.$(element).attr("aria-hidden") === "true";
|
|
87
88
|
return !isElementAriaHidden;
|
|
88
89
|
});
|
|
89
90
|
};
|
|
@@ -514,16 +515,21 @@ Cypress.Commands.add("balSelectFindOptions", {
|
|
|
514
515
|
prevSubject: true
|
|
515
516
|
}, function(subject, options) {
|
|
516
517
|
var o = wrapOptions(options);
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
518
|
+
if (isDropDown(subject)) {
|
|
519
|
+
return cy.wrapComponent(subject, o).find(selectors.dropdown.options, o).then(function($el) {
|
|
520
|
+
return log("balSelectFindOptions", "", $el, options);
|
|
521
|
+
}).waitForComponents(o);
|
|
522
|
+
} else {
|
|
523
|
+
return cy.wrapComponent(subject, o).find(selectors.select.options, o).then(function($el) {
|
|
524
|
+
return log("balSelectFindOptions", "", $el, options);
|
|
525
|
+
}).waitForComponents(o);
|
|
526
|
+
}
|
|
521
527
|
});
|
|
522
528
|
Cypress.Commands.add("balSelectShouldHaveOptions", {
|
|
523
529
|
prevSubject: true
|
|
524
530
|
}, function(subject, labels, dataKey, options) {
|
|
525
531
|
if (dataKey === void 0) dataKey = "label";
|
|
526
|
-
log("
|
|
532
|
+
log("balSelectShouldHaveOptions", "", subject, options);
|
|
527
533
|
var o = wrapOptions(options);
|
|
528
534
|
return cy.wrapComponent(subject, o).balSelectFindOptions(o).should(function($o) {
|
|
529
535
|
var dataItems = $o.map(function(_, el) {
|
|
@@ -536,9 +542,9 @@ Cypress.Commands.add("balSelectFindChips", {
|
|
|
536
542
|
prevSubject: true
|
|
537
543
|
}, function(subject, options) {
|
|
538
544
|
var o = wrapOptions(options);
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
return $el;
|
|
545
|
+
var selector = isDropDown(subject) ? selectors.dropdown.chips : selectors.select.chips;
|
|
546
|
+
return cy.wrapComponent(subject, o).find(selector, o).then(function($el) {
|
|
547
|
+
return log("balSelectFindChips", "", $el, options);
|
|
542
548
|
}).waitForComponents(o);
|
|
543
549
|
});
|
|
544
550
|
|
package/helpers.esm.js
CHANGED
|
@@ -268,6 +268,9 @@ var isTabs = function(el) {
|
|
|
268
268
|
var isSteps = function(el) {
|
|
269
269
|
return isElement(el, "BAL-STEPS");
|
|
270
270
|
};
|
|
271
|
+
var isDropDown = function(el) {
|
|
272
|
+
return isElement(el, "BAL-DROPDOWN");
|
|
273
|
+
};
|
|
271
274
|
var isSlider = function(el) {
|
|
272
275
|
return isElement(el, "BAL-INPUT-SLIDER");
|
|
273
276
|
};
|
|
@@ -365,4 +368,4 @@ function checkAriaLabel(element, label) {
|
|
|
365
368
|
].includes(label.trim());
|
|
366
369
|
}
|
|
367
370
|
|
|
368
|
-
export {
|
|
371
|
+
export { isTabs as A, hasTestId as B, isSteps as C, _extends as _, waitAfterFramePaint as a, waitAfterIdleCallback as b, checkAriaLabel as c, areComponentsReady as d, deepReady as e, isDropDown as f, isAccordion as g, isCheckbox as h, isButton as i, isDatepicker as j, isInput as k, log as l, isInputDate as m, isNumberInput as n, isTextarea as o, isSlider as p, isRadio as q, isSelect as r, wrapCommand as s, testOnPlatforms as t, isTag as u, isHint as v, wrapOptions as w, hasClass as x, isLabel as y, isInputStepper as z };
|
package/index.esm2.js
CHANGED
|
@@ -216,6 +216,20 @@ var byDataSelectors = function(dateTestId, dataSelectors, value) {
|
|
|
216
216
|
* Multi select tag .
|
|
217
217
|
*/ chips: byTestId("bal-select-chip")
|
|
218
218
|
},
|
|
219
|
+
dropdown: {
|
|
220
|
+
/**
|
|
221
|
+
* Native input element.
|
|
222
|
+
*/ input: "[data-native]",
|
|
223
|
+
/**
|
|
224
|
+
* Select option.
|
|
225
|
+
*/ options: "bal-option",
|
|
226
|
+
/**
|
|
227
|
+
* Trigger to open and close the popup.
|
|
228
|
+
*/ trigger: byTestId("bal-dropdown-trigger"),
|
|
229
|
+
/**
|
|
230
|
+
* Multi select tag .
|
|
231
|
+
*/ chips: byTestId("bal-dropdown-chip")
|
|
232
|
+
},
|
|
219
233
|
popover: {
|
|
220
234
|
/**
|
|
221
235
|
* Popover trigger.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baloise/ds-testing",
|
|
3
|
-
"version": "16.0
|
|
3
|
+
"version": "16.1.0",
|
|
4
4
|
"description": "The Baloise Design-System is an open source project for styling awesome web applications that follow the Baloise corporate styling guidelines.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"homepage": "https://design.baloise.dev",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@baloise/ds-core": "16.0
|
|
15
|
+
"@baloise/ds-core": "16.1.0",
|
|
16
16
|
"cypress-file-upload": "~5.0.8"
|
|
17
17
|
},
|
|
18
18
|
"module": "./index.esm.js",
|
|
@@ -27,6 +27,7 @@ export declare const isSelect: isElementType;
|
|
|
27
27
|
export declare const isTag: isElementType;
|
|
28
28
|
export declare const isTabs: isElementType;
|
|
29
29
|
export declare const isSteps: isElementType;
|
|
30
|
+
export declare const isDropDown: isElementType;
|
|
30
31
|
export declare const isSlider: isElementType;
|
|
31
32
|
export declare const isHint: isElementType;
|
|
32
33
|
export declare const isTextarea: isElementType;
|
package/src/selectors/index.d.ts
CHANGED
|
@@ -229,6 +229,24 @@ export declare const selectors: {
|
|
|
229
229
|
*/
|
|
230
230
|
chips: string;
|
|
231
231
|
};
|
|
232
|
+
dropdown: {
|
|
233
|
+
/**
|
|
234
|
+
* Native input element.
|
|
235
|
+
*/
|
|
236
|
+
input: string;
|
|
237
|
+
/**
|
|
238
|
+
* Select option.
|
|
239
|
+
*/
|
|
240
|
+
options: string;
|
|
241
|
+
/**
|
|
242
|
+
* Trigger to open and close the popup.
|
|
243
|
+
*/
|
|
244
|
+
trigger: string;
|
|
245
|
+
/**
|
|
246
|
+
* Multi select tag .
|
|
247
|
+
*/
|
|
248
|
+
chips: string;
|
|
249
|
+
};
|
|
232
250
|
popover: {
|
|
233
251
|
/**
|
|
234
252
|
* Popover trigger.
|
package/type.command.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as selectors, p as parseDataTestID, a as byDataSelectors } from './index.esm2.js';
|
|
2
|
-
import {
|
|
2
|
+
import { g as isAccordion, i as isButton, h as isCheckbox, j as isDatepicker, k as isInput, m as isInputDate, n as isNumberInput, o as isTextarea, p as isSlider, q as isRadio, r as isSelect, f as isDropDown, s as wrapCommand, w as wrapOptions, u as isTag, v as isHint, l as log, x as hasClass, y as isLabel, z as isInputStepper, A as isTabs, B as hasTestId, C as isSteps } from './helpers.esm.js';
|
|
3
3
|
|
|
4
4
|
Cypress.Commands.overwrite("blur", function(originalFn, element, options) {
|
|
5
5
|
var command = wrapCommand("blur", element, "", function($el) {
|
|
@@ -38,6 +38,9 @@ Cypress.Commands.overwrite("blur", function(originalFn, element, options) {
|
|
|
38
38
|
if (isSelect(element)) {
|
|
39
39
|
return command(selectors.select.input);
|
|
40
40
|
}
|
|
41
|
+
if (isDropDown(element)) {
|
|
42
|
+
return command(selectors.dropdown.input);
|
|
43
|
+
}
|
|
41
44
|
return originalFn(element, options);
|
|
42
45
|
});
|
|
43
46
|
|
|
@@ -90,13 +93,29 @@ Cypress.Commands.overwrite("clear", function(originalFn, element, options) {
|
|
|
90
93
|
if (isSelect(element)) {
|
|
91
94
|
return command(".bal-select__control__input");
|
|
92
95
|
}
|
|
96
|
+
if (isDropDown(element)) {
|
|
97
|
+
return command(selectors.dropdown.input);
|
|
98
|
+
}
|
|
93
99
|
return originalFn(element, options);
|
|
94
100
|
});
|
|
95
101
|
|
|
96
102
|
Cypress.Commands.overwrite("click", function(originalFn, element, options) {
|
|
97
|
-
var command =
|
|
98
|
-
return
|
|
99
|
-
|
|
103
|
+
var command = function(selector) {
|
|
104
|
+
return cy.wrapComponent(element, {
|
|
105
|
+
log: false
|
|
106
|
+
}).waitForComponents({
|
|
107
|
+
log: false
|
|
108
|
+
}).find(selector, {
|
|
109
|
+
log: false
|
|
110
|
+
}).click({
|
|
111
|
+
force: true,
|
|
112
|
+
log: false
|
|
113
|
+
}).then(function($el) {
|
|
114
|
+
return log("click", "", $el);
|
|
115
|
+
}).wrapComponent(element, {
|
|
116
|
+
log: false
|
|
117
|
+
});
|
|
118
|
+
};
|
|
100
119
|
if (isAccordion(element)) {
|
|
101
120
|
return command(selectors.accordion.trigger);
|
|
102
121
|
}
|
|
@@ -112,12 +131,15 @@ Cypress.Commands.overwrite("click", function(originalFn, element, options) {
|
|
|
112
131
|
if (isRadio(element)) {
|
|
113
132
|
return command(selectors.radio.label);
|
|
114
133
|
}
|
|
115
|
-
if (isTag(element)
|
|
116
|
-
return command(
|
|
134
|
+
if (isTag(element)) {
|
|
135
|
+
return command(selectors.tag.close);
|
|
117
136
|
}
|
|
118
137
|
if (isHint(element)) {
|
|
119
138
|
return command(selectors.hint.trigger);
|
|
120
139
|
}
|
|
140
|
+
if (isDropDown(element)) {
|
|
141
|
+
return command(selectors.dropdown.trigger);
|
|
142
|
+
}
|
|
121
143
|
return originalFn(element, options);
|
|
122
144
|
});
|
|
123
145
|
|
|
@@ -158,6 +180,9 @@ Cypress.Commands.overwrite("focus", function(originalFn, element, options) {
|
|
|
158
180
|
if (isSelect(element)) {
|
|
159
181
|
return command(selectors.select.input);
|
|
160
182
|
}
|
|
183
|
+
if (isDropDown(element)) {
|
|
184
|
+
return command(selectors.dropdown.input);
|
|
185
|
+
}
|
|
161
186
|
return originalFn(element, options);
|
|
162
187
|
});
|
|
163
188
|
|
|
@@ -337,6 +362,40 @@ var shouldAndAndCommand = function(originalFn, element, condition, key, value, o
|
|
|
337
362
|
return originalFn(element, "not.have.attr", "data-value", key.join(","), value);
|
|
338
363
|
}
|
|
339
364
|
}
|
|
365
|
+
if (hasClass(element, "bal-dropdown__root__input")) {
|
|
366
|
+
var parseKey = function() {
|
|
367
|
+
return typeof key === "string" ? key : key.map(function(k) {
|
|
368
|
+
return k.trim();
|
|
369
|
+
}).sort().join(",");
|
|
370
|
+
};
|
|
371
|
+
switch(condition){
|
|
372
|
+
case "have.value":
|
|
373
|
+
return originalFn(element, "have.attr", "data-label", parseKey(), value);
|
|
374
|
+
case "not.have.value":
|
|
375
|
+
return originalFn(element, "not.have.attr", "data-label", parseKey(), value);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (isDropDown(element)) {
|
|
379
|
+
var nativeEl = element.find(selectors.dropdown.input, {
|
|
380
|
+
log: false
|
|
381
|
+
});
|
|
382
|
+
var parseKey1 = function() {
|
|
383
|
+
return typeof key === "string" ? key : key.map(function(k) {
|
|
384
|
+
return k.trim();
|
|
385
|
+
}).sort().join(",");
|
|
386
|
+
};
|
|
387
|
+
switch(condition){
|
|
388
|
+
case "have.focus":
|
|
389
|
+
case "not.have.focus":
|
|
390
|
+
case "be.disabled":
|
|
391
|
+
case "not.be.disabled":
|
|
392
|
+
return originalFn(nativeEl, condition, key, value, options);
|
|
393
|
+
case "have.value":
|
|
394
|
+
return originalFn(nativeEl, "have.attr", "data-label", parseKey1(), value);
|
|
395
|
+
case "not.have.value":
|
|
396
|
+
return originalFn(nativeEl, "not.have.attr", "data-label", parseKey1(), value);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
340
399
|
if (isTabs(element)) {
|
|
341
400
|
switch(condition){
|
|
342
401
|
case "have.value":
|
|
@@ -407,6 +466,39 @@ Cypress.Commands.overwrite("select", function(originalFn, element, values, optio
|
|
|
407
466
|
log: false
|
|
408
467
|
});
|
|
409
468
|
}
|
|
469
|
+
if (isDropDown(element)) {
|
|
470
|
+
var valueArray1 = [];
|
|
471
|
+
if (typeof values === "string") {
|
|
472
|
+
valueArray1.push(values);
|
|
473
|
+
} else {
|
|
474
|
+
valueArray1 = [].concat(values);
|
|
475
|
+
}
|
|
476
|
+
log("select", valueArray1, element, options);
|
|
477
|
+
if (valueArray1.length === 0) {
|
|
478
|
+
return cy.wrap(element, {
|
|
479
|
+
log: false
|
|
480
|
+
}).clear({
|
|
481
|
+
log: false
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
return cy.wrap(element, {
|
|
485
|
+
log: false
|
|
486
|
+
}).within({
|
|
487
|
+
log: false
|
|
488
|
+
}, function() {
|
|
489
|
+
for(var index = 0; index < valueArray1.length; index++){
|
|
490
|
+
var label = valueArray1[index];
|
|
491
|
+
cy.getByRole("option", {
|
|
492
|
+
name: label,
|
|
493
|
+
log: false
|
|
494
|
+
}).click({
|
|
495
|
+
log: false
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
}).wrap(element, {
|
|
499
|
+
log: false
|
|
500
|
+
});
|
|
501
|
+
}
|
|
410
502
|
if (isTabs(element)) {
|
|
411
503
|
if (typeof values === "string") {
|
|
412
504
|
return cy.wrap(element, {
|
|
@@ -447,6 +539,9 @@ Cypress.Commands.overwrite("type", function(originalFn, element, content, option
|
|
|
447
539
|
if (isInput(element)) {
|
|
448
540
|
return command(selectors.input.native);
|
|
449
541
|
}
|
|
542
|
+
if (isDropDown(element)) {
|
|
543
|
+
return command(selectors.dropdown.input);
|
|
544
|
+
}
|
|
450
545
|
if (isInputDate(element)) {
|
|
451
546
|
return command(selectors.dateInput.native);
|
|
452
547
|
}
|