@baloise/ds-testing 0.0.5-nightly.e56f740
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/LICENSE +201 -0
- package/README.md +45 -0
- package/add-custom-commands.esm.d.ts +1 -0
- package/add-custom-commands.esm.js +4 -0
- package/add-override-commands.esm.d.ts +1 -0
- package/add-override-commands.esm.js +3 -0
- package/bal-input-stepper.command.esm.js +685 -0
- package/helpers.esm.js +359 -0
- package/index.esm.d.ts +1 -0
- package/index.esm.js +891 -0
- package/index.esm2.js +308 -0
- package/package.json +48 -0
- package/selectors.esm.d.ts +1 -0
- package/selectors.esm.js +1 -0
- package/src/add-custom-commands.d.ts +36 -0
- package/src/add-override-commands.d.ts +9 -0
- package/src/commands/custom/bal-accordion.command.d.ts +1 -0
- package/src/commands/custom/bal-accordion.types.d.ts +15 -0
- package/src/commands/custom/bal-datepicker.command.d.ts +1 -0
- package/src/commands/custom/bal-datepicker.types.d.ts +31 -0
- package/src/commands/custom/bal-field.command.d.ts +1 -0
- package/src/commands/custom/bal-field.types.d.ts +11 -0
- package/src/commands/custom/bal-hint.command.d.ts +1 -0
- package/src/commands/custom/bal-hint.types.d.ts +15 -0
- package/src/commands/custom/bal-input-stepper.command.d.ts +1 -0
- package/src/commands/custom/bal-input-stepper.types.d.ts +15 -0
- package/src/commands/custom/bal-modal.command.d.ts +1 -0
- package/src/commands/custom/bal-modal.types.d.ts +24 -0
- package/src/commands/custom/bal-pagination.command.d.ts +1 -0
- package/src/commands/custom/bal-pagination.types.d.ts +23 -0
- package/src/commands/custom/bal-popover.command.d.ts +1 -0
- package/src/commands/custom/bal-popover.types.d.ts +27 -0
- package/src/commands/custom/bal-popup.command.d.ts +1 -0
- package/src/commands/custom/bal-popup.types.d.ts +15 -0
- package/src/commands/custom/bal-select.command.d.ts +1 -0
- package/src/commands/custom/bal-select.types.d.ts +19 -0
- package/src/commands/custom/bal-snackbar.command.d.ts +1 -0
- package/src/commands/custom/bal-snackbar.types.d.ts +11 -0
- package/src/commands/custom/bal-steps.command.d.ts +1 -0
- package/src/commands/custom/bal-steps.types.d.ts +27 -0
- package/src/commands/custom/bal-tabs.command.d.ts +1 -0
- package/src/commands/custom/bal-tabs.types.d.ts +31 -0
- package/src/commands/custom/bal-toast.command.d.ts +1 -0
- package/src/commands/custom/bal-toast.types.d.ts +11 -0
- package/src/commands/custom/component.command.d.ts +1 -0
- package/src/commands/custom/component.types.d.ts +43 -0
- package/src/commands/custom/get.command.d.ts +1 -0
- package/src/commands/custom/get.types.d.ts +43 -0
- package/src/commands/custom/platform.command.d.ts +1 -0
- package/src/commands/custom/platform.types.d.ts +11 -0
- package/src/commands/custom/visit.command.d.ts +1 -0
- package/src/commands/custom/visit.types.d.ts +10 -0
- package/src/commands/helpers.d.ts +48 -0
- package/src/commands/overrides/blur.command.d.ts +1 -0
- package/src/commands/overrides/check.command.d.ts +1 -0
- package/src/commands/overrides/clear.command.d.ts +1 -0
- package/src/commands/overrides/click.command.d.ts +1 -0
- package/src/commands/overrides/focus.command.d.ts +1 -0
- package/src/commands/overrides/select.command.d.ts +1 -0
- package/src/commands/overrides/should.command.d.ts +1 -0
- package/src/commands/overrides/type.command.d.ts +1 -0
- package/src/commands/overrides/uncheck.command.d.ts +1 -0
- package/src/index.d.ts +25 -0
- 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/date-picker.accessor.d.ts +24 -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 +44 -0
- package/src/selectors/index.d.ts +342 -0
- package/src/selectors/selectors.util.d.ts +4 -0
- package/src/selectors.d.ts +1 -0
- package/src/viewports.d.ts +7 -0
- package/type.command.esm.js +471 -0
- package/viewports.esm.d.ts +1 -0
- package/viewports.esm.js +46 -0
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import { s as selectors, p as parseDataTestID, a as byDataSelectors } from './index.esm2.js';
|
|
2
|
+
import { f as isAccordion, i as isButton, g as isCheckbox, h as isDatepicker, j as isInput, k as isInputDate, m as isNumberInput, n as isTextarea, o as isSlider, p as isRadio, q as isSelect, r as wrapCommand, w as wrapOptions, s as isTag, u as hasClass, v as isHint, 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 (isDatepicker(element)) {
|
|
18
|
+
return command(selectors.datepicker.input);
|
|
19
|
+
}
|
|
20
|
+
if (isInput(element)) {
|
|
21
|
+
return command(selectors.input.native);
|
|
22
|
+
}
|
|
23
|
+
if (isInputDate(element)) {
|
|
24
|
+
return command(selectors.dateInput.native);
|
|
25
|
+
}
|
|
26
|
+
if (isNumberInput(element)) {
|
|
27
|
+
return command(selectors.numberInput.native);
|
|
28
|
+
}
|
|
29
|
+
if (isTextarea(element)) {
|
|
30
|
+
return command(selectors.textarea.native);
|
|
31
|
+
}
|
|
32
|
+
if (isSlider(element)) {
|
|
33
|
+
return command(selectors.slider.native);
|
|
34
|
+
}
|
|
35
|
+
if (isRadio(element)) {
|
|
36
|
+
return command(selectors.radio.input);
|
|
37
|
+
}
|
|
38
|
+
if (isSelect(element)) {
|
|
39
|
+
return command(selectors.select.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 (isDatepicker(element)) {
|
|
70
|
+
return command(selectors.datepicker.input);
|
|
71
|
+
}
|
|
72
|
+
if (isInput(element)) {
|
|
73
|
+
return command(selectors.input.native);
|
|
74
|
+
}
|
|
75
|
+
if (isInputDate(element)) {
|
|
76
|
+
return command(selectors.dateInput.native);
|
|
77
|
+
}
|
|
78
|
+
if (isNumberInput(element)) {
|
|
79
|
+
return command(selectors.numberInput.native);
|
|
80
|
+
}
|
|
81
|
+
if (isTextarea(element)) {
|
|
82
|
+
return command(selectors.textarea.native);
|
|
83
|
+
}
|
|
84
|
+
if (isSlider(element)) {
|
|
85
|
+
return command(selectors.slider.native);
|
|
86
|
+
}
|
|
87
|
+
if (isRadio(element)) {
|
|
88
|
+
return command(selectors.radio.input);
|
|
89
|
+
}
|
|
90
|
+
if (isSelect(element)) {
|
|
91
|
+
return command(".bal-select__control__input");
|
|
92
|
+
}
|
|
93
|
+
return originalFn(element, options);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
Cypress.Commands.overwrite("click", function(originalFn, element, options) {
|
|
97
|
+
var command = wrapCommand("click", element, "", function($el) {
|
|
98
|
+
return originalFn($el, wrapOptions(options));
|
|
99
|
+
});
|
|
100
|
+
if (isAccordion(element)) {
|
|
101
|
+
return command(selectors.accordion.trigger);
|
|
102
|
+
}
|
|
103
|
+
if (isButton(element)) {
|
|
104
|
+
return command(selectors.button.native);
|
|
105
|
+
}
|
|
106
|
+
if (isCheckbox(element)) {
|
|
107
|
+
return command(selectors.checkbox.label);
|
|
108
|
+
}
|
|
109
|
+
if (isDatepicker(element)) {
|
|
110
|
+
return command(selectors.datepicker.input);
|
|
111
|
+
}
|
|
112
|
+
if (isRadio(element)) {
|
|
113
|
+
return command(selectors.radio.label);
|
|
114
|
+
}
|
|
115
|
+
if (isTag(element) && hasClass(element, "sc-bal-select")) {
|
|
116
|
+
return command(".delete");
|
|
117
|
+
}
|
|
118
|
+
if (isHint(element)) {
|
|
119
|
+
return command(selectors.hint.trigger);
|
|
120
|
+
}
|
|
121
|
+
return originalFn(element, options);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
Cypress.Commands.overwrite("focus", function(originalFn, element, options) {
|
|
125
|
+
var command = wrapCommand("focus", element, "", function($el) {
|
|
126
|
+
return originalFn($el, wrapOptions(options));
|
|
127
|
+
});
|
|
128
|
+
if (isAccordion(element)) {
|
|
129
|
+
return command(selectors.accordion.trigger);
|
|
130
|
+
}
|
|
131
|
+
if (isButton(element)) {
|
|
132
|
+
return command(selectors.button.native);
|
|
133
|
+
}
|
|
134
|
+
if (isCheckbox(element)) {
|
|
135
|
+
return command(selectors.checkbox.input);
|
|
136
|
+
}
|
|
137
|
+
if (isDatepicker(element)) {
|
|
138
|
+
return command(selectors.datepicker.input);
|
|
139
|
+
}
|
|
140
|
+
if (isInput(element)) {
|
|
141
|
+
return command(selectors.input.native);
|
|
142
|
+
}
|
|
143
|
+
if (isInputDate(element)) {
|
|
144
|
+
return command(selectors.dateInput.native);
|
|
145
|
+
}
|
|
146
|
+
if (isNumberInput(element)) {
|
|
147
|
+
return command(selectors.numberInput.native);
|
|
148
|
+
}
|
|
149
|
+
if (isTextarea(element)) {
|
|
150
|
+
return command(selectors.textarea.native);
|
|
151
|
+
}
|
|
152
|
+
if (isSlider(element)) {
|
|
153
|
+
return command(selectors.slider.native);
|
|
154
|
+
}
|
|
155
|
+
if (isRadio(element)) {
|
|
156
|
+
return command(selectors.radio.input);
|
|
157
|
+
}
|
|
158
|
+
if (isSelect(element)) {
|
|
159
|
+
return command(selectors.select.input);
|
|
160
|
+
}
|
|
161
|
+
return originalFn(element, options);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
var shouldAndAndCommand = function(originalFn, element, condition, key, value, options) {
|
|
165
|
+
if (isAccordion(element)) {
|
|
166
|
+
if ([
|
|
167
|
+
"be.disabled",
|
|
168
|
+
"not.be.disabled",
|
|
169
|
+
"be.focused",
|
|
170
|
+
"not.be.focused"
|
|
171
|
+
].includes(condition)) {
|
|
172
|
+
return originalFn(element.find(selectors.accordion.trigger, {
|
|
173
|
+
log: false
|
|
174
|
+
}), condition, key, value, options);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (isButton(element)) {
|
|
178
|
+
if ([
|
|
179
|
+
"be.disabled",
|
|
180
|
+
"not.be.disabled",
|
|
181
|
+
"be.focused",
|
|
182
|
+
"not.be.focused"
|
|
183
|
+
].includes(condition)) {
|
|
184
|
+
return originalFn(element.find(selectors.button.native, {
|
|
185
|
+
log: false
|
|
186
|
+
}), condition, key, value, options);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (isCheckbox(element) || isRadio(element) || hasClass(element, "bal-radio-checkbox__label")) {
|
|
190
|
+
if (isLabel(element)) {
|
|
191
|
+
element = element.closest(isCheckbox(element) ? "<bal-checkbox>" : "<bal-radio>", {
|
|
192
|
+
log: false
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if ("be.checked" === condition) {
|
|
196
|
+
return originalFn(element, "have.attr", "aria-checked", "true", options);
|
|
197
|
+
}
|
|
198
|
+
if ("not.be.checked" === condition) {
|
|
199
|
+
return originalFn(element, "have.attr", "aria-checked", "false", options);
|
|
200
|
+
}
|
|
201
|
+
if ("be.disabled" === condition) {
|
|
202
|
+
return originalFn(element, "have.attr", "aria-disabled", "true", options);
|
|
203
|
+
}
|
|
204
|
+
if ("not.be.disabled" === condition) {
|
|
205
|
+
return originalFn(element, "not.have.attr", "aria-disabled", options);
|
|
206
|
+
}
|
|
207
|
+
if ("be.focused" === condition) {
|
|
208
|
+
return originalFn(element, "have.attr", "aria-focused", "true", options);
|
|
209
|
+
}
|
|
210
|
+
if ("not.be.focused" === condition) {
|
|
211
|
+
return originalFn(element, "not.have.attr", "aria-focused", options);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (isInputStepper(element)) {
|
|
215
|
+
if ("be.disabled" === condition) {
|
|
216
|
+
return originalFn(element, "have.attr", "aria-disabled", "true", options);
|
|
217
|
+
}
|
|
218
|
+
if ("not.be.disabled" === condition) {
|
|
219
|
+
return originalFn(element, "not.have.attr", "aria-disabled", options);
|
|
220
|
+
}
|
|
221
|
+
if ("be.focused" === condition) {
|
|
222
|
+
return originalFn(element.find("input"), condition, key, value, options);
|
|
223
|
+
}
|
|
224
|
+
if ("not.be.focused" === condition) {
|
|
225
|
+
return originalFn(element.find("input"), condition, key, value, options);
|
|
226
|
+
}
|
|
227
|
+
if ("have.value" === condition) {
|
|
228
|
+
return originalFn(element.find("input"), condition, key, value, options);
|
|
229
|
+
}
|
|
230
|
+
if ("not.have.value" === condition) {
|
|
231
|
+
return originalFn(element.find("input"), condition, key, value, options);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (isDatepicker(element)) {
|
|
235
|
+
switch(condition){
|
|
236
|
+
case "have.focus":
|
|
237
|
+
case "not.have.focus":
|
|
238
|
+
case "have.value":
|
|
239
|
+
case "not.have.value":
|
|
240
|
+
case "be.disabled":
|
|
241
|
+
case "not.be.disabled":
|
|
242
|
+
return originalFn(element.find(selectors.datepicker.input, {
|
|
243
|
+
log: false
|
|
244
|
+
}), 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 (isTabs(element)) {
|
|
341
|
+
switch(condition){
|
|
342
|
+
case "have.value":
|
|
343
|
+
return originalFn(element, "have.attr", "data-label", key, value);
|
|
344
|
+
case "not.have.value":
|
|
345
|
+
return originalFn(element, "not.have.attr", "data-label", key, value);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (hasTestId(element, parseDataTestID(selectors.tabs.item))) {
|
|
349
|
+
switch(condition){
|
|
350
|
+
case "have.value":
|
|
351
|
+
return originalFn(element, "have.attr", "data-label", key, value);
|
|
352
|
+
case "not.have.value":
|
|
353
|
+
return originalFn(element, "not.have.attr", "data-label", key, value);
|
|
354
|
+
case "be.disabled":
|
|
355
|
+
return originalFn(element, "have.attr", "aria-disabled", "true");
|
|
356
|
+
case "not.be.disabled":
|
|
357
|
+
return originalFn(element, "not.have.attr", "aria-disabled", "false");
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (isSteps(element)) {
|
|
361
|
+
switch(condition){
|
|
362
|
+
case "have.value":
|
|
363
|
+
return originalFn(element, "have.attr", "data-label", key, value);
|
|
364
|
+
case "not.have.value":
|
|
365
|
+
return originalFn(element, "not.have.attr", "data-label", key, value);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (hasTestId(element, parseDataTestID(selectors.steps.option))) {
|
|
369
|
+
switch(condition){
|
|
370
|
+
case "have.value":
|
|
371
|
+
return originalFn(element, "have.attr", "data-label", key, value);
|
|
372
|
+
case "not.have.value":
|
|
373
|
+
return originalFn(element, "not.have.attr", "data-label", key, value);
|
|
374
|
+
case "be.disabled":
|
|
375
|
+
return originalFn(element, "have.attr", "aria-disabled", "true");
|
|
376
|
+
case "not.be.disabled":
|
|
377
|
+
return originalFn(element, "not.have.attr", "aria-disabled", "false");
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return originalFn(element, condition, key, value, options);
|
|
381
|
+
};
|
|
382
|
+
Cypress.Commands.overwrite("should", shouldAndAndCommand);
|
|
383
|
+
Cypress.Commands.overwrite("and", shouldAndAndCommand);
|
|
384
|
+
|
|
385
|
+
Cypress.Commands.overwrite("select", function(originalFn, element, values, options) {
|
|
386
|
+
if (isSelect(element)) {
|
|
387
|
+
var valueArray = [];
|
|
388
|
+
if (typeof values === "string") {
|
|
389
|
+
valueArray.push(values);
|
|
390
|
+
} else {
|
|
391
|
+
valueArray = [].concat(values);
|
|
392
|
+
}
|
|
393
|
+
if (valueArray.length === 0) {
|
|
394
|
+
return cy.wrap(element).clear();
|
|
395
|
+
}
|
|
396
|
+
var selectContext = [];
|
|
397
|
+
for(var index = 0; index < valueArray.length; index++){
|
|
398
|
+
var val = valueArray[index];
|
|
399
|
+
selectContext.push(selectors.select.options + '[data-label="' + val + '"]');
|
|
400
|
+
selectContext.push(selectors.select.options + '[data-value="' + val + '"]');
|
|
401
|
+
}
|
|
402
|
+
return cy.wrap(element, {
|
|
403
|
+
log: false
|
|
404
|
+
}).find(selectContext.join(", ")).click({
|
|
405
|
+
multiple: values.length > 1
|
|
406
|
+
}).wrap(element, {
|
|
407
|
+
log: false
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
if (isTabs(element)) {
|
|
411
|
+
if (typeof values === "string") {
|
|
412
|
+
return cy.wrap(element, {
|
|
413
|
+
log: false
|
|
414
|
+
}).find(byDataSelectors(selectors.tabs.item, [
|
|
415
|
+
"label",
|
|
416
|
+
"value",
|
|
417
|
+
"index"
|
|
418
|
+
], values), {
|
|
419
|
+
log: false
|
|
420
|
+
}).click().wrap(element, {
|
|
421
|
+
log: false
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
if (isSteps(element)) {
|
|
426
|
+
if (typeof values === "string") {
|
|
427
|
+
return cy.wrap(element, {
|
|
428
|
+
log: false
|
|
429
|
+
}).find(byDataSelectors(selectors.steps.option, [
|
|
430
|
+
"label",
|
|
431
|
+
"value",
|
|
432
|
+
"index"
|
|
433
|
+
], values), {
|
|
434
|
+
log: false
|
|
435
|
+
}).click().wrap(element, {
|
|
436
|
+
log: false
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return originalFn(element, values, options);
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
Cypress.Commands.overwrite("type", function(originalFn, element, content, options) {
|
|
444
|
+
var command = wrapCommand("type", element, content, function($el) {
|
|
445
|
+
return originalFn($el, content, wrapOptions(options));
|
|
446
|
+
});
|
|
447
|
+
if (isInput(element)) {
|
|
448
|
+
return command(selectors.input.native);
|
|
449
|
+
}
|
|
450
|
+
if (isInputDate(element)) {
|
|
451
|
+
return command(selectors.dateInput.native);
|
|
452
|
+
}
|
|
453
|
+
if (isNumberInput(element)) {
|
|
454
|
+
return command(selectors.numberInput.native);
|
|
455
|
+
}
|
|
456
|
+
if (isTextarea(element)) {
|
|
457
|
+
return command(selectors.textarea.native);
|
|
458
|
+
}
|
|
459
|
+
if (isSlider(element)) {
|
|
460
|
+
return cy.wrap(element, {
|
|
461
|
+
log: false
|
|
462
|
+
}).find(selectors.slider.native, {
|
|
463
|
+
log: false
|
|
464
|
+
}).invoke("val", parseFloat(content)).trigger("change", {
|
|
465
|
+
log: false
|
|
466
|
+
}).wrap(element, {
|
|
467
|
+
log: false
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
return originalFn(element, content, options);
|
|
471
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/viewports";
|
package/viewports.esm.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var balViewport = {
|
|
2
|
+
mobile: {
|
|
3
|
+
width: 375,
|
|
4
|
+
height: 667,
|
|
5
|
+
x: 0,
|
|
6
|
+
y: 0
|
|
7
|
+
},
|
|
8
|
+
tablet: {
|
|
9
|
+
width: 769,
|
|
10
|
+
height: 1024,
|
|
11
|
+
x: 0,
|
|
12
|
+
y: 0
|
|
13
|
+
},
|
|
14
|
+
touch: {
|
|
15
|
+
width: 769,
|
|
16
|
+
height: 1024,
|
|
17
|
+
x: 0,
|
|
18
|
+
y: 0
|
|
19
|
+
},
|
|
20
|
+
desktop: {
|
|
21
|
+
width: 1024,
|
|
22
|
+
height: 1280,
|
|
23
|
+
x: 0,
|
|
24
|
+
y: 0
|
|
25
|
+
},
|
|
26
|
+
highDefinition: {
|
|
27
|
+
width: 1280,
|
|
28
|
+
height: 1440,
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0
|
|
31
|
+
},
|
|
32
|
+
widescreen: {
|
|
33
|
+
width: 1440,
|
|
34
|
+
height: 1920,
|
|
35
|
+
x: 0,
|
|
36
|
+
y: 0
|
|
37
|
+
},
|
|
38
|
+
fullhd: {
|
|
39
|
+
width: 1920,
|
|
40
|
+
height: 1920,
|
|
41
|
+
x: 0,
|
|
42
|
+
y: 0
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { balViewport };
|