@baloise/ds-testing 0.0.5-nightly.20240301

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.
Files changed (115) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +40 -0
  3. package/add-custom-commands.esm.d.ts +1 -0
  4. package/add-custom-commands.esm.js +4 -0
  5. package/add-override-commands.esm.d.ts +1 -0
  6. package/add-override-commands.esm.js +3 -0
  7. package/bal-input-stepper.command.esm.js +685 -0
  8. package/helpers.esm.js +359 -0
  9. package/index.esm.d.ts +1 -0
  10. package/index.esm.js +891 -0
  11. package/index.esm2.js +308 -0
  12. package/package.json +48 -0
  13. package/selectors.esm.d.ts +1 -0
  14. package/selectors.esm.js +1 -0
  15. package/src/add-custom-commands.d.ts +36 -0
  16. package/src/add-override-commands.d.ts +9 -0
  17. package/src/commands/custom/bal-accordion.command.d.ts +1 -0
  18. package/src/commands/custom/bal-accordion.types.d.ts +15 -0
  19. package/src/commands/custom/bal-datepicker.command.d.ts +1 -0
  20. package/src/commands/custom/bal-datepicker.types.d.ts +31 -0
  21. package/src/commands/custom/bal-field.command.d.ts +1 -0
  22. package/src/commands/custom/bal-field.types.d.ts +11 -0
  23. package/src/commands/custom/bal-hint.command.d.ts +1 -0
  24. package/src/commands/custom/bal-hint.types.d.ts +15 -0
  25. package/src/commands/custom/bal-input-stepper.command.d.ts +1 -0
  26. package/src/commands/custom/bal-input-stepper.types.d.ts +15 -0
  27. package/src/commands/custom/bal-modal.command.d.ts +1 -0
  28. package/src/commands/custom/bal-modal.types.d.ts +24 -0
  29. package/src/commands/custom/bal-pagination.command.d.ts +1 -0
  30. package/src/commands/custom/bal-pagination.types.d.ts +23 -0
  31. package/src/commands/custom/bal-popover.command.d.ts +1 -0
  32. package/src/commands/custom/bal-popover.types.d.ts +27 -0
  33. package/src/commands/custom/bal-popup.command.d.ts +1 -0
  34. package/src/commands/custom/bal-popup.types.d.ts +15 -0
  35. package/src/commands/custom/bal-select.command.d.ts +1 -0
  36. package/src/commands/custom/bal-select.types.d.ts +19 -0
  37. package/src/commands/custom/bal-snackbar.command.d.ts +1 -0
  38. package/src/commands/custom/bal-snackbar.types.d.ts +11 -0
  39. package/src/commands/custom/bal-steps.command.d.ts +1 -0
  40. package/src/commands/custom/bal-steps.types.d.ts +27 -0
  41. package/src/commands/custom/bal-tabs.command.d.ts +1 -0
  42. package/src/commands/custom/bal-tabs.types.d.ts +31 -0
  43. package/src/commands/custom/bal-toast.command.d.ts +1 -0
  44. package/src/commands/custom/bal-toast.types.d.ts +11 -0
  45. package/src/commands/custom/component.command.d.ts +1 -0
  46. package/src/commands/custom/component.types.d.ts +43 -0
  47. package/src/commands/custom/get.command.d.ts +1 -0
  48. package/src/commands/custom/get.types.d.ts +43 -0
  49. package/src/commands/custom/platform.command.d.ts +1 -0
  50. package/src/commands/custom/platform.types.d.ts +11 -0
  51. package/src/commands/custom/visit.command.d.ts +1 -0
  52. package/src/commands/custom/visit.types.d.ts +10 -0
  53. package/src/commands/helpers.d.ts +48 -0
  54. package/src/commands/overrides/blur.command.d.ts +1 -0
  55. package/src/commands/overrides/check.command.d.ts +1 -0
  56. package/src/commands/overrides/clear.command.d.ts +1 -0
  57. package/src/commands/overrides/click.command.d.ts +1 -0
  58. package/src/commands/overrides/focus.command.d.ts +1 -0
  59. package/src/commands/overrides/select.command.d.ts +1 -0
  60. package/src/commands/overrides/should.command.d.ts +1 -0
  61. package/src/commands/overrides/type.command.d.ts +1 -0
  62. package/src/commands/overrides/uncheck.command.d.ts +1 -0
  63. package/src/index.d.ts +25 -0
  64. package/src/legacy/accessors/accordion.accessor.d.ts +29 -0
  65. package/src/legacy/accessors/button.accessor.d.ts +23 -0
  66. package/src/legacy/accessors/checkbox.accessor.d.ts +25 -0
  67. package/src/legacy/accessors/date-picker.accessor.d.ts +24 -0
  68. package/src/legacy/accessors/drop-down.accessor.d.ts +31 -0
  69. package/src/legacy/accessors/error.accessor.d.ts +25 -0
  70. package/src/legacy/accessors/icon-accessor.d.ts +23 -0
  71. package/src/legacy/accessors/input.accessor.d.ts +30 -0
  72. package/src/legacy/accessors/link.accessor.d.ts +39 -0
  73. package/src/legacy/accessors/list.accessor.d.ts +23 -0
  74. package/src/legacy/accessors/mixins/andable.d.ts +5 -0
  75. package/src/legacy/accessors/mixins/attachable.d.ts +6 -0
  76. package/src/legacy/accessors/mixins/attributable.d.ts +7 -0
  77. package/src/legacy/accessors/mixins/blurable.d.ts +6 -0
  78. package/src/legacy/accessors/mixins/checkable.d.ts +7 -0
  79. package/src/legacy/accessors/mixins/clearable.d.ts +6 -0
  80. package/src/legacy/accessors/mixins/clickable.d.ts +7 -0
  81. package/src/legacy/accessors/mixins/containable.d.ts +5 -0
  82. package/src/legacy/accessors/mixins/disableable.d.ts +5 -0
  83. package/src/legacy/accessors/mixins/eachable.d.ts +5 -0
  84. package/src/legacy/accessors/mixins/existable.d.ts +5 -0
  85. package/src/legacy/accessors/mixins/findable.d.ts +5 -0
  86. package/src/legacy/accessors/mixins/invokable.d.ts +5 -0
  87. package/src/legacy/accessors/mixins/lengthable.d.ts +5 -0
  88. package/src/legacy/accessors/mixins/mixins.d.ts +12 -0
  89. package/src/legacy/accessors/mixins/nthSelectable.d.ts +7 -0
  90. package/src/legacy/accessors/mixins/selectable.d.ts +4 -0
  91. package/src/legacy/accessors/mixins/shouldable.d.ts +5 -0
  92. package/src/legacy/accessors/mixins/thenable.d.ts +5 -0
  93. package/src/legacy/accessors/mixins/typeable.d.ts +6 -0
  94. package/src/legacy/accessors/mixins/urlable.d.ts +6 -0
  95. package/src/legacy/accessors/mixins/visible.d.ts +5 -0
  96. package/src/legacy/accessors/mixins/waitable.d.ts +5 -0
  97. package/src/legacy/accessors/multi-select-button.accessor.d.ts +24 -0
  98. package/src/legacy/accessors/navigation.accessor.d.ts +22 -0
  99. package/src/legacy/accessors/radio.accessor.d.ts +23 -0
  100. package/src/legacy/accessors/select-button.accessor.d.ts +24 -0
  101. package/src/legacy/accessors/table.accessor.d.ts +27 -0
  102. package/src/legacy/accessors/tabs.accessor.d.ts +26 -0
  103. package/src/legacy/accessors/text.accessor.d.ts +23 -0
  104. package/src/legacy/accessors/tile.accessor.d.ts +27 -0
  105. package/src/legacy/accessors/toast.accessor.d.ts +24 -0
  106. package/src/legacy/accessors/tooltip.accessor.d.ts +23 -0
  107. package/src/legacy/accessors/typeahead.accessor.d.ts +26 -0
  108. package/src/legacy/index.d.ts +44 -0
  109. package/src/selectors/index.d.ts +342 -0
  110. package/src/selectors/selectors.util.d.ts +4 -0
  111. package/src/selectors.d.ts +1 -0
  112. package/src/viewports.d.ts +7 -0
  113. package/type.command.esm.js +471 -0
  114. package/viewports.esm.d.ts +1 -0
  115. package/viewports.esm.js +46 -0
