@sap_oss/wdio-qmate-service 1.0.0 → 1.0.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 (144) hide show
  1. package/README.md +2 -1
  2. package/{test/core/package-lock.json → docs/bestPractices/spec.md} +0 -0
  3. package/docs/doc.md +176 -353
  4. package/docs/gettingStarted/setup.md +2 -2
  5. package/docs/index.md +1 -1
  6. package/docs/sections/bestPractices/authentication.md +151 -0
  7. package/docs/sections/bestPractices/dataHandling.md +61 -0
  8. package/docs/sections/bestPractices/selectors.md +44 -0
  9. package/docs/{contact.md → sections/contact.md} +0 -0
  10. package/docs/sections/features/advancedDataHandling.md +252 -0
  11. package/docs/sections/features/config.md +171 -0
  12. package/docs/sections/features/dataHandling.md +83 -0
  13. package/docs/{gettingStarted → sections/features}/selectors.md +0 -0
  14. package/docs/sections/features/spec.md +0 -0
  15. package/docs/sections/gettingStarted/config.md +18 -0
  16. package/docs/sections/gettingStarted/execution.md +7 -0
  17. package/docs/sections/gettingStarted/setup.md +9 -0
  18. package/docs/sections/gettingStarted/spec.md +31 -0
  19. package/docs/sections/gettingStarted/specs.md +19 -0
  20. package/docs/sections/support/bugReporting.md +19 -0
  21. package/docs/sections/support/knownIssuesAndLimitations.md +0 -0
  22. package/docs/sections/support/troubleshooting.md +16 -0
  23. package/docs/sources/images/fiori_form.PNG +0 -0
  24. package/docs/sources/images/sapCloud_form.PNG +0 -0
  25. package/lib/index.js +59 -82
  26. package/lib/index.js.map +1 -1
  27. package/lib/reuse/authenticator/authHandler.js +12 -23
  28. package/lib/reuse/authenticator/authHandler.js.map +1 -1
  29. package/lib/reuse/authenticator/basicUrlAuthenticator.js +21 -32
  30. package/lib/reuse/authenticator/basicUrlAuthenticator.js.map +1 -1
  31. package/lib/reuse/authenticator/customAuthenticator.js +42 -55
  32. package/lib/reuse/authenticator/customAuthenticator.js.map +1 -1
  33. package/lib/reuse/authenticator/formAuthenticator.js +37 -50
  34. package/lib/reuse/authenticator/formAuthenticator.js.map +1 -1
  35. package/lib/reuse/authenticator/plainAuthenticator.js +5 -16
  36. package/lib/reuse/authenticator/plainAuthenticator.js.map +1 -1
  37. package/lib/reuse/helper/jsDocGen.js +4 -12
  38. package/lib/reuse/helper/jsDocGen.js.map +1 -1
  39. package/lib/reuse/index.js +20 -5
  40. package/lib/reuse/index.js.map +1 -1
  41. package/lib/reuse/modules/common/navigation.js +10 -23
  42. package/lib/reuse/modules/common/navigation.js.map +1 -1
  43. package/lib/reuse/modules/common/userInteraction.js +40 -73
  44. package/lib/reuse/modules/common/userInteraction.js.map +1 -1
  45. package/lib/reuse/modules/nonUi5/assertion.js +31 -52
  46. package/lib/reuse/modules/nonUi5/assertion.js.map +1 -1
  47. package/lib/reuse/modules/nonUi5/element.js +266 -331
  48. package/lib/reuse/modules/nonUi5/element.js.map +1 -1
  49. package/lib/reuse/modules/nonUi5/navigation.js +10 -21
  50. package/lib/reuse/modules/nonUi5/navigation.js.map +1 -1
  51. package/lib/reuse/modules/nonUi5/userInteraction.js +176 -215
  52. package/lib/reuse/modules/nonUi5/userInteraction.js.map +1 -1
  53. package/lib/reuse/modules/service/odata.d.ts +106 -94
  54. package/lib/reuse/modules/service/odata.js +209 -204
  55. package/lib/reuse/modules/service/odata.js.map +1 -1
  56. package/lib/reuse/modules/service/rest.js +64 -81
  57. package/lib/reuse/modules/service/rest.js.map +1 -1
  58. package/lib/reuse/modules/ui5/assertion.js +217 -268
  59. package/lib/reuse/modules/ui5/assertion.js.map +1 -1
  60. package/lib/reuse/modules/ui5/confirmationDialog.js +17 -42
  61. package/lib/reuse/modules/ui5/confirmationDialog.js.map +1 -1
  62. package/lib/reuse/modules/ui5/control.js +12 -33
  63. package/lib/reuse/modules/ui5/control.js.map +1 -1
  64. package/lib/reuse/modules/ui5/date.js +70 -89
  65. package/lib/reuse/modules/ui5/date.js.map +1 -1
  66. package/lib/reuse/modules/ui5/element.js +121 -156
  67. package/lib/reuse/modules/ui5/element.js.map +1 -1
  68. package/lib/reuse/modules/ui5/errorDialog.js +4 -17
  69. package/lib/reuse/modules/ui5/errorDialog.js.map +1 -1
  70. package/lib/reuse/modules/ui5/footerBar.js +28 -63
  71. package/lib/reuse/modules/ui5/footerBar.js.map +1 -1
  72. package/lib/reuse/modules/ui5/mockserver.js +390 -427
  73. package/lib/reuse/modules/ui5/mockserver.js.map +1 -1
  74. package/lib/reuse/modules/ui5/navigation.js +105 -132
  75. package/lib/reuse/modules/ui5/navigation.js.map +1 -1
  76. package/lib/reuse/modules/ui5/navigationBar.js +58 -77
  77. package/lib/reuse/modules/ui5/navigationBar.js.map +1 -1
  78. package/lib/reuse/modules/ui5/qunit.js +16 -27
  79. package/lib/reuse/modules/ui5/qunit.js.map +1 -1
  80. package/lib/reuse/modules/ui5/session.js +200 -236
  81. package/lib/reuse/modules/ui5/session.js.map +1 -1
  82. package/lib/reuse/modules/ui5/table.js +79 -98
  83. package/lib/reuse/modules/ui5/table.js.map +1 -1
  84. package/lib/reuse/modules/ui5/userInteraction.js +264 -335
  85. package/lib/reuse/modules/ui5/userInteraction.js.map +1 -1
  86. package/lib/reuse/modules/util/browser.js +131 -178
  87. package/lib/reuse/modules/util/browser.js.map +1 -1
  88. package/lib/reuse/modules/util/data.js +3 -2
  89. package/lib/reuse/modules/util/data.js.map +1 -1
  90. package/lib/reuse/modules/util/file.js +71 -90
  91. package/lib/reuse/modules/util/file.js.map +1 -1
  92. package/lib/reuse/modules/util/function.js +68 -87
  93. package/lib/reuse/modules/util/function.js.map +1 -1
  94. package/lib/reuse/modules/util/system.js +22 -33
  95. package/lib/reuse/modules/util/system.js.map +1 -1
  96. package/lib/scripts/dataExchange/dataExchange.js +145 -160
  97. package/lib/scripts/dataExchange/dataExchange.js.map +1 -1
  98. package/lib/scripts/dataExchange/dataExchangeUtil.js +93 -114
  99. package/lib/scripts/dataExchange/dataExchangeUtil.js.map +1 -1
  100. package/lib/scripts/hooks/after.js +3 -14
  101. package/lib/scripts/hooks/after.js.map +1 -1
  102. package/lib/scripts/hooks/before.js +9 -20
  103. package/lib/scripts/hooks/before.js.map +1 -1
  104. package/lib/scripts/hooks/beforeSession.js +7 -18
  105. package/lib/scripts/hooks/beforeSession.js.map +1 -1
  106. package/lib/scripts/hooks/onComplete.js +2 -13
  107. package/lib/scripts/hooks/onComplete.js.map +1 -1
  108. package/lib/scripts/hooks/onPrepare.js +9 -20
  109. package/lib/scripts/hooks/onPrepare.js.map +1 -1
  110. package/lib/scripts/hooks/utils/addLocatorCommands.js +109 -172
  111. package/lib/scripts/hooks/utils/addLocatorCommands.js.map +1 -1
  112. package/lib/scripts/hooks/utils/browserLog.js +18 -31
  113. package/lib/scripts/hooks/utils/browserLog.js.map +1 -1
  114. package/lib/scripts/hooks/utils/dataExchangeCommands.js +13 -24
  115. package/lib/scripts/hooks/utils/dataExchangeCommands.js.map +1 -1
  116. package/lib/scripts/hooks/utils/decryption.d.ts +1 -1
  117. package/lib/scripts/hooks/utils/decryption.js +33 -14
  118. package/lib/scripts/hooks/utils/decryption.js.map +1 -1
  119. package/lib/scripts/hooks/utils/lib.js +249 -272
  120. package/lib/scripts/hooks/utils/lib.js.map +1 -1
  121. package/lib/scripts/hooks/utils/locatorCommands.js +154 -183
  122. package/lib/scripts/hooks/utils/locatorCommands.js.map +1 -1
  123. package/mkdocs.yml +16 -3
  124. package/package.json +14 -11
  125. package/test/authenticator/staticLogin/specs/custom.spec.js +30 -1
  126. package/test/reuse/nonUi5/element/getById.spec.js +17 -0
  127. package/test/reuse/service/odata/get.spec.js +61 -0
  128. package/test/reuse/service/odata/getEntitySet.spec.js +87 -0
  129. package/test/reuse/service/odata/test.odata.conf.js +15 -0
  130. package/test/reuse/ui5/confirmationDialog/clickButton.spec.js +87 -0
  131. package/test/reuse/ui5/confirmationDialog/test.confirmationDialog.conf.js +2 -1
  132. package/test/reuse/ui5/element/test.element.conf.js +2 -1
  133. package/test/reuse/ui5/element/waitForAll.spec.js +46 -0
  134. package/test/reuse/ui5/userInteraction/clearAndFillSmartFieldInputAndRetry.spec.js +28 -0
  135. package/test/reuse/ui5/userInteraction/test.userInteraction.conf.js +1 -0
  136. package/test/reuse/util/browser/switchToNewWindow.spec.js +2 -2
  137. package/test/reuse/util/console/console.spec.js +27 -0
  138. package/test/reuse/util/console/test.console.conf.js +12 -0
  139. package/test/reuse/util/data/data/test.secure.json +7 -3
  140. package/test/reuse/util/data/getSecureData.spec.js +9 -3
  141. package/test/reuse/util/file/pdfParser.spec.js +33 -8
  142. package/test/reuse/util/system/system.spec.js +16 -0
  143. package/test/reuse/util/system/test.system.conf.js +12 -0
  144. package/tsconfig.json +1 -1
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.Assertion = void 0;
13
4
  /**
@@ -28,43 +19,41 @@ class Assertion {
28
19
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
29
20
  * @example await ui5.assertion.expectAttributeToBe(selector, "text", "Hello");
30
21
  */
