@sap_oss/wdio-qmate-service 3.9.0 → 3.10.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.
Files changed (58) hide show
  1. package/lib/reuse/helper/tableHelper.js +3 -0
  2. package/lib/reuse/helper/tableHelper.js.map +1 -1
  3. package/lib/reuse/index.js +0 -17
  4. package/lib/reuse/index.js.map +1 -1
  5. package/lib/reuse/modules/flp/userSettings.d.ts +2 -0
  6. package/lib/reuse/modules/flp/userSettings.js +6 -1
  7. package/lib/reuse/modules/flp/userSettings.js.map +1 -1
  8. package/lib/reuse/modules/ui5/assertion.d.ts +1 -0
  9. package/lib/reuse/modules/ui5/assertion.js +11 -4
  10. package/lib/reuse/modules/ui5/assertion.js.map +1 -1
  11. package/lib/reuse/modules/ui5/element.d.ts +2 -2
  12. package/lib/reuse/modules/ui5/element.js +7 -4
  13. package/lib/reuse/modules/ui5/element.js.map +1 -1
  14. package/lib/reuse/modules/ui5/session.d.ts +4 -2
  15. package/lib/reuse/modules/ui5/session.js +32 -4
  16. package/lib/reuse/modules/ui5/session.js.map +1 -1
  17. package/lib/reuse/modules/ui5/table.js +25 -9
  18. package/lib/reuse/modules/ui5/table.js.map +1 -1
  19. package/lib/reuse/modules/ui5/userInteraction.d.ts +1 -1
  20. package/lib/reuse/modules/ui5/userInteraction.js +47 -58
  21. package/lib/reuse/modules/ui5/userInteraction.js.map +1 -1
  22. package/lib/reuse/modules/util/file.d.ts +5 -3
  23. package/lib/reuse/modules/util/file.js +33 -7
  24. package/lib/reuse/modules/util/file.js.map +1 -1
  25. package/package.json +18 -26
  26. package/reuseApi.json +8 -468
  27. package/test/helper/configurations/base.conf.js +6 -3
  28. package/test/helper/configurations/chrome.headless.conf.js +1 -1
  29. package/test/reuse/ui5/assertion/expectAttributeToBe.spec.js +74 -29
  30. package/test/reuse/ui5/assertion/expectAttributeToContain.spec.js +42 -0
  31. package/test/reuse/ui5/confirmationDialog/clickButton.spec.js +1 -1
  32. package/test/reuse/ui5/confirmationDialog/clickOk.spec.js +1 -1
  33. package/test/reuse/ui5/table/selectRowByValues.spec.js +6 -6
  34. package/test/reuse/ui5/userInteraction/click.spec.js +51 -13
  35. package/test/reuse/ui5/userInteraction/doubleClick.spec.js +1 -1
  36. package/test/reuse/util/file/pdfParser.spec.js +1 -2
  37. package/lib/reuse/modules/mobile/Mobile.d.ts +0 -16
  38. package/lib/reuse/modules/mobile/Mobile.js +0 -23
  39. package/lib/reuse/modules/mobile/Mobile.js.map +0 -1
  40. package/lib/reuse/modules/mobile/android.d.ts +0 -32
  41. package/lib/reuse/modules/mobile/android.js +0 -85
  42. package/lib/reuse/modules/mobile/android.js.map +0 -1
  43. package/lib/reuse/modules/mobile/device.d.ts +0 -173
  44. package/lib/reuse/modules/mobile/device.js +0 -403
  45. package/lib/reuse/modules/mobile/device.js.map +0 -1
  46. package/lib/reuse/modules/mobile/element.d.ts +0 -95
  47. package/lib/reuse/modules/mobile/element.js +0 -185
  48. package/lib/reuse/modules/mobile/element.js.map +0 -1
  49. package/lib/reuse/modules/mobile/gestures.d.ts +0 -42
  50. package/lib/reuse/modules/mobile/gestures.js +0 -86
  51. package/lib/reuse/modules/mobile/gestures.js.map +0 -1
  52. package/lib/reuse/modules/mobile/ios.d.ts +0 -10
  53. package/lib/reuse/modules/mobile/ios.js +0 -19
  54. package/lib/reuse/modules/mobile/ios.js.map +0 -1
  55. package/lib/reuse/modules/mobile/userInteraction.d.ts +0 -94
  56. package/lib/reuse/modules/mobile/userInteraction.js +0 -210
  57. package/lib/reuse/modules/mobile/userInteraction.js.map +0 -1
  58. package/test/helper/configurations/mobile.conf.js +0 -16
