@sap_oss/wdio-qmate-service 2.13.0 → 2.13.2

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 (66) hide show
  1. package/docs/doc.md +140 -7
  2. package/docs/index.md +1 -1
  3. package/docs/sections/bestPractices/authentication.md +2 -2
  4. package/docs/sections/bestPractices/dataHandling.md +1 -1
  5. package/docs/sections/contact.md +1 -1
  6. package/docs/sections/features/config.md +1 -1
  7. package/docs/sections/features/dataHandling.md +2 -2
  8. package/docs/sections/features/selectors.md +10 -10
  9. package/docs/sections/gettingStarted/config.md +1 -1
  10. package/docs/sections/gettingStarted/setup.md +2 -2
  11. package/docs/sections/support/bugReporting.md +4 -4
  12. package/docs/sections/support/troubleshooting.md +1 -1
  13. package/lib/index.js.map +1 -1
  14. package/lib/reuse/helper/elementResolving.d.ts +1 -0
  15. package/lib/reuse/helper/elementResolving.js +12 -0
  16. package/lib/reuse/helper/elementResolving.js.map +1 -1
  17. package/lib/reuse/index.js +2 -1
  18. package/lib/reuse/index.js.map +1 -1
  19. package/lib/reuse/modules/flp/userLocks.d.ts +3 -3
  20. package/lib/reuse/modules/flp/userLocks.js +5 -5
  21. package/lib/reuse/modules/flp/userLocks.js.map +1 -1
  22. package/lib/reuse/modules/mobile/device.d.ts +160 -4
  23. package/lib/reuse/modules/mobile/device.js +367 -13
  24. package/lib/reuse/modules/mobile/device.js.map +1 -1
  25. package/lib/reuse/modules/mobile/element.d.ts +44 -25
  26. package/lib/reuse/modules/mobile/element.js +80 -26
  27. package/lib/reuse/modules/mobile/element.js.map +1 -1
  28. package/lib/reuse/modules/mobile/userInteraction.d.ts +73 -7
  29. package/lib/reuse/modules/mobile/userInteraction.js +159 -23
  30. package/lib/reuse/modules/mobile/userInteraction.js.map +1 -1
  31. package/lib/reuse/modules/util/Util.d.ts +2 -0
  32. package/lib/reuse/modules/util/Util.js +2 -0
  33. package/lib/reuse/modules/util/Util.js.map +1 -1
  34. package/lib/reuse/modules/util/userSettings.d.ts +27 -0
  35. package/lib/reuse/modules/util/userSettings.js +181 -0
  36. package/lib/reuse/modules/util/userSettings.js.map +1 -0
  37. package/lib/scripts/hooks/onComplete.js.map +1 -1
  38. package/lib/scripts/hooks/onPrepare.js +14 -2
  39. package/lib/scripts/hooks/onPrepare.js.map +1 -1
  40. package/lib/scripts/stats/createUsage.d.ts +1 -0
  41. package/lib/scripts/stats/createUsage.js +0 -1
  42. package/lib/scripts/stats/createUsage.js.map +1 -1
  43. package/lib/scripts/stats/getUserId.js +0 -1
  44. package/lib/scripts/stats/getUserId.js.map +1 -1
  45. package/lib/scripts/stats/stats.d.ts +1 -1
  46. package/lib/scripts/stats/stats.js +4 -3
  47. package/lib/scripts/stats/stats.js.map +1 -1
  48. package/lib/scripts/stats/updateUsage.js +0 -1
  49. package/lib/scripts/stats/updateUsage.js.map +1 -1
  50. package/package.json +1 -1
  51. package/test/reuse/flp/userLocks/data/data.json +3 -3
  52. package/test/reuse/flp/userLocks/deleteExistingLockEntries.spec.js +18 -0
  53. package/test/reuse/flp/userLocks/getNumberOfLockEntries.spec.js +1 -0
  54. package/test/reuse/util/userSettings/data/data.json +6 -0
  55. package/test/reuse/util/userSettings/getDateFormatFromUserSettings.spec.js +21 -0
  56. package/test/reuse/util/userSettings/getLanguageFromUserSettings.spec.js +15 -0
  57. package/test/reuse/util/userSettings/getTimeFormatFromUserSettings.spec.js +17 -0
  58. package/test/reuse/util/userSettings/getTimeZoneFromUserSettings.spec.js +16 -0
  59. package/test/reuse/util/userSettings/setDateFormatFromUserSettings.spec.js +33 -0
  60. package/test/reuse/util/userSettings/setLanguageFromUserSettings.spec.js +16 -0
  61. package/test/reuse/util/userSettings/setNumberFormatFromUserSettings.spec.js +16 -0
  62. package/test/reuse/util/userSettings/setS4UserSettings.spec.js +37 -0
  63. package/test/reuse/util/userSettings/setTimeFormatFromUserSettings.spec.js +17 -0
  64. package/test/reuse/util/userSettings/setTimeZoneFromUserSettings.spec.js +16 -0
  65. package/test/reuse/util/userSettings/test.userSettings.apply.conf.js +16 -0
  66. package/test/reuse/util/userSettings/test.userSettings.conf.js +24 -0