31
- expectAttributeToBe(selector, attribute, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- let elem, value;
34
- compareValue = String(compareValue);
35
- this._throwAttributeError(attribute, "expectAttributeToBe");
36
- try {
37
- elem = yield ui5.element.getDisplayed(selector, index, timeout);
38
- }
39
- catch (error) {
40
- throw new Error(`Function 'expectAttributeToBe' failed:${error}`);
41
- }
42
- let ui5PropertyValue, innerUI5PropertyValue;
43
- try {
44
- yield browser.waitUntil(() => __awaiter(this, void 0, void 0, function* () {
45
- ui5PropertyValue = String(yield this._getUI5Property(elem, attribute));
46
- innerUI5PropertyValue = String(yield this._getInnerUI5Property(elem, attribute));
47
- if (ui5PropertyValue === compareValue) {
48
- value = ui5PropertyValue;
49
- return true;
50
- }
51
- else if (innerUI5PropertyValue === compareValue) {
52
- value = innerUI5PropertyValue;
53
- return true;
54
- }
55
- else {
56
- return false;
57
- }
58
- }), {
59
- timeout: 2000 + +loadPropertyTimeout,
60
- interval: 100,
61
- });
62
- }
63
- catch (error) {
64
- value = ui5PropertyValue ? ui5PropertyValue : innerUI5PropertyValue;
65
- }
66
- return expect(String(value)).toEqual(String(compareValue));
67
- });
22
+ async expectAttributeToBe(selector, attribute, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
23
+ let elem, value;
24
+ compareValue = String(compareValue);
25
+ this._throwAttributeError(attribute, "expectAttributeToBe");
26
+ try {
27
+ elem = await ui5.element.getDisplayed(selector, index, timeout);
28
+ }
29
+ catch (error) {
30
+ throw new Error(`Function 'expectAttributeToBe' failed:${error}`);
31
+ }
32
+ let ui5PropertyValue, innerUI5PropertyValue;
33
+ try {
34
+ await browser.waitUntil(async () => {
35
+ ui5PropertyValue = String(await this._getUI5Property(elem, attribute));
36
+ innerUI5PropertyValue = String(await this._getInnerUI5Property(elem, attribute));
37
+ if (ui5PropertyValue === compareValue) {
38
+ value = ui5PropertyValue;
39
+ return true;
40
+ }
41
+ else if (innerUI5PropertyValue === compareValue) {
42
+ value = innerUI5PropertyValue;
43
+ return true;
44
+ }
45
+ else {
46
+ return false;
47
+ }
48
+ }, {
49
+ timeout: 2000 + +loadPropertyTimeout,
50
+ interval: 100,
51
+ });
52
+ }
53
+ catch (error) {
54
+ value = ui5PropertyValue ? ui5PropertyValue : innerUI5PropertyValue;
55
+ }
56
+ return expect(String(value)).toEqual(String(compareValue));
68
57
  }