@@ -1,185 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ElementModule = void 0;
7
- const verboseLogger_1 = require("../../helper/verboseLogger");
8
- const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
9
- const elementResolving_1 = require("../../helper/elementResolving");
10
- const constants_1 = require("../constants");
11
- /**
12
- * @class element
13
- * @memberof mobile
14
- */
15
- class ElementModule {
16
- vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "element");
17
- ErrorHandler = new errorHandler_1.default();
18
- /**
19
- * @function isVisible
20
- * @memberof mobile.element
21
- * @description Returns a boolean if the mobile element is visible to the user.
22
- * @param {Element} element - The Mobile Ui element.
23
- * @param {boolean} [strict=true] - If strict mode is enabled it will only return "true" if the element is visible on the mobile view and within the viewport.
24
- * If "false", it will be sufficient if the element is visible on the view but not inside the current viewport.
25
- * @returns {boolean} Returns true or false.
26
- * @example
27
- * await mobile.element.isVisible(elem);
28
- */
29
- async isVisible(element, strict = true) {
30
- const vl = this.vlf.initLog(this.isVisible);
31
- try {
32
- if (strict) {
33
- return element.isDisplayedInViewport();
34
- }
35
- else {
36
- return element.isDisplayed();
37
- }
38
- }
39
- catch (error) {
40
- return this.ErrorHandler.logException(error);
41
- }
42
- }
43
- /**
44
- * @function isPresent
45
- * @memberof mobile.element
46
- * @description Returns a boolean if the element is present at the DOM or not. It might be hidden.
47
- * @param {Element} element - The element.
48
- * @returns {boolean} Returns true or false.
49
- * @example
50
- * await mobile.element.isPresent(elem);
51
- */
52
- async isPresent(element) {
53
- const vl = this.vlf.initLog(this.isPresent);
54
- return element.isExisting();
55
- }
56
- /**
57
- * @function waitToBePresent
58
- * @memberof mobile.element
59
- * @description Waits until the element with the given selector is present.
60
- * @param {Object} selector - The CSS selector describing the element.
61
- * @param {number} [timeout = 30000] - The timeout to wait (ms).
62
- * @returns {boolean} Returns true or false.
63
- * @example
64
- * await mobile.element.waitToBePresent(".input01");
65
- * await mobile.element.waitToBePresent("#button12");
66
- * await mobile.element.waitToBePresent("p:first-child");
67
- */
68
- async waitToBePresent(selector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || constants_1.GLOBAL_DEFAULT_WAIT_TIMEOUT) {
69
- const vl = this.vlf.initLog(this.waitToBePresent);
70
- try {
71
- vl.log(`wdio.waitForExist invocation for selector ${selector}`);
72
- await $(selector).waitForExist({
73
- timeout: timeout,
74
- interval: constants_1.GLOBAL_DEFAULT_WAIT_INTERVAL,
75
- timeoutMsg: `Timeout '${+timeout / 1000}s' by waiting for element is present.`
76
- });
77
- return true;
78
- }
79
- catch (error) {
80
- this.ErrorHandler.logException(error);
81
- return false;
82
- }
83
- }
84
- /**
85
- * @function waitToBeVisible
86
- * @memberof mobile.element
87
- * @description Waits until the element with the given selector is visible.
88
- * @param {Object} selector - The CSS selector describing the element.
89
- * @param {number} [timeout=30000] - The timeout to wait (ms).
90
- * @returns {boolean} Returns true or false.
91
- * @example
92
- * await mobile.element.waitToBeVisible(".input01");
93
- * await mobile.element.waitToBeVisible("#button12");
94
- * await mobile.element.waitToBeVisible("p:first-child");
95
- */
96
- async waitToBeVisible(selector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || constants_1.GLOBAL_DEFAULT_WAIT_TIMEOUT) {
97
- const vl = this.vlf.initLog(this.waitToBeVisible);
98
- try {
99
- vl.log(`wdio.waitForDisplayed invocation for selector ${selector}`);
100
- await $(selector).waitForDisplayed({
101
- timeout: timeout,
102
- interval: constants_1.GLOBAL_DEFAULT_WAIT_INTERVAL,
103
- timeoutMsg: `Timeout '${+timeout / 1000}s' by waiting for element is displayed.`
104
- });
105
- return true;
106
- }
107
- catch (error) {
108
- this.ErrorHandler.logException(error);
109
- return false;
110
- }
111
- }
112
- /**
113
- * @function waitToBeClickable
114
- * @memberof mobile.element
115
- * @description Waits until the element with the given selector is clickable.
116
- * @param {Object} selector - The CSS selector describing the element.
117
- * @param {number} [timeout=30000] - The timeout to wait (ms).
118
- * @returns {boolean} Returns true or false.
119
- * @example
120
- * await mobile.element.waitToBeClickable(".input01");
121
- * await mobile.element.waitToBeClickable("#button12");
122
- * await mobile.element.waitToBeClickable("p:first-child");
123
- */
124
- async waitToBeClickable(selector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || constants_1.GLOBAL_DEFAULT_WAIT_TIMEOUT) {
125
- const vl = this.vlf.initLog(this.waitToBeClickable);
126
- try {
127
- vl.log(`wdio.waitForClickable invocation for selector ${selector}`);
128
- await $(selector).waitForClickable({
129
- timeout: timeout,
130
- interval: constants_1.GLOBAL_DEFAULT_WAIT_INTERVAL,
131
- timeoutMsg: `Timeout '${+timeout / 1000}s' by waiting for element is clickable.`
132
- });
133
- return true;
134
- }
135
- catch (error) {
136
- this.ErrorHandler.logException(error);
137
- return false;
138
- }
139
- }
140
- /**
141
- * @function isSelected
142
- * @memberof mobile.element
143
- * @description Returns a boolean if the element (e.g. checkbox) is selected.
144
- * @param {Element | string} elementOrSelector - The element.
145
- * @returns {boolean} Returns true or false.
146
- * @example
147
- * const isSelected = await mobile.element.isSelected(elem);
148
- */
149
- async isSelected(elementOrSelector) {
150
- const vl = this.vlf.initLog(this.isSelected);
151
- const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
152
- return await element.isSelected();
153
- }
154
- /**
155
- * @function waitToBeEnabled
156
- * @memberof mobile.element
157
- * @description Waits until the element with the given selector is present.
158
- * @param {Object} selector - The CSS selector describing the element.
159
- * @param {number} [timeout=30000] - The timeout to wait (ms).
160
- * @returns {boolean} Returns true or false.
161
- * @example
162
- * await mobile.element.waitToBeEnabled(".input01");
163
- * await mobile.element.waitToBeEnabled("#button12");
164
- * await mobile.element.waitToBeEnabled("p:first-child");
165
- */
166
- async waitToBeEnabled(selector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || constants_1.GLOBAL_DEFAULT_WAIT_TIMEOUT) {
167
- const vl = this.vlf.initLog(this.waitToBeEnabled);
168
- try {
169
- vl.log(`wdio.waitTotoBeEnabled invocation for selector ${selector}`);
170
- await $(selector).toBeEnabled({
171
- timeout: timeout,
172
- interval: constants_1.GLOBAL_DEFAULT_WAIT_INTERVAL,
173
- timeoutMsg: `Timeout '${+timeout / 1000}s' by waiting for element is enabled.`
174
- });
175
- return true;
176
- }
177
- catch (error) {
178
- this.ErrorHandler.logException(error);
179
- return false;
180
- }
181
- }
182
- }
183
- exports.ElementModule = ElementModule;
184
- exports.default = new ElementModule();
185
- //# sourceMappingURL=element.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"element.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/element.ts"],"names":[],"mappings":";;;;;;AACA,8DAAkE;AAClE,6EAAqD;AACrD,oEAA+E;AAC/E,4CAAyF;AAEzF;;;GAGG;AACH,MAAa,aAAa;IAChB,GAAG,GAAG,IAAI,oCAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACpD,YAAY,GAAG,IAAI,sBAAY,EAAE,CAAC;IAE1C;;;;;;;;;;OAUG;IACH,KAAK,CAAC,SAAS,CAAC,OAAgB,EAAE,SAAkB,IAAI;QACtD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,OAAO,CAAC,qBAAqB,EAAE,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACN,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;YAC/B,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,SAAS,CAAC,OAAgB;QAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5C,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,eAAe,CAAC,QA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ACH,EAAE,CAAC,GAAG,CAAC,kDAAkD,QAAQ,EAAE,CAAC,CAAC;YACrE,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC;gBAC5B,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,wCAA4B;gBACtC,UAAU,EAAE,YAAY,CAAC,OAAO,GAAG,IAAI,uCAAuC;aAC/E,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACtC,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAzKD,sCAyKC;AACD,kBAAe,IAAI,aAAa,EAAE,CAAC"}
@@ -1,42 +0,0 @@
1
- /**
2
- * @class gestures
3
- * @memberof mobile
4
- */
5
- export declare class Gestures {
6
- private vlf;
7
- private ErrorHandler;
8
- /**
9
- * @function swipe
10
- * @memberof mobile.gestures
11
- * @description Swipe from one point to another on the screen,
12
- * Ensure that the provided coordinates are within the bounds of the screen to avoid unexpected behavior.
13
- * @param {number} startX - The starting X coordinate of the swipe
14
- * @param {number} startY - The starting Y coordinate of the swipe
15
- * @param {number} endX - The ending X coordinate of the swipe
16
- * @param {number} endY - The ending Y coordinate of the swipe
17
- * @param {number} [duration=1000] - The duration of the swipe in milliseconds (optional, default is 1000ms)
18
- * @returns {Promise<void>}
19
- * @example
20
- * // Swipes from left to right across the screen horizontally (useful for image carousels or galleries).
21
- * await mobile.gestures.swipe(100, 800, 800, 800);
22
- * // Swipes from bottom to top vertically to scroll down a list.
23
- * await mobile.gestures.swipe(300, 1000, 300, 400);
24
- * // Swipes from the top down to refresh content on a mobile app (common for pull-to-refresh).
25
- * await mobile.gestures.swipe(400, 200, 400, 800);
26
- */
27
- swipe(startX: number, startY: number, endX: number, endY: number, duration?: number): Promise<void>;
28
- /**
29
- * @function tap
30
- * @memberof mobile.gestures
31
- * @description Executes a tap at the given screen coordinates,
32
- * Ensure that the provided coordinates are within the bounds of the screen to avoid unexpected behavior.
33
- * @param {number} coordX - The horizontal screen coordinate for the tap.
34
- * @param {number} coordY - The vertical screen coordinate for the tap.
35
- * @returns {Promise<void>}
36
- * @example
37
- * await mobile.gestures.tap(100, 800);
38
- */
39
- tap(coordX: number, coordY: number): Promise<void>;
40
- }
41
- declare const _default: Gestures;
42
- export default _default;
@@ -1,86 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Gestures = void 0;
7
- const verboseLogger_1 = require("../../helper/verboseLogger");
8
- const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
9
- /**
10
- * @class gestures
11
- * @memberof mobile
12
- */
13
- class Gestures {
14
- vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "gestures");
15
- ErrorHandler = new errorHandler_1.default();
16
- /**
17
- * @function swipe
18
- * @memberof mobile.gestures
19
- * @description Swipe from one point to another on the screen,
20
- * Ensure that the provided coordinates are within the bounds of the screen to avoid unexpected behavior.
21
- * @param {number} startX - The starting X coordinate of the swipe
22
- * @param {number} startY - The starting Y coordinate of the swipe
23
- * @param {number} endX - The ending X coordinate of the swipe
24
- * @param {number} endY - The ending Y coordinate of the swipe
25
- * @param {number} [duration=1000] - The duration of the swipe in milliseconds (optional, default is 1000ms)
26
- * @returns {Promise<void>}
27
- * @example
28
- * // Swipes from left to right across the screen horizontally (useful for image carousels or galleries).
29
- * await mobile.gestures.swipe(100, 800, 800, 800);
30
- * // Swipes from bottom to top vertically to scroll down a list.
31
- * await mobile.gestures.swipe(300, 1000, 300, 400);
32
- * // Swipes from the top down to refresh content on a mobile app (common for pull-to-refresh).
33
- * await mobile.gestures.swipe(400, 200, 400, 800);
34
- */
35
- async swipe(startX, startY, endX, endY, duration = 1000) {
36
- const vl = this.vlf.initLog(this.swipe);
37
- try {
38
- // Validate input coordinates
39
- if (startX < 0 || startY < 0 || endX < 0 || endY < 0) {
40
- throw new Error(`Invalid coordinates: (${startX}, ${startY}) to (${endX}, ${endY}) must be non-negative.`);
41
- }
42
- // Log the swipe action for debugging
43
- vl.log(`Swiping from (${startX}, ${startY}) to (${endX}, ${endY}) over ${duration}ms`);
44
- await browser.touchPerform([
45
- { action: "press", options: { x: startX, y: startY } },
46
- { action: "wait", options: { ms: duration } }, // Wait for the duration of the swipe
47
- { action: "moveTo", options: { x: endX, y: endY } },
48
- { action: "release" }
49
- ]);
50
- vl.log("Swipe completed successfully...");
51
- }
52
- catch (error) {
53
- this.ErrorHandler.logException(error);
54
- }
55
- }
56
- /**
57
- * @function tap
58
- * @memberof mobile.gestures
59
- * @description Executes a tap at the given screen coordinates,
60
- * Ensure that the provided coordinates are within the bounds of the screen to avoid unexpected behavior.
61
- * @param {number} coordX - The horizontal screen coordinate for the tap.
62
- * @param {number} coordY - The vertical screen coordinate for the tap.
63
- * @returns {Promise<void>}
64
- * @example
65
- * await mobile.gestures.tap(100, 800);
66
- */
67
- async tap(coordX, coordY) {
68
- const vl = this.vlf.initLog(this.tap);
69
- try {
70
- // Input validation
71
- if (coordX < 0 || coordY < 0) {
72
- throw new Error(`Invalid coordinates: x (${coordX}) and y (${coordY}) must be non-negative.`);
73
- }
74
- // Log the tap action for debugging
75
- vl.log(`Initiating tap at coordinates (${coordX}, ${coordY}).`);
76
- await browser.touchPerform([{ action: "tap", options: { coordX, coordY } }]);
77
- vl.log("Coordinate tap completed successfully...");
78
- }
79
- catch (error) {
80
- this.ErrorHandler.logException(error);
81
- }
82
- }
83
- }
84
- exports.Gestures = Gestures;
85
- exports.default = new Gestures();
86
- //# sourceMappingURL=gestures.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gestures.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/gestures.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAkE;AAClE,6EAAqD;AAErD;;;GAGG;A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E,CAAC;YACf,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,GAAG,CAAC,MAAc,EAAE,MAAc;QACtC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC;YACH,mBAAmB;YACnB,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,MAAM,IAAI,KAAK,CAAC,2BAA2B,MAAM,YAAY,MAAM,yBAAyB,CAAC,CAAC;YAChG,CAAC;YACD,mCAAmC;YACnC,EAAE,CAAC,GAAG,CAAC,kCAAkC,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC;YAEhE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;YAE7E,EAAE,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF;AA3ED,4BA2EC;AACD,kBAAe,IAAI,QAAQ,EAAE,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * @class ios
3
- * @memberof mobile
4
- */
5
- export declare class Ios {
6
- private vlf;
7
- private ErrorHandler;
8
- }
9
- declare const _default: Ios;
10
- export default _default;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Ios = void 0;
7
- const verboseLogger_1 = require("../../helper/verboseLogger");
8
- const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
9
- /**
10
- * @class ios
11
- * @memberof mobile
12
- */
13
- class Ios {
14
- vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "ios");
15
- ErrorHandler = new errorHandler_1.default();
16
- }
17
- exports.Ios = Ios;
18
- exports.default = new Ios();
19
- //# sourceMappingURL=ios.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ios.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/ios.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAkE;AAClE,6EAAqD;AAErD;;;GAGG;AACH,MAAa,GAAG;IACN,GAAG,GAAG,IAAI,oCAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAChD,YAAY,GAAG,IAAI,sBAAY,EAAE,CAAC;CAC3C;AAHD,kBAGC;AACD,kBAAe,IAAI,GAAG,EAAE,CAAC"}
@@ -1,94 +0,0 @@
1
- import { Element } from "../../../../@types/wdio";
2
- /**
3
- * @class userInteraction
4
- * @memberof mobile
5
- */
6
- export declare class UserInteraction {
7
- private vlf;
8
- private ErrorHandler;
9
- /**
10
- * @function tap
11
- * @memberof mobile.userInteraction
12
- * @description Tap's on the mobile element.
13
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
14
- * @param {Number} [timeout = 30000] - The timeout to wait(ms)
15
- * @example
16
- * await mobile.userInteraction.tap(elem);
17
- * await mobile.userInteraction.tap(elem, 20000);
18
- */
19
- tap(elementOrSelector: Element | string, timeout?: number): Promise<void>;
20
- /**
21
- * @function check
22
- * @memberof mobile.userInteraction
23
- * @description Checks the given checkbox.
24
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
25
- * @param {number} [timeout = 30000] - The timeout to wait(ms)
26
- * @example
27
- * await mobile.userInteraction.check(element);
28
- * await mobile.userInteraction.check(element, 20000);
29
- */
30
- check(elementOrSelector: Element | string, timeout?: number): Promise<void>;
31
- /**
32
- * @function uncheck
33
- * @memberOf mobile.userInteraction
34
- * @description Unchecks the given checkbox.
35
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
36
- * @param {number} [timeout = 30000] - The timeout to wait(ms)
37
- * @example
38
- * await mobile.userInteraction.uncheck(elementOrSelector);
39
- * await mobile.userInteraction.uncheck(elementOrSelector, 20000);
40
- */
41
- uncheck(elementOrSelector: Element | string, timeout?: number): Promise<void>;
42
- /**
43
- * @function doubleTap
44
- * @memberof mobile.userInteraction
45
- * @description Double Tap's on the mobile element.
46
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
47
- * @param {number} [timeout = 30000] - The timeout to wait(ms)
48
- * @returns {Promise<void>}
49
- * @example
50
- * await mobile.userInteraction.doubleTap(elem);
51
- * await mobile.userInteraction.doubleTap(elem, 2000);
52
- */
53
- doubleTap(elementOrSelector: Element | string, timeout?: number): Promise<void>;
54
- /**
55
- * @function fill
56
- * @memberof mobile.userInteraction
57
- * @description Enter a string value into a mobile input field.
58
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
59
- * @param {string} value - The string value to be entered.
60
- * @param {number} [timeout = 30000] - The timeout to wait (ms).
61
- * @returns {Promise<void>}
62
- * @example
63
- * await mobile.userInteraction.fill(element);
64
- * await mobile.userInteraction.fill(element, 2000);
65
- */
66
- fill(elementOrSelector: Element | string, value: string, timeout?: number): Promise<void>;
67
- /**
68
- * @function clearAndFill
69
- * @memberof mobile.userInteraction
70
- * @description Enter a string into the mobile input field; it will clear the box before submission.
71
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
72
- * @param {string} value - The string value to be entered.
73
- * @param {number} [timeout = 30000] - The timeout to wait (ms).
74
- * @returns {Promise<void>}
75
- * @example
76
- * await mobile.userInteraction.clearAndFill(element);
77
- * await mobile.userInteraction.clearAndFill(element, 2000);
78
- */
79
- clearAndFill(elementOrSelector: Element | string, value: string, timeout?: number): Promise<void>;
80
- /**
81
- * @function clear
82
- * @memberof mobile.userInteraction
83
- * @description Clear a string value into a mobile input field.
84
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
85
- * @param {number} [timeout = 30000] - The timeout to wait (ms).
86
- * @returns {Promise<void>}
87
- * @example
88
- * await mobile.userInteraction.clear(element);
89
- * await mobile.userInteraction.clear(element, 2000);
90
- */
91
- clear(elementOrSelector: Element | string, timeout?: number): Promise<void>;
92
- }
93
- declare const _default: UserInteraction;
94
- export default _default;
@@ -1,210 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UserInteraction = void 0;
7
- const verboseLogger_1 = require("../../helper/verboseLogger");
8
- const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
9
- const elementResolving_1 = require("../../helper/elementResolving");
10
- const constants_1 = require("../constants");
11
- /**
12
- * @class userInteraction
13
- * @memberof mobile
14
- */
15
- class UserInteraction {
16
- vlf = new verboseLogger_1.VerboseLoggerFactory("mobile", "UserInteraction");
17
- ErrorHandler = new errorHandler_1.default();
18
- /**
19
- * @function tap
20
- * @memberof mobile.userInteraction
21
- * @description Tap's on the mobile element.
22
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
23
- * @param {Number} [timeout = 30000] - The timeout to wait(ms)
24
- * @example
25
- * await mobile.userInteraction.tap(elem);
26
- * await mobile.userInteraction.tap(elem, 20000);
27
- */
28
- async tap(elementOrSelector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || constants_1.GLOBAL_DEFAULT_WAIT_TIMEOUT) {
29
- const vl = this.vlf.initLog(this.tap);
30
- try {
31
- const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
32
- vl.log("Waiting for the element to become enabled and visible within the specified timeout");
33
- await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
34
- vl.log("Tapping on the element");
35
- await element.click();
36
- vl.log("Given element is successfully taped on the mobile Ui");
37
- }
38
- catch (error) {
39
- this.ErrorHandler.logException(error, `Error: element still not tapable after ${timeout} ms`, true);
40
- }
41
- }
42
- /**
43
- * @function check
44
- * @memberof mobile.userInteraction
45
- * @description Checks the given checkbox.
46
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
47
- * @param {number} [timeout = 30000] - The timeout to wait(ms)
48
- * @example
49
- * await mobile.userInteraction.check(element);
50
- * await mobile.userInteraction.check(element, 20000);
51
- */
52
- async check(elementOrSelector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || constants_1.GLOBAL_DEFAULT_WAIT_TIMEOUT) {
53
- const vl = this.vlf.initLog(this.check);
54
- try {
55
- const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
56
- vl.log("Waiting for the element to become enabled and visible within the specified timeout");
57
- await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
58
- const isSelected = await mobile.element.isSelected(element);
59
- if (!isSelected) {
60
- await this.tap(element);
61
- vl.log("Given element is successfully checked on the mobile Ui");
62
- }
63
- else {
64
- vl.log("Checkbox already selected.");
65
- }
66
- }
67
- catch (error) {
68
- this.ErrorHandler.logException(error, `Error: element still not able to check after ${timeout} ms`, true);
69
- }
70
- }
71
- /**
72
- * @function uncheck
73
- * @memberOf mobile.userInteraction
74
- * @description Unchecks the given checkbox.
75
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
76
- * @param {number} [timeout = 30000] - The timeout to wait(ms)
77
- * @example
78
- * await mobile.userInteraction.uncheck(elementOrSelector);
79
- * await mobile.userInteraction.uncheck(elementOrSelector, 20000);
80
- */
81
- async uncheck(elementOrSelector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || constants_1.GLOBAL_DEFAULT_WAIT_TIMEOUT) {
82
- const vl = this.vlf.initLog(this.uncheck);
83
- try {
84
- const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
85
- vl.log("Waiting for the element to become enabled and visible within the specified timeout");
86
- await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
87
- const isSelected = await mobile.element.isSelected(element);
88
- if (isSelected) {
89
- await this.tap(element);
90
- vl.log("Given element is successfully uncheck on the mobile Ui");
91
- }
92
- else {
93
- vl.log("Checkbox already unchecked.");
94
- }
95
- }
96
- catch (error) {
97
- this.ErrorHandler.logException(error, `Error: element still not able to uncheck after ${timeout} ms`, true);
98
- }
99
- }
100
- /**
101
- * @function doubleTap
102
- * @memberof mobile.userInteraction
103
- * @description Double Tap's on the mobile element.
104
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
105
- * @param {number} [timeout = 30000] - The timeout to wait(ms)
106
- * @returns {Promise<void>}
107
- * @example
108
- * await mobile.userInteraction.doubleTap(elem);
109
- * await mobile.userInteraction.doubleTap(elem, 2000);
110
- */
111
- async doubleTap(elementOrSelector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || constants_1.GLOBAL_DEFAULT_WAIT_TIMEOUT) {
112
- const vl = this.vlf.initLog(this.doubleTap);
113
- try {
114
- const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
115
- vl.log("Waiting for the element to become enabled and visible within the specified timeout");
116
- await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
117
- vl.log("Double taping on the element");
118
- await element.doubleClick();
119
- vl.log("Given element is successfully double taped on the mobile Ui");
120
- }
121
- catch (error) {
122
- this.ErrorHandler.logException(error, `Error: element still not able to double tap after ${timeout} ms`, true);
123
- }
124
- }
125
- /**
126
- * @function fill
127
- * @memberof mobile.userInteraction
128
- * @description Enter a string value into a mobile input field.
129
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
130
- * @param {string} value - The string value to be entered.
131
- * @param {number} [timeout = 30000] - The timeout to wait (ms).
132
- * @returns {Promise<void>}
133
- * @example
134
- * await mobile.userInteraction.fill(element);
135
- * await mobile.userInteraction.fill(element, 2000);
136
- */
137
- async fill(elementOrSelector, value, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || constants_1.GLOBAL_DEFAULT_WAIT_TIMEOUT) {
138
- const vl = this.vlf.initLog(this.fill);
139
- try {
140
- const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
141
- vl.log("Waiting for the element to become enabled and visible within the specified timeout");
142
- await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
143
- // Set the value
144
- vl.log("set text on the element");
145
- await element.setValue(value);
146
- vl.log(`Entered value "${value}" into input box by selector "${element}`);
147
- }
148
- catch (error) {
149
- this.ErrorHandler.logException(error, `Error: element still not able to fill the value after ${timeout} ms`, true);
150
- }
151
- }
152
- /**
153
- * @function clearAndFill
154
- * @memberof mobile.userInteraction
155
- * @description Enter a string into the mobile input field; it will clear the box before submission.
156
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
157
- * @param {string} value - The string value to be entered.
158
- * @param {number} [timeout = 30000] - The timeout to wait (ms).
159
- * @returns {Promise<void>}
160
- * @example
161
- * await mobile.userInteraction.clearAndFill(element);
162
- * await mobile.userInteraction.clearAndFill(element, 2000);
163
- */
164
- async clearAndFill(elementOrSelector, value, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || constants_1.GLOBAL_DEFAULT_WAIT_TIMEOUT) {
165
- const vl = this.vlf.initLog(this.clearAndFill);
166
- try {
167
- const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
168
- vl.log("Waiting for the element to become enabled and visible within the specified timeout");
169
- await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
170
- // Clear the input box.
171
- await element.clearValue();
172
- vl.log("Clear the existing text on the given element");
173
- // Set the value
174
- vl.log("set value on the input element");
175
- await element.setValue(value);
176
- vl.log(`Entered value "${value}" into input box by selector "${element}`);
177
- }
178
- catch (error) {
179
- this.ErrorHandler.logException(error, `Error: element still not able to fill the value after ${timeout} ms`, true);
180
- }
181
- }
182
- /**
183
- * @function clear
184
- * @memberof mobile.userInteraction
185
- * @description Clear a string value into a mobile input field.
186
- * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
187
- * @param {number} [timeout = 30000] - The timeout to wait (ms).
188
- * @returns {Promise<void>}
189
- * @example
190
- * await mobile.userInteraction.clear(element);
191
- * await mobile.userInteraction.clear(element, 2000);
192
- */
193
- async clear(elementOrSelector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || constants_1.GLOBAL_DEFAULT_WAIT_TIMEOUT) {
194
- const vl = this.vlf.initLog(this.clear);
195
- try {
196
- const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
197
- vl.log("Waiting for the element to become enabled and visible within the specified timeout");
198
- await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
199
- vl.log("Clearing the existing text on the given element");
200
- await element.clearValue();
201
- vl.log("Cleared the existing text on the given element");
202
- }
203
- catch (error) {
204
- this.ErrorHandler.logException(error, `Error: element still not able to clear the value after ${timeout} ms`, true);
205
- }
206
- }
207
- }
208
- exports.UserInteraction = UserInteraction;
209
- exports.default = new UserInteraction();
210
- //# sourceMappingURL=userInteraction.js.map