@baloise/ds-testing 17.4.0-snapshot.1609-d2bcc38d3 → 17.4.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/add-custom-commands.esm.js +1 -1
- package/add-override-commands.esm.js +3 -541
- package/bal-input-stepper.command.esm.js +165 -165
- package/helpers.esm.js +42 -43
- package/index.esm.js +800 -2
- package/index.esm2.js +317 -0
- package/package.json +4 -3
- package/selectors.esm.js +1 -1
- package/src/add-custom-commands.d.ts +34 -34
- package/src/add-override-commands.d.ts +9 -9
- package/src/commands/custom/bal-accordion.command.d.ts +1 -1
- package/src/commands/custom/bal-accordion.types.d.ts +15 -15
- package/src/commands/custom/bal-field.command.d.ts +1 -1
- package/src/commands/custom/bal-field.types.d.ts +11 -11
- package/src/commands/custom/bal-hint.command.d.ts +1 -1
- package/src/commands/custom/bal-hint.types.d.ts +15 -15
- package/src/commands/custom/bal-input-stepper.command.d.ts +1 -1
- package/src/commands/custom/bal-input-stepper.types.d.ts +15 -15
- package/src/commands/custom/bal-modal.command.d.ts +1 -1
- package/src/commands/custom/bal-modal.types.d.ts +24 -24
- package/src/commands/custom/bal-pagination.command.d.ts +1 -1
- package/src/commands/custom/bal-pagination.types.d.ts +23 -23
- package/src/commands/custom/bal-popover.command.d.ts +1 -1
- package/src/commands/custom/bal-popover.types.d.ts +27 -27
- package/src/commands/custom/bal-popup.command.d.ts +1 -1
- package/src/commands/custom/bal-popup.types.d.ts +15 -15
- package/src/commands/custom/bal-select.command.d.ts +1 -1
- package/src/commands/custom/bal-select.types.d.ts +19 -19
- package/src/commands/custom/bal-snackbar.command.d.ts +1 -1
- package/src/commands/custom/bal-snackbar.types.d.ts +11 -11
- package/src/commands/custom/bal-steps.command.d.ts +1 -1
- package/src/commands/custom/bal-steps.types.d.ts +27 -27
- package/src/commands/custom/bal-tabs.command.d.ts +1 -1
- package/src/commands/custom/bal-tabs.types.d.ts +31 -31
- package/src/commands/custom/bal-toast.command.d.ts +1 -1
- package/src/commands/custom/bal-toast.types.d.ts +11 -11
- package/src/commands/custom/component.command.d.ts +1 -1
- package/src/commands/custom/component.types.d.ts +47 -47
- package/src/commands/custom/get.command.d.ts +1 -1
- package/src/commands/custom/get.types.d.ts +43 -43
- package/src/commands/custom/platform.command.d.ts +1 -1
- package/src/commands/custom/platform.types.d.ts +11 -11
- package/src/commands/custom/visit.command.d.ts +1 -1
- package/src/commands/custom/visit.types.d.ts +10 -10
- package/src/commands/helpers.d.ts +48 -48
- package/src/commands/overrides/blur.command.d.ts +1 -1
- package/src/commands/overrides/check.command.d.ts +1 -1
- package/src/commands/overrides/clear.command.d.ts +1 -1
- package/src/commands/overrides/click.command.d.ts +1 -1
- package/src/commands/overrides/focus.command.d.ts +1 -1
- package/src/commands/overrides/select.command.d.ts +1 -1
- package/src/commands/overrides/should.command.d.ts +1 -1
- package/src/commands/overrides/type.command.d.ts +1 -1
- package/src/commands/overrides/uncheck.command.d.ts +1 -1
- package/src/index.d.ts +25 -21
- package/src/legacy/accessors/accordion.accessor.d.ts +29 -0
- package/src/legacy/accessors/button.accessor.d.ts +23 -0
- package/src/legacy/accessors/checkbox.accessor.d.ts +25 -0
- package/src/legacy/accessors/drop-down.accessor.d.ts +31 -0
- package/src/legacy/accessors/error.accessor.d.ts +25 -0
- package/src/legacy/accessors/icon-accessor.d.ts +23 -0
- package/src/legacy/accessors/input.accessor.d.ts +30 -0
- package/src/legacy/accessors/link.accessor.d.ts +39 -0
- package/src/legacy/accessors/list.accessor.d.ts +23 -0
- package/src/legacy/accessors/mixins/andable.d.ts +5 -0
- package/src/legacy/accessors/mixins/attachable.d.ts +6 -0
- package/src/legacy/accessors/mixins/attributable.d.ts +7 -0
- package/src/legacy/accessors/mixins/blurable.d.ts +6 -0
- package/src/legacy/accessors/mixins/checkable.d.ts +7 -0
- package/src/legacy/accessors/mixins/clearable.d.ts +6 -0
- package/src/legacy/accessors/mixins/clickable.d.ts +7 -0
- package/src/legacy/accessors/mixins/containable.d.ts +5 -0
- package/src/legacy/accessors/mixins/disableable.d.ts +5 -0
- package/src/legacy/accessors/mixins/eachable.d.ts +5 -0
- package/src/legacy/accessors/mixins/existable.d.ts +5 -0
- package/src/legacy/accessors/mixins/findable.d.ts +5 -0
- package/src/legacy/accessors/mixins/invokable.d.ts +5 -0
- package/src/legacy/accessors/mixins/lengthable.d.ts +5 -0
- package/src/legacy/accessors/mixins/mixins.d.ts +12 -0
- package/src/legacy/accessors/mixins/nthSelectable.d.ts +7 -0
- package/src/legacy/accessors/mixins/selectable.d.ts +4 -0
- package/src/legacy/accessors/mixins/shouldable.d.ts +5 -0
- package/src/legacy/accessors/mixins/thenable.d.ts +5 -0
- package/src/legacy/accessors/mixins/typeable.d.ts +6 -0
- package/src/legacy/accessors/mixins/urlable.d.ts +6 -0
- package/src/legacy/accessors/mixins/visible.d.ts +5 -0
- package/src/legacy/accessors/mixins/waitable.d.ts +5 -0
- package/src/legacy/accessors/multi-select-button.accessor.d.ts +24 -0
- package/src/legacy/accessors/navigation.accessor.d.ts +22 -0
- package/src/legacy/accessors/radio.accessor.d.ts +23 -0
- package/src/legacy/accessors/select-button.accessor.d.ts +24 -0
- package/src/legacy/accessors/table.accessor.d.ts +27 -0
- package/src/legacy/accessors/tabs.accessor.d.ts +26 -0
- package/src/legacy/accessors/text.accessor.d.ts +23 -0
- package/src/legacy/accessors/tile.accessor.d.ts +27 -0
- package/src/legacy/accessors/toast.accessor.d.ts +24 -0
- package/src/legacy/accessors/tooltip.accessor.d.ts +23 -0
- package/src/legacy/accessors/typeahead.accessor.d.ts +26 -0
- package/src/legacy/index.d.ts +43 -0
- package/src/selectors/index.d.ts +354 -354
- package/src/selectors/selectors.util.d.ts +4 -4
- package/src/selectors.d.ts +1 -1
- package/src/viewports.d.ts +7 -7
- package/type.command.esm.js +541 -0
- package/selectors.esm2.js +0 -179
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const byTestId: (testId: string) => string;
|
|
2
|
-
export declare const dataTestSelector: (testId: string) => string;
|
|
3
|
-
export declare const parseDataTestID: (testId: string) => string;
|
|
4
|
-
export declare const byDataSelectors: (dateTestId: string, dataSelectors: string[], value: string) => string;
|
|
1
|
+
export declare const byTestId: (testId: string) => string;
|
|
2
|
+
export declare const dataTestSelector: (testId: string) => string;
|
|
3
|
+
export declare const parseDataTestID: (testId: string) => string;
|
|
4
|
+
export declare const byDataSelectors: (dateTestId: string, dataSelectors: string[], value: string) => string;
|
package/src/selectors.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { byTestId, dataTestSelector, selectors } from './selectors/index';
|
|
1
|
+
export { byTestId, dataTestSelector, selectors } from './selectors/index';
|
package/src/viewports.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/// <reference types="cypress" />
|
|
2
|
-
import { Platforms } from './commands/helpers';
|
|
3
|
-
type Viewport = {
|
|
4
|
-
[key in Platforms]: Cypress.Dimensions;
|
|
5
|
-
};
|
|
6
|
-
export declare const balViewport: Viewport;
|
|
7
|
-
export {};
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
import { Platforms } from './commands/helpers';
|
|
3
|
+
declare type Viewport = {
|
|
4
|
+
[key in Platforms]: Cypress.Dimensions;
|
|
5
|
+
};
|
|
6
|
+
export declare const balViewport: Viewport;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
import { s as selectors, p as parseDataTestID, a as byDataSelectors } from './index.esm2.js';
|
|
2
|
+
import { g as isAccordion, i as isButton, h as isCheckbox, j as isInput, k as isInputDate, m as isNumberInput, n as isTextarea, o as isSlider, p as isRadio, q as isSelect, f as isDropDown, r as wrapCommand, w as wrapOptions, s as isTag, u as isHint, l as log, v as hasClass, x as isLabel, y as isInputStepper, z as isTabs, A as hasTestId, B as isSteps } from './helpers.esm.js';
|
|
3
|
+
|
|
4
|
+
Cypress.Commands.overwrite("blur", function(originalFn, element, options) {
|
|
5
|
+
var command = wrapCommand("blur", element, "", function($el) {
|
|
6
|
+
return originalFn($el, wrapOptions(options));
|
|
7
|
+
});
|
|
8
|
+
if (isAccordion(element)) {
|
|
9
|
+
return command(selectors.accordion.trigger);
|
|
10
|
+
}
|
|
11
|
+
if (isButton(element)) {
|
|
12
|
+
return command(selectors.button.native);
|
|
13
|
+
}
|
|
14
|
+
if (isCheckbox(element)) {
|
|
15
|
+
return command(selectors.checkbox.input);
|
|
16
|
+
}
|
|
17
|
+
if (isInput(element)) {
|
|
18
|
+
return command(selectors.input.native);
|
|
19
|
+
}
|
|
20
|
+
if (isInputDate(element)) {
|
|
21
|
+
return command(selectors.dateInput.native);
|
|
22
|
+
}
|
|
23
|
+
if (isNumberInput(element)) {
|
|
24
|
+
return command(selectors.numberInput.native);
|
|
25
|
+
}
|
|
26
|
+
if (isTextarea(element)) {
|
|
27
|
+
return command(selectors.textarea.native);
|
|
28
|
+
}
|
|
29
|
+
if (isSlider(element)) {
|
|
30
|
+
return command(selectors.slider.native);
|
|
31
|
+
}
|
|
32
|
+
if (isRadio(element)) {
|
|
33
|
+
return command(selectors.radio.input);
|
|
34
|
+
}
|
|
35
|
+
if (isSelect(element)) {
|
|
36
|
+
return command(selectors.select.input);
|
|
37
|
+
}
|
|
38
|
+
if (isDropDown(element)) {
|
|
39
|
+
return command(selectors.dropdown.input);
|
|
40
|
+
}
|
|
41
|
+
return originalFn(element, options);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
Cypress.Commands.overwrite("check", function(originalFn, element, options) {
|
|
45
|
+
if (isRadio(element) || isCheckbox(element)) {
|
|
46
|
+
return cy.wrapComponent(element, {
|
|
47
|
+
log: false
|
|
48
|
+
}).click();
|
|
49
|
+
}
|
|
50
|
+
return originalFn(element, options);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
Cypress.Commands.overwrite("uncheck", function(originalFn, element, options) {
|
|
54
|
+
if (isRadio(element) || isCheckbox(element)) {
|
|
55
|
+
return cy.wrapComponent(element, {
|
|
56
|
+
log: false
|
|
57
|
+
}).click();
|
|
58
|
+
}
|
|
59
|
+
return originalFn(element, options);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
Cypress.Commands.overwrite("clear", function(originalFn, element, options) {
|
|
63
|
+
var command = wrapCommand("clear", element, "", function($el) {
|
|
64
|
+
return originalFn($el, wrapOptions(options));
|
|
65
|
+
});
|
|
66
|
+
if (isCheckbox(element)) {
|
|
67
|
+
return command(selectors.checkbox.input);
|
|
68
|
+
}
|
|
69
|
+
if (isInput(element)) {
|
|
70
|
+
return command(selectors.input.native);
|
|
71
|
+
}
|
|
72
|
+
if (isInputDate(element)) {
|
|
73
|
+
return command(selectors.dateInput.native);
|
|
74
|
+
}
|
|
75
|
+
if (isNumberInput(element)) {
|
|
76
|
+
return command(selectors.numberInput.native);
|
|
77
|
+
}
|
|
78
|
+
if (isTextarea(element)) {
|
|
79
|
+
return command(selectors.textarea.native);
|
|
80
|
+
}
|
|
81
|
+
if (isSlider(element)) {
|
|
82
|
+
return command(selectors.slider.native);
|
|
83
|
+
}
|
|
84
|
+
if (isRadio(element)) {
|
|
85
|
+
return command(selectors.radio.input);
|
|
86
|
+
}
|
|
87
|
+
if (isSelect(element)) {
|
|
88
|
+
return command(".bal-select__control__input");
|
|
89
|
+
}
|
|
90
|
+
if (isDropDown(element)) {
|
|
91
|
+
return command(selectors.dropdown.input);
|
|
92
|
+
}
|
|
93
|
+
return originalFn(element, options);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
Cypress.Commands.overwrite("click", function(originalFn, element, options) {
|
|
97
|
+
var command = function(selector) {
|
|
98
|
+
return cy.wrapComponent(element, {
|
|
99
|
+
log: false
|
|
100
|
+
}).waitForComponents({
|
|
101
|
+
log: false
|
|
102
|
+
}).find(selector, {
|
|
103
|
+
log: false
|
|
104
|
+
}).click({
|
|
105
|
+
force: true,
|
|
106
|
+
log: false
|
|
107
|
+
}).then(function($el) {
|
|
108
|
+
return log("click", "", $el);
|
|
109
|
+
}).wrapComponent(element, {
|
|
110
|
+
log: false
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
if (isAccordion(element)) {
|
|
114
|
+
return command(selectors.accordion.trigger);
|
|
115
|
+
}
|
|
116
|
+
if (isButton(element)) {
|
|
117
|
+
return command(selectors.button.native);
|
|
118
|
+
}
|
|
119
|
+
if (isCheckbox(element)) {
|
|
120
|
+
return command(selectors.checkbox.label);
|
|
121
|
+
}
|
|
122
|
+
if (isRadio(element)) {
|
|
123
|
+
return command(selectors.radio.label);
|
|
124
|
+
}
|
|
125
|
+
if (isTag(element)) {
|
|
126
|
+
return command(selectors.tag.close);
|
|
127
|
+
}
|
|
128
|
+
if (isHint(element)) {
|
|
129
|
+
return command(selectors.hint.trigger);
|
|
130
|
+
}
|
|
131
|
+
if (isDropDown(element)) {
|
|
132
|
+
return command(selectors.dropdown.trigger);
|
|
133
|
+
}
|
|
134
|
+
return originalFn(element, options);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
Cypress.Commands.overwrite("focus", function(originalFn, element, options) {
|
|
138
|
+
var command = wrapCommand("focus", element, "", function($el) {
|
|
139
|
+
return originalFn($el, wrapOptions(options));
|
|
140
|
+
});
|
|
141
|
+
if (isAccordion(element)) {
|
|
142
|
+
return command(selectors.accordion.trigger);
|
|
143
|
+
}
|
|
144
|
+
if (isButton(element)) {
|
|
145
|
+
return command(selectors.button.native);
|
|
146
|
+
}
|
|
147
|
+
if (isCheckbox(element)) {
|
|
148
|
+
return command(selectors.checkbox.input);
|
|
149
|
+
}
|
|
150
|
+
if (isInput(element)) {
|
|
151
|
+
return command(selectors.input.native);
|
|
152
|
+
}
|
|
153
|
+
if (isInputDate(element)) {
|
|
154
|
+
return command(selectors.dateInput.native);
|
|
155
|
+
}
|
|
156
|
+
if (isNumberInput(element)) {
|
|
157
|
+
return command(selectors.numberInput.native);
|
|
158
|
+
}
|
|
159
|
+
if (isTextarea(element)) {
|
|
160
|
+
return command(selectors.textarea.native);
|
|
161
|
+
}
|
|
162
|
+
if (isSlider(element)) {
|
|
163
|
+
return command(selectors.slider.native);
|
|
164
|
+
}
|
|
165
|
+
if (isRadio(element)) {
|
|
166
|
+
return command(selectors.radio.input);
|
|
167
|
+
}
|
|
168
|
+
if (isSelect(element)) {
|
|
169
|
+
return command(selectors.select.input);
|
|
170
|
+
}
|
|
171
|
+
if (isDropDown(element)) {
|
|
172
|
+
return command(selectors.dropdown.input);
|
|
173
|
+
}
|
|
174
|
+
return originalFn(element, options);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
var shouldAndAndCommand = function(originalFn, element, condition, key, value, options) {
|
|
178
|
+
if (isAccordion(element)) {
|
|
179
|
+
if ([
|
|
180
|
+
"be.disabled",
|
|
181
|
+
"not.be.disabled",
|
|
182
|
+
"be.focused",
|
|
183
|
+
"not.be.focused"
|
|
184
|
+
].includes(condition)) {
|
|
185
|
+
return originalFn(element.find(selectors.accordion.trigger, {
|
|
186
|
+
log: false
|
|
187
|
+
}), condition, key, value, options);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (isButton(element)) {
|
|
191
|
+
if ([
|
|
192
|
+
"be.disabled",
|
|
193
|
+
"not.be.disabled",
|
|
194
|
+
"be.focused",
|
|
195
|
+
"not.be.focused"
|
|
196
|
+
].includes(condition)) {
|
|
197
|
+
return originalFn(element.find(selectors.button.native, {
|
|
198
|
+
log: false
|
|
199
|
+
}), condition, key, value, options);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (isCheckbox(element) || isRadio(element) || hasClass(element, "bal-radio-checkbox__label")) {
|
|
203
|
+
if (isLabel(element)) {
|
|
204
|
+
element = element.closest(isCheckbox(element) ? "<bal-checkbox>" : "<bal-radio>", {
|
|
205
|
+
log: false
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
if ("be.checked" === condition) {
|
|
209
|
+
return originalFn(element, "have.attr", "aria-checked", "true", options);
|
|
210
|
+
}
|
|
211
|
+
if ("not.be.checked" === condition) {
|
|
212
|
+
return originalFn(element, "have.attr", "aria-checked", "false", options);
|
|
213
|
+
}
|
|
214
|
+
if ("be.disabled" === condition) {
|
|
215
|
+
return originalFn(element, "have.attr", "aria-disabled", "true", options);
|
|
216
|
+
}
|
|
217
|
+
if ("not.be.disabled" === condition) {
|
|
218
|
+
return originalFn(element, "not.have.attr", "aria-disabled", options);
|
|
219
|
+
}
|
|
220
|
+
if ("be.focused" === condition) {
|
|
221
|
+
return originalFn(element, "have.attr", "aria-focused", "true", options);
|
|
222
|
+
}
|
|
223
|
+
if ("not.be.focused" === condition) {
|
|
224
|
+
return originalFn(element, "not.have.attr", "aria-focused", options);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (isInputStepper(element)) {
|
|
228
|
+
if ("be.disabled" === condition) {
|
|
229
|
+
return originalFn(element, "have.attr", "aria-disabled", "true", options);
|
|
230
|
+
}
|
|
231
|
+
if ("not.be.disabled" === condition) {
|
|
232
|
+
return originalFn(element, "not.have.attr", "aria-disabled", options);
|
|
233
|
+
}
|
|
234
|
+
if ("be.focused" === condition) {
|
|
235
|
+
return originalFn(element.find("input"), condition, key, value, options);
|
|
236
|
+
}
|
|
237
|
+
if ("not.be.focused" === condition) {
|
|
238
|
+
return originalFn(element.find("input"), condition, key, value, options);
|
|
239
|
+
}
|
|
240
|
+
if ("have.value" === condition) {
|
|
241
|
+
return originalFn(element.find("input"), condition, key, value, options);
|
|
242
|
+
}
|
|
243
|
+
if ("not.have.value" === condition) {
|
|
244
|
+
return originalFn(element.find("input"), condition, key, value, options);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (isInput(element)) {
|
|
248
|
+
if ([
|
|
249
|
+
"be.disabled",
|
|
250
|
+
"not.be.disabled",
|
|
251
|
+
"be.focused",
|
|
252
|
+
"not.be.focused",
|
|
253
|
+
"have.value",
|
|
254
|
+
"not.have.value"
|
|
255
|
+
].includes(condition)) {
|
|
256
|
+
return originalFn(element.find(selectors.input.native, {
|
|
257
|
+
log: false
|
|
258
|
+
}), condition, key, value, options);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (isInputDate(element)) {
|
|
262
|
+
if ([
|
|
263
|
+
"be.disabled",
|
|
264
|
+
"not.be.disabled",
|
|
265
|
+
"be.focused",
|
|
266
|
+
"not.be.focused",
|
|
267
|
+
"have.value",
|
|
268
|
+
"not.have.value"
|
|
269
|
+
].includes(condition)) {
|
|
270
|
+
return originalFn(Cypress.$(element[0]).find(selectors.dateInput.native), condition, key, value, options);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (isNumberInput(element)) {
|
|
274
|
+
if ([
|
|
275
|
+
"be.disabled",
|
|
276
|
+
"not.be.disabled",
|
|
277
|
+
"be.focused",
|
|
278
|
+
"not.be.focused",
|
|
279
|
+
"have.value",
|
|
280
|
+
"not.have.value"
|
|
281
|
+
].includes(condition)) {
|
|
282
|
+
return originalFn(element.find(selectors.numberInput.native, {
|
|
283
|
+
log: false
|
|
284
|
+
}), condition, key, value, options);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (isTextarea(element)) {
|
|
288
|
+
if ([
|
|
289
|
+
"be.disabled",
|
|
290
|
+
"not.be.disabled",
|
|
291
|
+
"be.focused",
|
|
292
|
+
"not.be.focused",
|
|
293
|
+
"have.value",
|
|
294
|
+
"not.have.value"
|
|
295
|
+
].includes(condition)) {
|
|
296
|
+
return originalFn(element.find(selectors.textarea.native, {
|
|
297
|
+
log: false
|
|
298
|
+
}), condition, key, value, options);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (isSlider(element)) {
|
|
302
|
+
if ([
|
|
303
|
+
"be.disabled",
|
|
304
|
+
"not.be.disabled",
|
|
305
|
+
"be.focused",
|
|
306
|
+
"not.be.focused",
|
|
307
|
+
"have.value",
|
|
308
|
+
"not.have.value"
|
|
309
|
+
].includes(condition)) {
|
|
310
|
+
return originalFn(element.find(selectors.slider.native, {
|
|
311
|
+
log: false
|
|
312
|
+
}), condition, key, value, options);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (isSelect(element)) {
|
|
316
|
+
switch(condition){
|
|
317
|
+
case "have.focus":
|
|
318
|
+
case "not.have.focus":
|
|
319
|
+
case "be.disabled":
|
|
320
|
+
case "not.be.disabled":
|
|
321
|
+
return originalFn(element.find(selectors.select.input, {
|
|
322
|
+
log: false
|
|
323
|
+
}), condition, key, value, options);
|
|
324
|
+
case "have.value":
|
|
325
|
+
if (typeof key === "string") {
|
|
326
|
+
return originalFn(element.find(selectors.select.input, {
|
|
327
|
+
log: false
|
|
328
|
+
}), condition, key, value, options);
|
|
329
|
+
}
|
|
330
|
+
return originalFn(element, "have.attr", "data-value", key.join(","), value);
|
|
331
|
+
case "not.have.value":
|
|
332
|
+
if (typeof key === "string") {
|
|
333
|
+
return originalFn(element.find(selectors.select.input, {
|
|
334
|
+
log: false
|
|
335
|
+
}), condition, key, value, options);
|
|
336
|
+
}
|
|
337
|
+
return originalFn(element, "not.have.attr", "data-value", key.join(","), value);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (hasClass(element, "bal-dropdown__root__input")) {
|
|
341
|
+
var parseKey = function() {
|
|
342
|
+
return typeof key === "string" ? key : key.map(function(k) {
|
|
343
|
+
return k.trim();
|
|
344
|
+
}).sort().join(",");
|
|
345
|
+
};
|
|
346
|
+
switch(condition){
|
|
347
|
+
case "have.value":
|
|
348
|
+
return originalFn(element, "have.attr", "data-label", parseKey(), value);
|
|
349
|
+
case "not.have.value":
|
|
350
|
+
return originalFn(element, "not.have.attr", "data-label", parseKey(), value);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (isDropDown(element)) {
|
|
354
|
+
var nativeEl = element.find(selectors.dropdown.input, {
|
|
355
|
+
log: false
|
|
356
|
+
});
|
|
357
|
+
var parseKey1 = function() {
|
|
358
|
+
return typeof key === "string" ? key : key.map(function(k) {
|
|
359
|
+
return k.trim();
|
|
360
|
+
}).sort().join(",");
|
|
361
|
+
};
|
|
362
|
+
switch(condition){
|
|
363
|
+
case "have.focus":
|
|
364
|
+
case "not.have.focus":
|
|
365
|
+
case "be.disabled":
|
|
366
|
+
case "not.be.disabled":
|
|
367
|
+
return originalFn(nativeEl, condition, key, value, options);
|
|
368
|
+
case "have.value":
|
|
369
|
+
return originalFn(nativeEl, "have.attr", "data-label", parseKey1(), value);
|
|
370
|
+
case "not.have.value":
|
|
371
|
+
return originalFn(nativeEl, "not.have.attr", "data-label", parseKey1(), value);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (isTabs(element)) {
|
|
375
|
+
switch(condition){
|
|
376
|
+
case "have.value":
|
|
377
|
+
return originalFn(element, "have.attr", "data-label", key, value);
|
|
378
|
+
case "not.have.value":
|
|
379
|
+
return originalFn(element, "not.have.attr", "data-label", key, value);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (hasTestId(element, parseDataTestID(selectors.tabs.item))) {
|
|
383
|
+
switch(condition){
|
|
384
|
+
case "have.value":
|
|
385
|
+
return originalFn(element, "have.attr", "data-label", key, value);
|
|
386
|
+
case "not.have.value":
|
|
387
|
+
return originalFn(element, "not.have.attr", "data-label", key, value);
|
|
388
|
+
case "be.disabled":
|
|
389
|
+
return originalFn(element, "have.attr", "aria-disabled", "true");
|
|
390
|
+
case "not.be.disabled":
|
|
391
|
+
return originalFn(element, "not.have.attr", "aria-disabled", "false");
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (isSteps(element)) {
|
|
395
|
+
switch(condition){
|
|
396
|
+
case "have.value":
|
|
397
|
+
return originalFn(element, "have.attr", "data-label", key, value);
|
|
398
|
+
case "not.have.value":
|
|
399
|
+
return originalFn(element, "not.have.attr", "data-label", key, value);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (hasTestId(element, parseDataTestID(selectors.steps.option))) {
|
|
403
|
+
switch(condition){
|
|
404
|
+
case "have.value":
|
|
405
|
+
return originalFn(element, "have.attr", "data-label", key, value);
|
|
406
|
+
case "not.have.value":
|
|
407
|
+
return originalFn(element, "not.have.attr", "data-label", key, value);
|
|
408
|
+
case "be.disabled":
|
|
409
|
+
return originalFn(element, "have.attr", "aria-disabled", "true");
|
|
410
|
+
case "not.be.disabled":
|
|
411
|
+
return originalFn(element, "not.have.attr", "aria-disabled", "false");
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return originalFn(element, condition, key, value, options);
|
|
415
|
+
};
|
|
416
|
+
Cypress.Commands.overwrite("should", shouldAndAndCommand);
|
|
417
|
+
Cypress.Commands.overwrite("and", shouldAndAndCommand);
|
|
418
|
+
|
|
419
|
+
Cypress.Commands.overwrite("select", function(originalFn, element, values, options) {
|
|
420
|
+
if (isSelect(element)) {
|
|
421
|
+
var valueArray = [];
|
|
422
|
+
if (typeof values === "string") {
|
|
423
|
+
valueArray.push(values);
|
|
424
|
+
} else {
|
|
425
|
+
valueArray = [].concat(values);
|
|
426
|
+
}
|
|
427
|
+
if (valueArray.length === 0) {
|
|
428
|
+
return cy.wrap(element).clear();
|
|
429
|
+
}
|
|
430
|
+
var selectContext = [];
|
|
431
|
+
for(var index = 0; index < valueArray.length; index++){
|
|
432
|
+
var val = valueArray[index];
|
|
433
|
+
selectContext.push(selectors.select.options + '[data-label="' + val + '"]');
|
|
434
|
+
selectContext.push(selectors.select.options + '[data-value="' + val + '"]');
|
|
435
|
+
}
|
|
436
|
+
return cy.wrap(element, {
|
|
437
|
+
log: false
|
|
438
|
+
}).find(selectContext.join(", ")).click({
|
|
439
|
+
multiple: values.length > 1
|
|
440
|
+
}).wrap(element, {
|
|
441
|
+
log: false
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
if (isDropDown(element)) {
|
|
445
|
+
var valueArray1 = [];
|
|
446
|
+
if (typeof values === "string") {
|
|
447
|
+
valueArray1.push(values);
|
|
448
|
+
} else {
|
|
449
|
+
valueArray1 = [].concat(values);
|
|
450
|
+
}
|
|
451
|
+
log("select", valueArray1, element, options);
|
|
452
|
+
if (valueArray1.length === 0) {
|
|
453
|
+
return cy.wrap(element, {
|
|
454
|
+
log: false
|
|
455
|
+
}).clear({
|
|
456
|
+
log: false
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
return cy.wrap(element, {
|
|
460
|
+
log: false
|
|
461
|
+
}).within({
|
|
462
|
+
log: false
|
|
463
|
+
}, function() {
|
|
464
|
+
for(var index = 0; index < valueArray1.length; index++){
|
|
465
|
+
var label = valueArray1[index];
|
|
466
|
+
cy.getByRole("option", {
|
|
467
|
+
name: label,
|
|
468
|
+
log: false
|
|
469
|
+
}).click({
|
|
470
|
+
log: false
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}).wrap(element, {
|
|
474
|
+
log: false
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
if (isTabs(element)) {
|
|
478
|
+
if (typeof values === "string") {
|
|
479
|
+
return cy.wrap(element, {
|
|
480
|
+
log: false
|
|
481
|
+
}).find(byDataSelectors(selectors.tabs.item, [
|
|
482
|
+
"label",
|
|
483
|
+
"value",
|
|
484
|
+
"index"
|
|
485
|
+
], values), {
|
|
486
|
+
log: false
|
|
487
|
+
}).click().wrap(element, {
|
|
488
|
+
log: false
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
if (isSteps(element)) {
|
|
493
|
+
if (typeof values === "string") {
|
|
494
|
+
return cy.wrap(element, {
|
|
495
|
+
log: false
|
|
496
|
+
}).find(byDataSelectors(selectors.steps.option, [
|
|
497
|
+
"label",
|
|
498
|
+
"value",
|
|
499
|
+
"index"
|
|
500
|
+
], values), {
|
|
501
|
+
log: false
|
|
502
|
+
}).click().wrap(element, {
|
|
503
|
+
log: false
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return originalFn(element, values, options);
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
Cypress.Commands.overwrite("type", function(originalFn, element, content, options) {
|
|
511
|
+
var command = wrapCommand("type", element, content, function($el) {
|
|
512
|
+
return originalFn($el, content, wrapOptions(options));
|
|
513
|
+
});
|
|
514
|
+
if (isInput(element)) {
|
|
515
|
+
return command(selectors.input.native);
|
|
516
|
+
}
|
|
517
|
+
if (isDropDown(element)) {
|
|
518
|
+
return command(selectors.dropdown.input);
|
|
519
|
+
}
|
|
520
|
+
if (isInputDate(element)) {
|
|
521
|
+
return command(selectors.dateInput.native);
|
|
522
|
+
}
|
|
523
|
+
if (isNumberInput(element)) {
|
|
524
|
+
return command(selectors.numberInput.native);
|
|
525
|
+
}
|
|
526
|
+
if (isTextarea(element)) {
|
|
527
|
+
return command(selectors.textarea.native);
|
|
528
|
+
}
|
|
529
|
+
if (isSlider(element)) {
|
|
530
|
+
return cy.wrap(element, {
|
|
531
|
+
log: false
|
|
532
|
+
}).find(selectors.slider.native, {
|
|
533
|
+
log: false
|
|
534
|
+
}).invoke("val", parseFloat(content)).trigger("change", {
|
|
535
|
+
log: false
|
|
536
|
+
}).wrap(element, {
|
|
537
|
+
log: false
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
return originalFn(element, content, options);
|
|
541
|
+
});
|