69
58
  ;
70
59
  /**
@@ -79,43 +68,41 @@ class Assertion {
79
68
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
80
69
  * @example await ui5.assertion.expectAttributeToContain(selector, "text", "abc");
81
70
  */
82
- expectAttributeToContain(selector, attribute, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
83
- return __awaiter(this, void 0, void 0, function* () {
84
- let elem, value;
85
- compareValue = String(compareValue);
86
- this._throwAttributeError(attribute, "expectAttributeToContain");
87
- try {
88
- elem = yield ui5.element.getDisplayed(selector, index, timeout);
89
- }
90
- catch (error) {
91
- throw new Error(`Function 'expectAttributeToContain' failed:${error}`);
92
- }
93
- let ui5PropertyValue, innerUI5PropertyValue;
94
- try {
95
- yield browser.waitUntil(() => __awaiter(this, void 0, void 0, function* () {
96
- ui5PropertyValue = String(yield this._getUI5Property(elem, attribute));
97
- innerUI5PropertyValue = String(yield this._getInnerUI5Property(elem, attribute));
98
- if (ui5PropertyValue.includes(compareValue)) {
99
- value = ui5PropertyValue;
100
- return true;
101
- }
102
- else if (innerUI5PropertyValue.includes(compareValue)) {
103
- value = innerUI5PropertyValue;
104
- return true;
105
- }
106
- else {
107
- return false;
108
- }
109
- }), {
110
- timeout: 2000 + +loadPropertyTimeout,
111
- interval: 100
112
- });
113
- }
114
- catch (error) {
115
- value = ui5PropertyValue ? ui5PropertyValue : innerUI5PropertyValue;
116
- }
117
- return expect(value).toContain(compareValue);
118
- });
71
+ async expectAttributeToContain(selector, attribute, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
72
+ let elem, value;
73
+ compareValue = String(compareValue);
74
+ this._throwAttributeError(attribute, "expectAttributeToContain");
75
+ try {
76
+ elem = await ui5.element.getDisplayed(selector, index, timeout);
77
+ }
78
+ catch (error) {
79
+ throw new Error(`Function 'expectAttributeToContain' failed:${error}`);
80
+ }
81
+ let ui5PropertyValue, innerUI5PropertyValue;
82
+ try {
83
+ await browser.waitUntil(async () => {
84
+ ui5PropertyValue = String(await this._getUI5Property(elem, attribute));
85
+ innerUI5PropertyValue = String(await this._getInnerUI5Property(elem, attribute));
86
+ if (ui5PropertyValue.includes(compareValue)) {
87
+ value = ui5PropertyValue;
88
+ return true;
89
+ }
90
+ else if (innerUI5PropertyValue.includes(compareValue)) {
91
+ value = innerUI5PropertyValue;
92
+ return true;
93
+ }
94
+ else {
95
+ return false;
96
+ }
97
+ }, {
98
+ timeout: 2000 + +loadPropertyTimeout,
99
+ interval: 100
100
+ });
101
+ }
102
+ catch (error) {
103
+ value = ui5PropertyValue ? ui5PropertyValue : innerUI5PropertyValue;
104
+ }
105
+ return expect(value).toContain(compareValue);
119
106
  }
120
107
  ;
121
108
  /**
@@ -129,10 +116,8 @@ class Assertion {
129
116
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
130
117
  * @example await ui5.assertion.expectTextToBe(selector, "Hello");
131
118
  */
132
- expectTextToBe(selector, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
133
- return __awaiter(this, void 0, void 0, function* () {
134
- return this.expectAttributeToBe(selector, "text", compareValue, index, timeout, loadPropertyTimeout);
135
- });
119
+ async expectTextToBe(selector, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
120
+ return this.expectAttributeToBe(selector, "text", compareValue, index, timeout, loadPropertyTimeout);
136
121
  }
137
122
  ;
138
123
  /**
@@ -146,10 +131,8 @@ class Assertion {
146
131
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
147
132
  * @example await ui5.assertion.expectValueToBe(selector, "123");
148
133
  */
149
- expectValueToBe(selector, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
150
- return __awaiter(this, void 0, void 0, function* () {
151
- return this.expectAttributeToBe(selector, "value", compareValue, index, timeout, loadPropertyTimeout);
152
- });
134
+ async expectValueToBe(selector, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
135
+ return this.expectAttributeToBe(selector, "value", compareValue, index, timeout, loadPropertyTimeout);
153
136
  }
154
137
  ;
155
138
  /**
@@ -161,12 +144,10 @@ class Assertion {
161
144
  * @param {Number} [timeout=30000] - The timeout to wait (ms).
162
145
  * @example await ui5.assertion.expectValueToBeDefined(selector);
163
146
  */
164
- expectValueToBeDefined(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
165
- return __awaiter(this, void 0, void 0, function* () {
166
- const value = yield ui5.element.getValue(selector, index, timeout);
167
- common.assertion.expectDefined(value);
168
- common.assertion.expectUnequal(value, "");
169
- });
147
+ async expectValueToBeDefined(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
148
+ const value = await ui5.element.getValue(selector, index, timeout);
149
+ common.assertion.expectDefined(value);
150
+ common.assertion.expectUnequal(value, "");
170
151
  }
171
152
  ;
172
153
  /**
@@ -179,10 +160,8 @@ class Assertion {
179
160
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
180
161
  * @example await ui5.assertion.expectToBeNotEnabled(selector);
181
162
  */
182
- expectToBeNotEnabled(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
183
- return __awaiter(this, void 0, void 0, function* () {
184
- yield this.expectAttributeToBe(selector, "enabled", false, index, timeout, loadPropertyTimeout);
185
- });
163
+ async expectToBeNotEnabled(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
164
+ await this.expectAttributeToBe(selector, "enabled", false, index, timeout, loadPropertyTimeout);
186
165
  }
187
166
  ;
188
167
  /**
@@ -195,10 +174,8 @@ class Assertion {
195
174
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
196
175
  * @example await ui5.assertion.expectToBeEnabled(selector);
197
176
  */
198
- expectToBeEnabled(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
199
- return __awaiter(this, void 0, void 0, function* () {
200
- yield this.expectAttributeToBe(selector, "enabled", true, index, timeout, loadPropertyTimeout);
201
- });
177
+ async expectToBeEnabled(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
178
+ await this.expectAttributeToBe(selector, "enabled", true, index, timeout, loadPropertyTimeout);
202
179
  }
203
180
  ;
204
181
  /**
@@ -211,10 +188,8 @@ class Assertion {
211
188
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
212
189
  * @example await ui5.assertion.expectValidationError(selector);
213
190
  */
214
- expectValidationError(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
215
- return __awaiter(this, void 0, void 0, function* () {
216
- return this.expectAttributeToBe(selector, "valueState", "Error", index, timeout, loadPropertyTimeout);
217
- });
191
+ async expectValidationError(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
192
+ return this.expectAttributeToBe(selector, "valueState", "Error", index, timeout, loadPropertyTimeout);
218
193
  }
219
194
  ;
220
195
  /**
@@ -227,10 +202,8 @@ class Assertion {
227
202
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
228
203
  * @example await ui5.assertion.expectValidationSuccess(selector);
229
204
  */
230
- expectValidationSuccess(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
231
- return __awaiter(this, void 0, void 0, function* () {
232
- return this.expectAttributeToBe(selector, "valueState", "None", index, timeout, loadPropertyTimeout);
233
- });
205
+ async expectValidationSuccess(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
206
+ return this.expectAttributeToBe(selector, "valueState", "None", index, timeout, loadPropertyTimeout);
234
207
  }
235
208
  ;
236
209
  // =================================== BINDINGS ===================================
@@ -246,49 +219,45 @@ class Assertion {
246
219
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
247
220
  * @example await ui5.assertion.expectBindingPathToBe(selector, "text", "Hello");
248
221
  */
249
- expectBindingPathToBe(selector, attribute, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
250
- return __awaiter(this, void 0, void 0, function* () {
251
- let elem;
252
- try {
253
- elem = yield ui5.element.getDisplayed(selector, index, timeout);
254
- }
255
- catch (error) {
256
- throw new Error(`Function 'expectBindingPathToBe' failed:${error}`);
257
- }
258
- let values = null;
259
- if (loadPropertyTimeout > 0) {
260
- yield browser.waitUntil(function () {
261
- return __awaiter(this, void 0, void 0, function* () {
262
- values = yield elem.getBindingProperty(attribute);
263
- return values !== null;
264
- });
265
- }, {
266
- timeout: 2000 + +loadPropertyTimeout,
267
- timeoutMsg: "Property could not be loaded, timeout was reached."
268
- });
269
- }
270
- else {
271
- values = yield elem.getBindingProperty(attribute);
222
+ async expectBindingPathToBe(selector, attribute, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
223
+ let elem;
224
+ try {
225
+ elem = await ui5.element.getDisplayed(selector, index, timeout);
226
+ }
227
+ catch (error) {
228
+ throw new Error(`Function 'expectBindingPathToBe' failed:${error}`);
229
+ }
230
+ let values = null;
231
+ if (loadPropertyTimeout > 0) {
232
+ await browser.waitUntil(async function () {
233
+ values = await elem.getBindingProperty(attribute);
234
+ return values !== null;
235
+ }, {
236
+ timeout: 2000 + +loadPropertyTimeout,
237
+ timeoutMsg: "Property could not be loaded, timeout was reached."
238
+ });
239
+ }
240
+ else {
241
+ values = await elem.getBindingProperty(attribute);
242
+ }
243
+ // Note: looks like we should construct values[x|0].model + '>' + values[x|0].path
244
+ if (Array.isArray(compareValue)) {
245
+ const mergedArrayOfValues = values.map((value) => mergeModelAndPath(value));
246
+ for (let x = 0; x < compareValue.length; x++) {
247
+ expect(mergedArrayOfValues).toContain(compareValue[x]);
272
248
  }
273
- // Note: looks like we should construct values[x|0].model + '>' + values[x|0].path
274
- if (Array.isArray(compareValue)) {
275
- const mergedArrayOfValues = values.map((value) => mergeModelAndPath(value));
276
- for (let x = 0; x < compareValue.length; x++) {
277
- expect(mergedArrayOfValues).toContain(compareValue[x]);
278
- }
249
+ }
250
+ else {
251
+ expect(mergeModelAndPath(values[0])).toContain(compareValue);
252
+ }
253
+ function mergeModelAndPath(value) {
254
+ if (value.model && value.model.length) {
255
+ return `${value.model}>${value.path}`;
279
256
  }
280
257
  else {
281
- expect(mergeModelAndPath(values[0])).toContain(compareValue);
282
- }
283
- function mergeModelAndPath(value) {
284
- if (value.model && value.model.length) {
285
- return `${value.model}>${value.path}`;
286
- }
287
- else {
288
- return value.path;
289
- }
258
+ return value.path;
290
259
  }
291
- });
260
+ }
292
261
  }
293
262
  ;
294
263
  /**
@@ -303,32 +272,28 @@ class Assertion {
303
272
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
304
273
  * @example await ui5.assertion.expectBindingContextPathToBe(selector, "text", "Hello");
305
274
  */
306
- expectBindingContextPathToBe(selector, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
307
- return __awaiter(this, void 0, void 0, function* () {
308
- let elem;
309
- try {
310
- elem = yield ui5.element.getDisplayed(selector, index, timeout);
311
- }
312
- catch (error) {
313
- throw new Error(`Function 'expectBindingContextPathToBe' failed:${error}`);
314
- }
315
- let value = null;
316
- if (loadPropertyTimeout > 0) {
317
- yield browser.waitUntil(function () {
318
- return __awaiter(this, void 0, void 0, function* () {
319
- value = yield elem.getBindingContextPath();
320
- return value;
321
- });
322
- }, {
323
- timeout: 2000 + +loadPropertyTimeout,
324
- timeoutMsg: "Property could not loaded, timeout was reached."
325
- });
326
- }
327
- else {
328
- value = yield elem.getBindingContextPath();
329
- }
330
- expect(value).toEqual(compareValue);
331
- });
275
+ async expectBindingContextPathToBe(selector, compareValue, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
276
+ let elem;
277
+ try {
278
+ elem = await ui5.element.getDisplayed(selector, index, timeout);
279
+ }
280
+ catch (error) {
281
+ throw new Error(`Function 'expectBindingContextPathToBe' failed:${error}`);
282
+ }
283
+ let value = null;
284
+ if (loadPropertyTimeout > 0) {
285
+ await browser.waitUntil(async function () {
286
+ value = await elem.getBindingContextPath();
287
+ return value;
288
+ }, {
289
+ timeout: 2000 + +loadPropertyTimeout,
290
+ timeoutMsg: "Property could not loaded, timeout was reached."
291
+ });
292
+ }
293
+ else {
294
+ value = await elem.getBindingContextPath();
295
+ }
296
+ expect(value).toEqual(compareValue);
332
297
  }
333
298
  ;
334
299
  // =================================== VISIBILITY ===================================
@@ -342,41 +307,37 @@ class Assertion {
342
307
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
343
308
  * @example await ui5.assertion.expectToBeVisible(selector);
344
309
  */
345
- expectToBeVisible(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
346
- return __awaiter(this, void 0, void 0, function* () {
347
- let elem;
348
- try {
349
- elem = yield ui5.element.getDisplayed(selector, index, timeout);
350
- }
351
- catch (error) {
352
- throw new Error(`Function 'expectToBeVisible' failed:${error}`);
353
- }
354
- let value = null;
355
- if (loadPropertyTimeout > 0) {
356
- yield expect(elem).toBeDisplayed({
357
- wait: loadPropertyTimeout,
358
- interval: 100,
359
- message: "Timeout by waiting for element to be visible."
360
- });
361
- return browser.waitUntil(function () {
362
- return __awaiter(this, void 0, void 0, function* () {
363
- const isUi5Visible = yield elem.getUI5Property("visible");
364
- const isDomVisible = yield elem.isDisplayed();
365
- return isUi5Visible !== null && isUi5Visible !== undefined ||
366
- isDomVisible !== null && isDomVisible !== undefined;
367
- });
368
- }, {
369
- timeout: 2000 + +loadPropertyTimeout,
370
- timeoutMsg: "Property could not be loaded, timeout was reached."
371
- });
372
- }
373
- else {
374
- const isUi5Visible = yield elem.getUI5Property("visible");
375
- const isDomVisible = yield elem.isDisplayed();
376
- value = isUi5Visible || isDomVisible;
377
- common.assertion.expectTrue(value);
378
- }
379
- });
310
+ async expectToBeVisible(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
311
+ let elem;
312
+ try {
313
+ elem = await ui5.element.getDisplayed(selector, index, timeout);
314
+ }
315
+ catch (error) {
316
+ throw new Error(`Function 'expectToBeVisible' failed:${error}`);
317
+ }
318
+ let value = null;
319
+ if (loadPropertyTimeout > 0) {
320
+ await expect(elem).toBeDisplayed({
321
+ wait: loadPropertyTimeout,
322
+ interval: 100,
323
+ message: "Timeout by waiting for element to be visible."
324
+ });
325
+ return browser.waitUntil(async function () {
326
+ const isUi5Visible = await elem.getUI5Property("visible");
327
+ const isDomVisible = await elem.isDisplayed();
328
+ return isUi5Visible !== null && isUi5Visible !== undefined ||
329
+ isDomVisible !== null && isDomVisible !== undefined;
330
+ }, {
331
+ timeout: 2000 + +loadPropertyTimeout,
332
+ timeoutMsg: "Property could not be loaded, timeout was reached."
333
+ });
334
+ }
335
+ else {
336
+ const isUi5Visible = await elem.getUI5Property("visible");
337
+ const isDomVisible = await elem.isDisplayed();
338
+ value = isUi5Visible || isDomVisible;
339
+ common.assertion.expectTrue(value);
340
+ }
380
341
  }
381
342
  ;
382
343
  /**
@@ -389,27 +350,23 @@ class Assertion {
389
350
  * @param {Number} [loadPropertyTimeout = 10000] - The timeout to wait for a specific property to have the given compare value.
390
351
  * @example await ui5.assertion.expectToBeVisibleInViewport(selector);
391
352
  */
392
- expectToBeVisibleInViewport(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
393
- return __awaiter(this, void 0, void 0, function* () {
394
- let elem;
395
- try {
396
- elem = yield ui5.element.getDisplayed(selector, index, timeout);
397
- }
398
- catch (error) {
399
- throw new Error(`Function 'expectToBeVisibleInViewport' failed:${error}`);
400
- }
401
- let value = null;
402
- yield browser.waitUntil(function () {
403
- return __awaiter(this, void 0, void 0, function* () {
404
- value = yield elem.isDisplayedInViewport();
405
- return value;
406
- });
407
- }, {
408
- timeout: timeout,
409
- timeoutMsg: `Function 'expectToBeVisibleInViewport' failed: Given Selector was not in the Viewport.`
410
- });
411
- common.assertion.expectTrue(value);
353
+ async expectToBeVisibleInViewport(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
354
+ let elem;
355
+ try {
356
+ elem = await ui5.element.getDisplayed(selector, index, timeout);
357
+ }
358
+ catch (error) {
359
+ throw new Error(`Function 'expectToBeVisibleInViewport' failed:${error}`);
360
+ }
361
+ let value = null;
362
+ await browser.waitUntil(async function () {
363
+ value = await elem.isDisplayedInViewport();
364
+ return value;
365
+ }, {
366
+ timeout: timeout,
367
+ timeoutMsg: `Function 'expectToBeVisibleInViewport' failed: Given Selector was not in the Viewport.`
412
368
  });
369
+ common.assertion.expectTrue(value);
413
370
  }
414
371
  ;
415
372
  /**
@@ -421,16 +378,14 @@ class Assertion {
421
378
  * @param {Number} [timeout=30000] - The timeout to wait (ms). Recommendation is to lower the timeout since the element is not expected to show up.
422
379
  * @example await ui5.assertion.expectToBeNotVisible(selector, 0, 5000);
423
380
  */
424
- expectToBeNotVisible(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
425
- return __awaiter(this, void 0, void 0, function* () {
426
- try {
427
- const isVisible = yield ui5.element.isVisible(selector, index, timeout);
428
- return common.assertion.expectFalse(isVisible);
429
- }
430
- catch (error) {
431
- throw new Error(`Function 'expectToBeNotVisible' failed. Element with selector ${selector} is visible.`);
432
- }
433
- });
381
+ async expectToBeNotVisible(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
382
+ try {
383
+ const isVisible = await ui5.element.isVisible(selector, index, timeout);
384
+ return common.assertion.expectFalse(isVisible);
385
+ }
386
+ catch (error) {
387
+ throw new Error(`Function 'expectToBeNotVisible' failed. Element with selector ${selector} is visible.`);
388
+ }
434
389
  }
435
390
  ;
436
391
  // =================================== APPLICATION ===================================
@@ -442,35 +397,29 @@ class Assertion {
442
397
  * @param {Number} [timeout=30000] - The timeout to wait (ms).
443
398
  * @example await ui5.assertion.expectMessageToastTextToBe(text);
444
399
  */
445
- expectMessageToastTextToBe(text, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
446
- return __awaiter(this, void 0, void 0, function* () {
447
- if (!text) {
448
- throw new Error("Function 'expectMessageToast' failed. Please provide the expected text as argument.");
449
- }
450
- const xpath = "//div[contains(@class, 'sapMMessageToast') and contains(string(), '" + text + "')]";
451
- const elem = yield nonUi5.element.getByXPath(xpath, 0, timeout);
452
- return nonUi5.assertion.expectToBeVisible(elem);
453
- });
400
+ async expectMessageToastTextToBe(text, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
401
+ if (!text) {
402
+ throw new Error("Function 'expectMessageToast' failed. Please provide the expected text as argument.");
403
+ }
404
+ const xpath = "//div[contains(@class, 'sapMMessageToast') and contains(string(), '" + text + "')]";
405
+ const elem = await nonUi5.element.getByXPath(xpath, 0, timeout);
406
+ return nonUi5.assertion.expectToBeVisible(elem);
454
407
  }
455
408
  ;
456
409
  // =================================== HELPER ===================================
457
- _getUI5Property(elem, attribute) {
458
- return __awaiter(this, void 0, void 0, function* () {
459
- let value = yield elem.getUI5Property(attribute);
460
- if (typeof value === "string") {
461
- value = this._trimText(value);
462
- }
463
- return value;
464
- });
410
+ async _getUI5Property(elem, attribute) {
411
+ let value = await elem.getUI5Property(attribute);
412
+ if (typeof value === "string") {
413
+ value = this._trimText(value);
414
+ }
415
+ return value;
465
416
  }
466
- _getInnerUI5Property(elem, attribute) {
467
- return __awaiter(this, void 0, void 0, function* () {
468
- let innerValue = yield ui5.element.getInnerAttribute(elem, "data-" + attribute);
469
- if (typeof innerValue === "string") {
470
- innerValue = this._trimText(innerValue);
471
- }
472
- return innerValue;
473
- });
417
+ async _getInnerUI5Property(elem, attribute) {
418
+ let innerValue = await ui5.element.getInnerAttribute(elem, "data-" + attribute);
419
+ if (typeof innerValue === "string") {
420
+ innerValue = this._trimText(innerValue);
421
+ }
422
+ return innerValue;
474
423
  }
475
424
  _trimText(text) {
476
425
  try {