package/helpers.esm.js ADDED
@@ -0,0 +1,359 @@
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
+ try {
3
+ var info = gen[key](arg);
4
+ var value = info.value;
5
+ } catch (error) {
6
+ reject(error);
7
+ return;
8
+ }
9
+ if (info.done) resolve(value);
10
+ else Promise.resolve(value).then(_next, _throw);
11
+ }
12
+ function _async_to_generator(fn) {
13
+ return function() {
14
+ var self = this, args = arguments;
15
+ return new Promise(function(resolve, reject) {
16
+ var gen = fn.apply(self, args);
17
+ function _next(value) {
18
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
19
+ }
20
+ function _throw(err) {
21
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
22
+ }
23
+ _next(undefined);
24
+ });
25
+ };
26
+ }
27
+
28
+ function _extends() {
29
+ _extends = Object.assign || function assign(target) {
30
+ for(var i = 1; i < arguments.length; i++){
31
+ var source = arguments[i];
32
+ for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
33
+ }
34
+ return target;
35
+ };
36
+ return _extends.apply(this, arguments);
37
+ }
38
+
39
+ function __generator(thisArg, body) {
40
+ var _ = {
41
+ label: 0,
42
+ sent: function sent() {
43
+ if (t[0] & 1) throw t[1];
44
+ return t[1];
45
+ },
46
+ trys: [],
47
+ ops: []
48
+ }, f, y, t, g;
49
+ return g = {
50
+ next: verb(0),
51
+ "throw": verb(1),
52
+ "return": verb(2)
53
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
54
+ return this;
55
+ }), g;
56
+ function verb(n) {
57
+ return function(v) {
58
+ return step([
59
+ n,
60
+ v
61
+ ]);
62
+ };
63
+ }
64
+ function step(op) {
65
+ if (f) throw new TypeError("Generator is already executing.");
66
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
67
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
68
+ if (y = 0, t) op = [
69
+ op[0] & 2,
70
+ t.value
71
+ ];
72
+ switch(op[0]){
73
+ case 0:
74
+ case 1:
75
+ t = op;
76
+ break;
77
+ case 4:
78
+ _.label++;
79
+ return {
80
+ value: op[1],
81
+ done: false
82
+ };
83
+ case 5:
84
+ _.label++;
85
+ y = op[1];
86
+ op = [
87
+ 0
88
+ ];
89
+ continue;
90
+ case 7:
91
+ op = _.ops.pop();
92
+ _.trys.pop();
93
+ continue;
94
+ default:
95
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
96
+ _ = 0;
97
+ continue;
98
+ }
99
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
100
+ _.label = op[1];
101
+ break;
102
+ }
103
+ if (op[0] === 6 && _.label < t[1]) {
104
+ _.label = t[1];
105
+ t = op;
106
+ break;
107
+ }
108
+ if (t && _.label < t[2]) {
109
+ _.label = t[2];
110
+ _.ops.push(op);
111
+ break;
112
+ }
113
+ if (t[2]) _.ops.pop();
114
+ _.trys.pop();
115
+ continue;
116
+ }
117
+ op = body.call(thisArg, _);
118
+ } catch (e) {
119
+ op = [
120
+ 6,
121
+ e
122
+ ];
123
+ y = 0;
124
+ } finally{
125
+ f = t = 0;
126
+ }
127
+ if (op[0] & 5) throw op[1];
128
+ return {
129
+ value: op[0] ? op[1] : void 0,
130
+ done: true
131
+ };
132
+ }
133
+ }
134
+ typeof SuppressedError === "function" ? SuppressedError : function _SuppressedError(error, suppressed, message) {
135
+ var e = new Error(message);
136
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
137
+ };
138
+
139
+ var deepReady = /*#__PURE__*/ _async_to_generator(function(el, full) {
140
+ var element, stencilEl;
141
+ return __generator(this, function(_state) {
142
+ switch(_state.label){
143
+ case 0:
144
+ if (full === void 0) full = false;
145
+ element = el;
146
+ if (!element) return [
147
+ 3,
148
+ 4
149
+ ];
150
+ if (!(element.componentOnReady !== null && element.componentOnReady !== undefined)) return [
151
+ 3,
152
+ 2
153
+ ];
154
+ return [
155
+ 4,
156
+ element.componentOnReady()
157
+ ];
158
+ case 1:
159
+ stencilEl = _state.sent();
160
+ if (!full && stencilEl !== null && stencilEl !== undefined) {
161
+ return [
162
+ 2
163
+ ];
164
+ }
165
+ _state.label = 2;
166
+ case 2:
167
+ return [
168
+ 4,
169
+ Promise.all(Array.from(element.children).map(function(child) {
170
+ return deepReady(child, full);
171
+ }))
172
+ ];
173
+ case 3:
174
+ _state.sent();
175
+ _state.label = 4;
176
+ case 4:
177
+ return [
178
+ 2
179
+ ];
180
+ }
181
+ });
182
+ });
183
+ var rIC = function(callback, timeout) {
184
+ if (timeout === void 0) timeout = 5000;
185
+ if (typeof window !== "undefined" && "requestIdleCallback" in window) {
186
+ window.requestIdleCallback(callback, {
187
+ timeout: timeout
188
+ });
189
+ } else {
190
+ setTimeout(callback, 32);
191
+ }
192
+ };
193
+ var waitAfterFramePaint = function() {
194
+ return new Promise(function(resolve) {
195
+ return raf(function() {
196
+ return runHighPrioritizedTask(resolve);
197
+ });
198
+ });
199
+ };
200
+ var waitAfterIdleCallback = function(timeout) {
201
+ return new Promise(function(resolve) {
202
+ return rIC(function() {
203
+ return runHighPrioritizedTask(resolve);
204
+ }, timeout);
205
+ });
206
+ };
207
+ var raf = function(h) {
208
+ if (typeof __zone_symbol__requestAnimationFrame === "function") {
209
+ return __zone_symbol__requestAnimationFrame(h);
210
+ }
211
+ if (typeof requestAnimationFrame === "function") {
212
+ return requestAnimationFrame(h);
213
+ }
214
+ return setTimeout(h);
215
+ };
216
+ var runHighPrioritizedTask = function(callback) {
217
+ if (typeof window !== "undefined" && "MessageChannel" in window) {
218
+ var messageChannel = new window.MessageChannel();
219
+ messageChannel.port1.onmessage = callback;
220
+ messageChannel.port2.postMessage(undefined);
221
+ } else {
222
+ setTimeout(callback, 32);
223
+ }
224
+ };
225
+ var isElement = function(el, name) {
226
+ return typeof el === "object" && el.length > 0 && el[0].nodeName === name;
227
+ };
228
+ var hasClass = function(el, name) {
229
+ return typeof el === "object" && el.length > 0 && el.hasClass(name);
230
+ };
231
+ var hasTestId = function(el, testId) {
232
+ if (typeof el === "object" && el.length > 0) {
233
+ var dataTestId = el.data("testid");
234
+ return dataTestId === testId;
235
+ }
236
+ return false;
237
+ };
238
+ var isLabel = function(el) {
239
+ return isElement(el, "LABEL");
240
+ };
241
+ var isAccordion = function(el) {
242
+ return isElement(el, "BAL-ACCORDION");
243
+ };
244
+ var isButton = function(el) {
245
+ return isElement(el, "BAL-BUTTON");
246
+ };
247
+ var isCheckbox = function(el) {
248
+ return isElement(el, "BAL-CHECKBOX");
249
+ };
250
+ var isDatepicker = function(el) {
251
+ return isElement(el, "BAL-DATEPICKER");
252
+ };
253
+ var isNumberInput = function(el) {
254
+ return isElement(el, "BAL-NUMBER-INPUT");
255
+ };
256
+ var isRadio = function(el) {
257
+ return isElement(el, "BAL-RADIO");
258
+ };
259
+ var isSelect = function(el) {
260
+ return isElement(el, "BAL-SELECT");
261
+ };
262
+ var isTag = function(el) {
263
+ return isElement(el, "BAL-TAG");
264
+ };
265
+ var isTabs = function(el) {
266
+ return isElement(el, "BAL-TABS");
267
+ };
268
+ var isSteps = function(el) {
269
+ return isElement(el, "BAL-STEPS");
270
+ };
271
+ var isSlider = function(el) {
272
+ return isElement(el, "BAL-INPUT-SLIDER");
273
+ };
274
+ var isHint = function(el) {
275
+ return isElement(el, "BAL-HINT");
276
+ };
277
+ var isTextarea = function(el) {
278
+ return isElement(el, "BAL-TEXTAREA");
279
+ };
280
+ var isInputStepper = function(el) {
281
+ return isElement(el, "BAL-INPUT-STEPPER");
282
+ };
283
+ var isInput = function(el) {
284
+ return isElement(el, "BAL-INPUT");
285
+ };
286
+ var isInputDate = function(el) {
287
+ return isElement(el, "BAL-INPUT-DATE");
288
+ };
289
+ /**
290
+ * Executes a command on a child element and wraps back to the main element/component
291
+ */ var wrapOptions = function(options) {
292
+ return _extends({
293
+ log: false
294
+ }, options);
295
+ };
296
+ var wrapCommand = function(displayName, element, message, fn) {
297
+ return function(selector) {
298
+ return cy.wrapComponent(element, {
299
+ log: false
300
+ }).waitForComponents().find(selector, {
301
+ log: false
302
+ }).then(function($el) {
303
+ Cypress.log({
304
+ type: "parent",
305
+ $el: $el,
306
+ displayName: displayName,
307
+ message: message
308
+ });
309
+ return fn($el);
310
+ }).wrapComponent(element, {
311
+ log: false
312
+ });
313
+ };
314
+ };
315
+ var shouldLog = function(options) {
316
+ return options === undefined || options.log !== false;
317
+ };
318
+ var log = function(displayName, message, $el, options) {
319
+ if (message === void 0) message = "";
320
+ if (shouldLog(options)) {
321
+ Cypress.log({
322
+ type: "parent",
323
+ $el: $el,
324
+ displayName: displayName,
325
+ message: message
326
+ });
327
+ }
328
+ };
329
+ var areComponentsReady = function($el) {
330
+ var queue = [];
331
+ for(var index = 0; index < $el.length; index++){
332
+ var element = $el[index];
333
+ queue.push(deepReady(element, true));
334
+ }
335
+ return Promise.all(queue);
336
+ };
337
+ var testOnPlatforms = function(platforms, fn) {
338
+ var _loop = function(index) {
339
+ var platform = platforms[index];
340
+ context("on " + platform, function() {
341
+ beforeEach(function() {
342
+ return cy.platform(platform);
343
+ });
344
+ fn(platform);
345
+ });
346
+ };
347
+ for(var index = 0; index < platforms.length; index++)_loop(index);
348
+ };
349
+ function checkAriaLabel(element, label) {
350
+ if (label === undefined || label === null || label === "") {
351
+ return true;
352
+ }
353
+ var ariaLabel = Cypress.$(element).attr("aria-label");
354
+ var title = Cypress.$(element).attr("title");
355
+ var text = Cypress.$(element).text().trim();
356
+ return text === label.trim() || ariaLabel === label.trim() || title === label.trim();
357
+ }
358
+
359
+ export { hasTestId as A, isSteps as B, _extends as _, waitAfterFramePaint as a, waitAfterIdleCallback as b, checkAriaLabel as c, areComponentsReady as d, deepReady as e, isAccordion as f, isCheckbox as g, isDatepicker as h, isButton as i, isInput as j, isInputDate as k, log as l, isNumberInput as m, isTextarea as n, isSlider as o, isRadio as p, isSelect as q, wrapCommand as r, isTag as s, testOnPlatforms as t, hasClass as u, isHint as v, wrapOptions as w, isLabel as x, isInputStepper as y, isTabs as z };
package/index.esm.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";