@@ -10,11 +10,11 @@ export declare class ElementModule {
10
10
  * @function isVisible
11
11
  * @memberof mobile.element
12
12
  * @description Returns a boolean if the mobile element is visible to the user.
13
- * @param {Object} element - The Mobile Ui element.
14
- * @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.
13
+ * @param {Element} element - The Mobile Ui element.
14
+ * @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.
15
15
  * If "false", it will be sufficient if the element is visible on the view but not inside the current viewport.
16
- * @returns {Boolean} Returns true or false.
17
- * @example const elem = await mobile.element.isVisible("button01");
16
+ * @returns {boolean} Returns true or false.
17
+ * @example
18
18
  * await mobile.element.isVisible(elem);
19
19
  */
20
20
  isVisible(element: Element, strict?: boolean): Promise<boolean>;
@@ -22,8 +22,8 @@ export declare class ElementModule {
22
22
  * @function isPresent
23
23
  * @memberof mobile.element
24
24
  * @description Returns a boolean if the element is present at the DOM or not. It might be hidden.
25
- * @param {Object} elem - The element.
26
- * @returns {Boolean} Returns true or false.
25
+ * @param {Element} element - The element.
26
+ * @returns {boolean} Returns true or false.
27
27
  * @example
28
28
  * await mobile.element.isPresent(elem);
29
29
  */
@@ -33,44 +33,63 @@ export declare class ElementModule {
33
33
  * @memberof mobile.element
34
34
  * @description Waits until the element with the given selector is present.
35
35
  * @param {Object} selector - The CSS selector describing the element.
36
- * @param {Number} [timeout=30000] - The timeout to wait (ms).
37
- * @example await mobile.element.waitToBePresent(".input01");
38
- * @example await mobile.element.waitToBePresent("#button12");
39
- * @example await mobile.element.waitToBePresent("p:first-child");
36
+ * @param {number} [timeout = 30000] - The timeout to wait (ms).
37
+ * @returns {boolean} Returns true or false.
38
+ * @example
39
+ * await mobile.element.waitToBePresent(".input01");
40
+ * await mobile.element.waitToBePresent("#button12");
41
+ * await mobile.element.waitToBePresent("p:first-child");
40
42
  */
41
- waitToBePresent(selector: any, timeout?: number): Promise<void>;
43
+ waitToBePresent(selector: any, timeout?: number): Promise<boolean>;
42
44
  /**
43
45
  * @function waitToBeVisible
44
46
  * @memberof mobile.element
45
47
  * @description Waits until the element with the given selector is visible.
46
48
  * @param {Object} selector - The CSS selector describing the element.
47
- * @param {Number} [timeout=30000] - The timeout to wait (ms).
48
- * @example await mobile.element.waitToBeVisible(".input01");
49
- * @example await mobile.element.waitToBeVisible("#button12");
50
- * @example await mobile.element.waitToBeVisible("p:first-child");
49
+ * @param {number} [timeout=30000] - The timeout to wait (ms).
50
+ * @returns {boolean} Returns true or false.
51
+ * @example
52
+ * await mobile.element.waitToBeVisible(".input01");
53
+ * await mobile.element.waitToBeVisible("#button12");
54
+ * await mobile.element.waitToBeVisible("p:first-child");
51
55
  */
52
- waitToBeVisible(selector: any, timeout?: number): Promise<void>;
56
+ waitToBeVisible(selector: any, timeout?: number): Promise<boolean>;
53
57
  /**
54
58
  * @function waitToBeClickable
55
59
  * @memberof mobile.element
56
60
  * @description Waits until the element with the given selector is clickable.
57
61
  * @param {Object} selector - The CSS selector describing the element.
58
- * @param {Number} [timeout=30000] - The timeout to wait (ms).
59
- * @example await mobile.element.waitToBeClickable(".input01");
60
- * @example await mobile.element.waitToBeClickable("#button12");
61
- * @example await mobile.element.waitToBeClickable("p:first-child");
62
+ * @param {number} [timeout=30000] - The timeout to wait (ms).
63
+ * @returns {boolean} Returns true or false.
64
+ * @example
65
+ * await mobile.element.waitToBeClickable(".input01");
66
+ * await mobile.element.waitToBeClickable("#button12");
67
+ * await mobile.element.waitToBeClickable("p:first-child");
62
68
  */
63
- waitToBeClickable(selector: any, timeout?: number): Promise<void>;
69
+ waitToBeClickable(selector: any, timeout?: number): Promise<boolean>;
64
70
  /**
65
71
  * @function isSelected
66
72
  * @memberof mobile.element
67
73
  * @description Returns a boolean if the element (e.g. checkbox) is selected.
68
- * @param {Object} elem - The element.
69
- * @returns {boolean}
70
- * @example const elem = await mobile.element.getById("elem01");
74
+ * @param {Element | string} elementOrSelector - The element.
75
+ * @returns {boolean} Returns true or false.
76
+ * @example
71
77
  * const isSelected = await mobile.element.isSelected(elem);
72
78
  */
73
- isSelected(elem: Element): Promise<boolean>;
79
+ isSelected(elementOrSelector: Element | string): Promise<boolean>;
80
+ /**
81
+ * @function waitToBeEnabled
82
+ * @memberof mobile.element
83
+ * @description Waits until the element with the given selector is present.
84
+ * @param {Object} selector - The CSS selector describing the element.
85
+ * @param {number} [timeout=30000] - The timeout to wait (ms).
86
+ * @returns {boolean} Returns true or false.
87
+ * @example
88
+ * await mobile.element.waitToBeEnabled(".input01");
89
+ * await mobile.element.waitToBeEnabled("#button12");
90
+ * await mobile.element.waitToBeEnabled("p:first-child");
91
+ */
92
+ waitToBeEnabled(selector: any, timeout?: number): Promise<boolean>;
74
93
  }
75
94
  declare const _default: ElementModule;
76
95
  export default _default;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ElementModule = void 0;
7
7
  const verboseLogger_1 = require("../../helper/verboseLogger");
8
8
  const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
9
+ const elementResolving_1 = require("../../helper/elementResolving");
9
10
  /**
10
11
  * @class element
11
12
  * @memberof mobile
@@ -19,11 +20,11 @@ class ElementModule {
19
20
  * @function isVisible
20
21
  * @memberof mobile.element
21
22
  * @description Returns a boolean if the mobile element is visible to the user.
22
- * @param {Object} 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.
23
+ * @param {Element} element - The Mobile Ui element.
24
+ * @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
25
  * 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 const elem = await mobile.element.isVisible("button01");
26
+ * @returns {boolean} Returns true or false.
27
+ * @example
27
28
  * await mobile.element.isVisible(elem);
28
29
  */
29
30
  async isVisible(element, strict = true) {
@@ -44,8 +45,8 @@ class ElementModule {
44
45
  * @function isPresent
45
46
  * @memberof mobile.element
46
47
  * @description Returns a boolean if the element is present at the DOM or not. It might be hidden.
47
- * @param {Object} elem - The element.
48
- * @returns {Boolean} Returns true or false.
48
+ * @param {Element} element - The element.
49
+ * @returns {boolean} Returns true or false.
49
50
  * @example
50
51
  * await mobile.element.isPresent(elem);
51
52
  */
@@ -58,19 +59,27 @@ class ElementModule {
58
59
  * @memberof mobile.element
59
60
  * @description Waits until the element with the given selector is present.
60
61
  * @param {Object} selector - The CSS selector describing the element.
61
- * @param {Number} [timeout=30000] - The timeout to wait (ms).
62
- * @example await mobile.element.waitToBePresent(".input01");
63
- * @example await mobile.element.waitToBePresent("#button12");
64
- * @example await mobile.element.waitToBePresent("p:first-child");
62
+ * @param {number} [timeout = 30000] - The timeout to wait (ms).
63
+ * @returns {boolean} Returns true or false.
64
+ * @example
65
+ * await mobile.element.waitToBePresent(".input01");
66
+ * await mobile.element.waitToBePresent("#button12");
67
+ * await mobile.element.waitToBePresent("p:first-child");
65
68
  */
66
69
  async waitToBePresent(selector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
67
70
  const vl = this.vlf.initLog(this.waitToBePresent);
68
71
  try {
69
72
  vl.log(`wdio.waitForExist invocation for selector ${selector}`);
70
- await $(selector).waitForExist({ timeout: timeout });
73
+ await $(selector).waitForExist({
74
+ timeout: timeout,
75
+ interval: 100,
76
+ timeoutMsg: `Timeout '${+timeout / 1000}s' by waiting for element is present.`
77
+ });
78
+ return true;
71
79
  }
72
80
  catch (error) {
73
81
  this.ErrorHandler.logException(error);
82
+ return false;
74
83
  }
75
84
  }
76
85
  /**
@@ -78,19 +87,27 @@ class ElementModule {
78
87
  * @memberof mobile.element
79
88
  * @description Waits until the element with the given selector is visible.
80
89
  * @param {Object} selector - The CSS selector describing the element.
81
- * @param {Number} [timeout=30000] - The timeout to wait (ms).
82
- * @example await mobile.element.waitToBeVisible(".input01");
83
- * @example await mobile.element.waitToBeVisible("#button12");
84
- * @example await mobile.element.waitToBeVisible("p:first-child");
90
+ * @param {number} [timeout=30000] - The timeout to wait (ms).
91
+ * @returns {boolean} Returns true or false.
92
+ * @example
93
+ * await mobile.element.waitToBeVisible(".input01");
94
+ * await mobile.element.waitToBeVisible("#button12");
95
+ * await mobile.element.waitToBeVisible("p:first-child");
85
96
  */
86
97
  async waitToBeVisible(selector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
87
98
  const vl = this.vlf.initLog(this.waitToBeVisible);
88
99
  try {
89
100
  vl.log(`wdio.waitForDisplayed invocation for selector ${selector}`);
90
- await $(selector).waitForDisplayed({ timeout: timeout });
101
+ await $(selector).waitForDisplayed({
102
+ timeout: timeout,
103
+ interval: 100,
104
+ timeoutMsg: `Timeout '${+timeout / 1000}s' by waiting for element is displayed.`
105
+ });
106
+ return true;
91
107
  }
92
108
  catch (error) {
93
109
  this.ErrorHandler.logException(error);
110
+ return false;
94
111
  }
95
112
  }
96
113
  /**
@@ -98,33 +115,70 @@ class ElementModule {
98
115
  * @memberof mobile.element
99
116
  * @description Waits until the element with the given selector is clickable.
100
117
  * @param {Object} selector - The CSS selector describing the element.
101
- * @param {Number} [timeout=30000] - The timeout to wait (ms).
102
- * @example await mobile.element.waitToBeClickable(".input01");
103
- * @example await mobile.element.waitToBeClickable("#button12");
104
- * @example await mobile.element.waitToBeClickable("p:first-child");
118
+ * @param {number} [timeout=30000] - The timeout to wait (ms).
119
+ * @returns {boolean} Returns true or false.
120
+ * @example
121
+ * await mobile.element.waitToBeClickable(".input01");
122
+ * await mobile.element.waitToBeClickable("#button12");
123
+ * await mobile.element.waitToBeClickable("p:first-child");
105
124
  */
106
125
  async waitToBeClickable(selector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
107
126
  const vl = this.vlf.initLog(this.waitToBeClickable);
108
127
  try {
109
128
  vl.log(`wdio.waitForClickable invocation for selector ${selector}`);
110
- await $(selector).waitForClickable({ timeout: timeout });
129
+ await $(selector).waitForClickable({
130
+ timeout: timeout,
131
+ interval: 100,
132
+ timeoutMsg: `Timeout '${+timeout / 1000}s' by waiting for element is clickable.`
133
+ });
134
+ return true;
111
135
  }
112
136
  catch (error) {
113
137
  this.ErrorHandler.logException(error);
138
+ return false;
114
139
  }
115
140
  }
116
141
  /**
117
142
  * @function isSelected
118
143
  * @memberof mobile.element
119
144
  * @description Returns a boolean if the element (e.g. checkbox) is selected.
120
- * @param {Object} elem - The element.
121
- * @returns {boolean}
122
- * @example const elem = await mobile.element.getById("elem01");
145
+ * @param {Element | string} elementOrSelector - The element.
146
+ * @returns {boolean} Returns true or false.
147
+ * @example
123
148
  * const isSelected = await mobile.element.isSelected(elem);
124
149
  */
125
- async isSelected(elem) {
150
+ async isSelected(elementOrSelector) {
126
151
  const vl = this.vlf.initLog(this.isSelected);
127
- return elem.isSelected();
152
+ const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
153
+ return await element.isSelected();
154
+ }
155
+ /**
156
+ * @function waitToBeEnabled
157
+ * @memberof mobile.element
158
+ * @description Waits until the element with the given selector is present.
159
+ * @param {Object} selector - The CSS selector describing the element.
160
+ * @param {number} [timeout=30000] - The timeout to wait (ms).
161
+ * @returns {boolean} Returns true or false.
162
+ * @example
163
+ * await mobile.element.waitToBeEnabled(".input01");
164
+ * await mobile.element.waitToBeEnabled("#button12");
165
+ * await mobile.element.waitToBeEnabled("p:first-child");
166
+ */
167
+ async waitToBeEnabled(selector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
168
+ const vl = this.vlf.initLog(this.waitToBeEnabled);
169
+ try {
170
+ vl.log(`wdio.waitTotoBeEnabled invocation for selector ${selector}`);
171
+ await $(selector).toBeEnabled({
172
+ timeout: timeout,
173
+ interval: 100,
174
+ timeoutMsg: `Timeout '${+timeout / 1000}s' by waiting for element is enabled.`
175
+ });
176
+ return true;
177
+ }
178
+ catch (error) {
179
+ this.ErrorHandler.logException(error);
180
+ return false;
181
+ }
128
182
  }
129
183
  }
130
184
  exports.ElementModule = ElementModule;
@@ -1 +1 @@
1
- {"version":3,"file":"element.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/element.ts"],"names":[],"mappings":";;;;;;AACA,8DAAkE;AAClE,6EAAqD;AAErD;;;GAGG;AACH,MAAa,aAAa;IAA1B;QACU,QAAG,GAAG,IAAI,oCAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QACpD,iBAAY,GAAG,IAAI,sBAAY,EAAE,CAAC;IAiH5C,CAAC;IA/GC;;;;;;;;;;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;;;;;;;;;OASG;IACH,KAAK,CAAC,eAAe,CAAC,QAAa,EAAE,UAAkB,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAqB,CAAC,IAAI,KA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AC;IACpC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,eAAe,CAAC,QAAa,EAAE,UAAkB,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAqB,CAAC,IAAI,KAAK;QAC3G,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAClD,IAAI,CAAC;YACH,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,GAAG;gBACb,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"}
@@ -10,19 +10,85 @@ export declare class UserInteraction {
10
10
  * @function tap
11
11
  * @memberof mobile.userInteraction
12
12
  * @description Tap's on the mobile element.
13
- * @param {Element | string} element - The element or CSS selector describing the element.
14
- * @param {Number} [timeout=30000] - The timeout to wait (ms).
15
- * @example const elem = await mobile.userInteraction.tap(elem);
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);
16
18
  */
17
- tap(element: Element, timeout?: number): Promise<void>;
19
+ tap(elementOrSelector: Element | string, timeout?: number): Promise<void>;
18
20
  /**
19
21
  * @function check
20
22
  * @memberof mobile.userInteraction
21
23
  * @description Checks the given checkbox.
22
- * @param {Element} element - The element or CSS selector describing the element.
23
- * @example await mobile.userInteraction.check(selector);
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);
24
29
  */
25
- check(element: Element): Promise<void>;
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>;
26
92
  }
27
93
  declare const _default: UserInteraction;
28
94
  export default _default;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.UserInteraction = void 0;
7
7
  const verboseLogger_1 = require("../../helper/verboseLogger");
8
8
  const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
9
+ const elementResolving_1 = require("../../helper/elementResolving");
9
10
  /**
10
11
  * @class userInteraction
11
12
  * @memberof mobile
@@ -19,54 +20,189 @@ class UserInteraction {
19
20
  * @function tap
20
21
  * @memberof mobile.userInteraction
21
22
  * @description Tap's on the mobile element.
22
- * @param {Element | string} element - The element or CSS selector describing the element.
23
- * @param {Number} [timeout=30000] - The timeout to wait (ms).
24
- * @example const elem = await mobile.userInteraction.tap(elem);
23
+ * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
24
+ * @param {Number} [timeout = 30000] - The timeout to wait(ms)
25
+ * @example
26
+ * await mobile.userInteraction.tap(elem);
27
+ * await mobile.userInteraction.tap(elem, 20000);
25
28
  */
26
- async tap(element, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
29
+ async tap(elementOrSelector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
27
30
  const vl = this.vlf.initLog(this.tap);
28
31
  try {
29
- vl.log("Expecting element to be displayed and enabled");
30
- await Promise.all([
31
- expect(element).toBeDisplayed({
32
- wait: timeout,
33
- interval: 100,
34
- message: `Timeout '${+timeout / 1000}s' by waiting for element is displayed.`
35
- }),
36
- expect(element).toBeEnabled({
37
- wait: timeout,
38
- interval: 100,
39
- message: `Timeout '${+timeout / 1000}s' by waiting for element is enabled.`
40
- })
41
- ]);
42
- vl.log("Clicking the element");
32
+ const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
33
+ vl.log("Waiting for the element to become enabled and visible within the specified timeout");
34
+ await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
35
+ vl.log("Tapping on the element");
43
36
  await element.click();
44
37
  vl.log("Given element is successfully taped on the mobile Ui");
45
38
  }
46
39
  catch (error) {
47
- this.ErrorHandler.logException(error);
40
+ this.ErrorHandler.logException(error, `Error: element still not tapable after ${timeout} ms`, true);
48
41
  }
49
42
  }
50
43
  /**
51
44
  * @function check
52
45
  * @memberof mobile.userInteraction
53
46
  * @description Checks the given checkbox.
54
- * @param {Element} element - The element or CSS selector describing the element.
55
- * @example await mobile.userInteraction.check(selector);
47
+ * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
48
+ * @param {number} [timeout = 30000] - The timeout to wait(ms)
49
+ * @example
50
+ * await mobile.userInteraction.check(element);
51
+ * await mobile.userInteraction.check(element, 20000);
56
52
  */
57
- async check(element) {
53
+ async check(elementOrSelector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
58
54
  const vl = this.vlf.initLog(this.check);
59
55
  try {
56
+ const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
57
+ vl.log("Waiting for the element to become enabled and visible within the specified timeout");
58
+ await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
60
59
  const isSelected = await mobile.element.isSelected(element);
61
60
  if (!isSelected) {
62
61
  await this.tap(element);
62
+ vl.log("Given element is successfully checked on the mobile Ui");
63
63
  }
64
64
  else {
65
65
  vl.log("Checkbox already selected.");
66
66
  }
67
67
  }
68
68
  catch (error) {
69
- this.ErrorHandler.logException(error);
69
+ this.ErrorHandler.logException(error, `Error: element still not able to check after ${timeout} ms`, true);
70
+ }
71
+ }
72
+ /**
73
+ * @function uncheck
74
+ * @memberOf mobile.userInteraction
75
+ * @description Unchecks the given checkbox.
76
+ * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
77
+ * @param {number} [timeout = 30000] - The timeout to wait(ms)
78
+ * @example
79
+ * await mobile.userInteraction.uncheck(elementOrSelector);
80
+ * await mobile.userInteraction.uncheck(elementOrSelector, 20000);
81
+ */
82
+ async uncheck(elementOrSelector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
83
+ const vl = this.vlf.initLog(this.uncheck);
84
+ try {
85
+ const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
86
+ vl.log("Waiting for the element to become enabled and visible within the specified timeout");
87
+ await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
88
+ const isSelected = await mobile.element.isSelected(element);
89
+ if (isSelected) {
90
+ await this.tap(element);
91
+ vl.log("Given element is successfully uncheck on the mobile Ui");
92
+ }
93
+ else {
94
+ vl.log("Checkbox already unchecked.");
95
+ }
96
+ }
97
+ catch (error) {
98
+ this.ErrorHandler.logException(error, `Error: element still not able to uncheck after ${timeout} ms`, true);
99
+ }
100
+ }
101
+ /**
102
+ * @function doubleTap
103
+ * @memberof mobile.userInteraction
104
+ * @description Double Tap's on the mobile element.
105
+ * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
106
+ * @param {number} [timeout = 30000] - The timeout to wait(ms)
107
+ * @returns {Promise<void>}
108
+ * @example
109
+ * await mobile.userInteraction.doubleTap(elem);
110
+ * await mobile.userInteraction.doubleTap(elem, 2000);
111
+ */
112
+ async doubleTap(elementOrSelector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
113
+ const vl = this.vlf.initLog(this.doubleTap);
114
+ try {
115
+ const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
116
+ vl.log("Waiting for the element to become enabled and visible within the specified timeout");
117
+ await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
118
+ vl.log("Double taping on the element");
119
+ await element.doubleClick();
120
+ vl.log("Given element is successfully double taped on the mobile Ui");
121
+ }
122
+ catch (error) {
123
+ this.ErrorHandler.logException(error, `Error: element still not able to double tap after ${timeout} ms`, true);
124
+ }
125
+ }
126
+ /**
127
+ * @function fill
128
+ * @memberof mobile.userInteraction
129
+ * @description Enter a string value into a mobile input field.
130
+ * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
131
+ * @param {string} value - The string value to be entered.
132
+ * @param {number} [timeout = 30000] - The timeout to wait (ms).
133
+ * @returns {Promise<void>}
134
+ * @example
135
+ * await mobile.userInteraction.fill(element);
136
+ * await mobile.userInteraction.fill(element, 2000);
137
+ */
138
+ async fill(elementOrSelector, value, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
139
+ const vl = this.vlf.initLog(this.fill);
140
+ try {
141
+ const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
142
+ vl.log("Waiting for the element to become enabled and visible within the specified timeout");
143
+ await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
144
+ // Set the value
145
+ vl.log("set text on the element");
146
+ await element.setValue(value);
147
+ vl.log(`Entered value "${value}" into input box by selector "${element}`);
148
+ }
149
+ catch (error) {
150
+ this.ErrorHandler.logException(error, `Error: element still not able to fill the value after ${timeout} ms`, true);
151
+ }
152
+ }
153
+ /**
154
+ * @function clearAndFill
155
+ * @memberof mobile.userInteraction
156
+ * @description Enter a string into the mobile input field; it will clear the box before submission.
157
+ * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
158
+ * @param {string} value - The string value to be entered.
159
+ * @param {number} [timeout = 30000] - The timeout to wait (ms).
160
+ * @returns {Promise<void>}
161
+ * @example
162
+ * await mobile.userInteraction.clearAndFill(element);
163
+ * await mobile.userInteraction.clearAndFill(element, 2000);
164
+ */
165
+ async clearAndFill(elementOrSelector, value, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
166
+ const vl = this.vlf.initLog(this.clearAndFill);
167
+ try {
168
+ const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
169
+ vl.log("Waiting for the element to become enabled and visible within the specified timeout");
170
+ await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
171
+ // Clear the input box.
172
+ await element.clearValue();
173
+ vl.log("Clear the existing text on the given element");
174
+ // Set the value
175
+ vl.log("set value on the input element");
176
+ await element.setValue(value);
177
+ vl.log(`Entered value "${value}" into input box by selector "${element}`);
178
+ }
179
+ catch (error) {
180
+ this.ErrorHandler.logException(error, `Error: element still not able to fill the value after ${timeout} ms`, true);
181
+ }
182
+ }
183
+ /**
184
+ * @function clear
185
+ * @memberof mobile.userInteraction
186
+ * @description Clear a string value into a mobile input field.
187
+ * @param {Element | string} elementOrSelector - The element (e.g., accessibility ID, XPath) selectors describing the element.
188
+ * @param {number} [timeout = 30000] - The timeout to wait (ms).
189
+ * @returns {Promise<void>}
190
+ * @example
191
+ * await mobile.userInteraction.clear(element);
192
+ * await mobile.userInteraction.clear(element, 2000);
193
+ */
194
+ async clear(elementOrSelector, timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
195
+ const vl = this.vlf.initLog(this.clear);
196
+ try {
197
+ const element = await (0, elementResolving_1.resolveMobileSelectorOrElement)(elementOrSelector);
198
+ vl.log("Waiting for the element to become enabled and visible within the specified timeout");
199
+ await Promise.all([mobile.element.waitToBeVisible(element, timeout), mobile.element.waitToBeEnabled(element, timeout)]);
200
+ vl.log("Clearing the existing text on the given element");
201
+ await element.clearValue();
202
+ vl.log("Cleared the existing text on the given element");
203
+ }
204
+ catch (error) {
205
+ this.ErrorHandler.logException(error, `Error: element still not able to clear the value after ${timeout} ms`, true);
70
206
  }
71
207
  }
72
208
  }
@@ -1 +1 @@
1
- {"version":3,"file":"userInteraction.js","sourceRoot":"","sources":["../../../../src/reuse/modules/mobile/userInteraction.ts"],"names":[],"mappings":";;;;;;AACA,8DAAkE;AAClE,6EAAqD;AAErD;;;GAGG;AACH,MAAa,eAAe;IAA5B;QACU,QAAG,GAAG,IAAI,oCAAoB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QAC5D,iBAAY,GAAG,IAAI,sBAAY,EAAE,CAAC;IAwD5C,CAAC;IAtDC;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,CAAC,OAAgB,EAAE,UAAkB,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAqB,CAAC,IAAI,KAAK;QAClG,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEtC,IAAI,CAAC;YACH,EAAE,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;YACxD,MAAM,OAAO,CAAC,GAAG,CAAC;gBAChB,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC;oBAC5B,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