@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.
- package/README.md +2 -1
- package/{test/core/package-lock.json → docs/bestPractices/spec.md} +0 -0
- package/docs/doc.md +176 -353
- package/docs/gettingStarted/setup.md +2 -2
- package/docs/index.md +1 -1
- package/docs/sections/bestPractices/authentication.md +151 -0
- package/docs/sections/bestPractices/dataHandling.md +61 -0
- package/docs/sections/bestPractices/selectors.md +44 -0
- package/docs/{contact.md → sections/contact.md} +0 -0
- package/docs/sections/features/advancedDataHandling.md +252 -0
- package/docs/sections/features/config.md +171 -0
- package/docs/sections/features/dataHandling.md +83 -0
- package/docs/{gettingStarted → sections/features}/selectors.md +0 -0
- package/docs/sections/features/spec.md +0 -0
- package/docs/sections/gettingStarted/config.md +18 -0
- package/docs/sections/gettingStarted/execution.md +7 -0
- package/docs/sections/gettingStarted/setup.md +9 -0
- package/docs/sections/gettingStarted/spec.md +31 -0
- package/docs/sections/gettingStarted/specs.md +19 -0
- package/docs/sections/support/bugReporting.md +19 -0
- package/docs/sections/support/knownIssuesAndLimitations.md +0 -0
- package/docs/sections/support/troubleshooting.md +16 -0
- package/docs/sources/images/fiori_form.PNG +0 -0
- package/docs/sources/images/sapCloud_form.PNG +0 -0
- package/lib/index.js +59 -82
- package/lib/index.js.map +1 -1
- package/lib/reuse/authenticator/authHandler.js +12 -23
- package/lib/reuse/authenticator/authHandler.js.map +1 -1
- package/lib/reuse/authenticator/basicUrlAuthenticator.js +21 -32
- package/lib/reuse/authenticator/basicUrlAuthenticator.js.map +1 -1
- package/lib/reuse/authenticator/customAuthenticator.js +42 -55
- package/lib/reuse/authenticator/customAuthenticator.js.map +1 -1
- package/lib/reuse/authenticator/formAuthenticator.js +37 -50
- package/lib/reuse/authenticator/formAuthenticator.js.map +1 -1
- package/lib/reuse/authenticator/plainAuthenticator.js +5 -16
- package/lib/reuse/authenticator/plainAuthenticator.js.map +1 -1
- package/lib/reuse/helper/jsDocGen.js +4 -12
- package/lib/reuse/helper/jsDocGen.js.map +1 -1
- package/lib/reuse/index.js +20 -5
- package/lib/reuse/index.js.map +1 -1
- package/lib/reuse/modules/common/navigation.js +10 -23
- package/lib/reuse/modules/common/navigation.js.map +1 -1
- package/lib/reuse/modules/common/userInteraction.js +40 -73
- package/lib/reuse/modules/common/userInteraction.js.map +1 -1
- package/lib/reuse/modules/nonUi5/assertion.js +31 -52
- package/lib/reuse/modules/nonUi5/assertion.js.map +1 -1
- package/lib/reuse/modules/nonUi5/element.js +266 -331
- package/lib/reuse/modules/nonUi5/element.js.map +1 -1
- package/lib/reuse/modules/nonUi5/navigation.js +10 -21
- package/lib/reuse/modules/nonUi5/navigation.js.map +1 -1
- package/lib/reuse/modules/nonUi5/userInteraction.js +176 -215
- package/lib/reuse/modules/nonUi5/userInteraction.js.map +1 -1
- package/lib/reuse/modules/service/odata.d.ts +106 -94
- package/lib/reuse/modules/service/odata.js +209 -204
- package/lib/reuse/modules/service/odata.js.map +1 -1
- package/lib/reuse/modules/service/rest.js +64 -81
- package/lib/reuse/modules/service/rest.js.map +1 -1
- package/lib/reuse/modules/ui5/assertion.js +217 -268
- package/lib/reuse/modules/ui5/assertion.js.map +1 -1
- package/lib/reuse/modules/ui5/confirmationDialog.js +17 -42
- package/lib/reuse/modules/ui5/confirmationDialog.js.map +1 -1
- package/lib/reuse/modules/ui5/control.js +12 -33
- package/lib/reuse/modules/ui5/control.js.map +1 -1
- package/lib/reuse/modules/ui5/date.js +70 -89
- package/lib/reuse/modules/ui5/date.js.map +1 -1
- package/lib/reuse/modules/ui5/element.js +121 -156
- package/lib/reuse/modules/ui5/element.js.map +1 -1
- package/lib/reuse/modules/ui5/errorDialog.js +4 -17
- package/lib/reuse/modules/ui5/errorDialog.js.map +1 -1
- package/lib/reuse/modules/ui5/footerBar.js +28 -63
- package/lib/reuse/modules/ui5/footerBar.js.map +1 -1
- package/lib/reuse/modules/ui5/mockserver.js +390 -427
- package/lib/reuse/modules/ui5/mockserver.js.map +1 -1
- package/lib/reuse/modules/ui5/navigation.js +105 -132
- package/lib/reuse/modules/ui5/navigation.js.map +1 -1
- package/lib/reuse/modules/ui5/navigationBar.js +58 -77
- package/lib/reuse/modules/ui5/navigationBar.js.map +1 -1
- package/lib/reuse/modules/ui5/qunit.js +16 -27
- package/lib/reuse/modules/ui5/qunit.js.map +1 -1
- package/lib/reuse/modules/ui5/session.js +200 -236
- package/lib/reuse/modules/ui5/session.js.map +1 -1
- package/lib/reuse/modules/ui5/table.js +79 -98
- package/lib/reuse/modules/ui5/table.js.map +1 -1
- package/lib/reuse/modules/ui5/userInteraction.js +264 -335
- package/lib/reuse/modules/ui5/userInteraction.js.map +1 -1
- package/lib/reuse/modules/util/browser.js +131 -178
- package/lib/reuse/modules/util/browser.js.map +1 -1
- package/lib/reuse/modules/util/data.js +3 -2
- package/lib/reuse/modules/util/data.js.map +1 -1
- package/lib/reuse/modules/util/file.js +71 -90
- package/lib/reuse/modules/util/file.js.map +1 -1
- package/lib/reuse/modules/util/function.js +68 -87
- package/lib/reuse/modules/util/function.js.map +1 -1
- package/lib/reuse/modules/util/system.js +22 -33
- package/lib/reuse/modules/util/system.js.map +1 -1
- package/lib/scripts/dataExchange/dataExchange.js +145 -160
- package/lib/scripts/dataExchange/dataExchange.js.map +1 -1
- package/lib/scripts/dataExchange/dataExchangeUtil.js +93 -114
- package/lib/scripts/dataExchange/dataExchangeUtil.js.map +1 -1
- package/lib/scripts/hooks/after.js +3 -14
- package/lib/scripts/hooks/after.js.map +1 -1
- package/lib/scripts/hooks/before.js +9 -20
- package/lib/scripts/hooks/before.js.map +1 -1
- package/lib/scripts/hooks/beforeSession.js +7 -18
- package/lib/scripts/hooks/beforeSession.js.map +1 -1
- package/lib/scripts/hooks/onComplete.js +2 -13
- package/lib/scripts/hooks/onComplete.js.map +1 -1
- package/lib/scripts/hooks/onPrepare.js +9 -20
- package/lib/scripts/hooks/onPrepare.js.map +1 -1
- package/lib/scripts/hooks/utils/addLocatorCommands.js +109 -172
- package/lib/scripts/hooks/utils/addLocatorCommands.js.map +1 -1
- package/lib/scripts/hooks/utils/browserLog.js +18 -31
- package/lib/scripts/hooks/utils/browserLog.js.map +1 -1
- package/lib/scripts/hooks/utils/dataExchangeCommands.js +13 -24
- package/lib/scripts/hooks/utils/dataExchangeCommands.js.map +1 -1
- package/lib/scripts/hooks/utils/decryption.d.ts +1 -1
- package/lib/scripts/hooks/utils/decryption.js +33 -14
- package/lib/scripts/hooks/utils/decryption.js.map +1 -1
- package/lib/scripts/hooks/utils/lib.js +249 -272
- package/lib/scripts/hooks/utils/lib.js.map +1 -1
- package/lib/scripts/hooks/utils/locatorCommands.js +154 -183
- package/lib/scripts/hooks/utils/locatorCommands.js.map +1 -1
- package/mkdocs.yml +16 -3
- package/package.json +14 -11
- package/test/authenticator/staticLogin/specs/custom.spec.js +30 -1
- package/test/reuse/nonUi5/element/getById.spec.js +17 -0
- package/test/reuse/service/odata/get.spec.js +61 -0
- package/test/reuse/service/odata/getEntitySet.spec.js +87 -0
- package/test/reuse/service/odata/test.odata.conf.js +15 -0
- package/test/reuse/ui5/confirmationDialog/clickButton.spec.js +87 -0
- package/test/reuse/ui5/confirmationDialog/test.confirmationDialog.conf.js +2 -1
- package/test/reuse/ui5/element/test.element.conf.js +2 -1
- package/test/reuse/ui5/element/waitForAll.spec.js +46 -0
- package/test/reuse/ui5/userInteraction/clearAndFillSmartFieldInputAndRetry.spec.js +28 -0
- package/test/reuse/ui5/userInteraction/test.userInteraction.conf.js +1 -0
- package/test/reuse/util/browser/switchToNewWindow.spec.js +2 -2
- package/test/reuse/util/console/console.spec.js +27 -0
- package/test/reuse/util/console/test.console.conf.js +12 -0
- package/test/reuse/util/data/data/test.secure.json +7 -3
- package/test/reuse/util/data/getSecureData.spec.js +9 -3
- package/test/reuse/util/file/pdfParser.spec.js +33 -8
- package/test/reuse/util/system/system.spec.js +16 -0
- package/test/reuse/util/system/test.system.conf.js +12 -0
- 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.UserInteraction = void 0;
|
|
13
4
|
/**
|
|
@@ -25,33 +16,29 @@ class UserInteraction {
|
|
|
25
16
|
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
26
17
|
* @example await ui5.userInteraction.click(selector);
|
|
27
18
|
*/
|
|
28
|
-
click(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
catch (error) {
|
|
19
|
+
async click(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
20
|
+
let elem = null;
|
|
21
|
+
await browser.waitUntil(async function () {
|
|
22
|
+
elem = await ui5.element.getDisplayed(selector, index, timeout);
|
|
23
|
+
if (!elem)
|
|
24
|
+
return false;
|
|
25
|
+
return elem.isClickable();
|
|
26
|
+
}, {
|
|
27
|
+
timeout,
|
|
28
|
+
timeoutMsg: `Element not clickable after ${+timeout / 1000}s`
|
|
29
|
+
});
|
|
30
|
+
try {
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
await elem.click();
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
if (error.message && error.message.match(new RegExp(/is not clickable at point/))) {
|
|
47
37
|
// @ts-ignore
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const errorMessage = yield util.function.mapWdioErrorToQmateErrorMessage(error, "click");
|
|
51
|
-
throw new Error(errorMessage);
|
|
52
|
-
}
|
|
38
|
+
const errorMessage = await util.function.mapWdioErrorToQmateErrorMessage(error, "click");
|
|
39
|
+
throw new Error(errorMessage);
|
|
53
40
|
}
|
|
54
|
-
}
|
|
41
|
+
}
|
|
55
42
|
}
|
|
56
43
|
;
|
|
57
44
|
/**
|
|
@@ -65,10 +52,8 @@ class UserInteraction {
|
|
|
65
52
|
* @param {Number} [interval=5000] - The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals.
|
|
66
53
|
* @example await ui5.userInteraction.clickAndRetry(selector);
|
|
67
54
|
*/
|
|
68
|
-
clickAndRetry(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, retries = 3, interval = 5000) {
|
|
69
|
-
|
|
70
|
-
yield util.function.retry(this.click, [selector, index, timeout], retries, interval, this);
|
|
71
|
-
});
|
|
55
|
+
async clickAndRetry(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, retries = 3, interval = 5000) {
|
|
56
|
+
await util.function.retry(this.click, [selector, index, timeout], retries, interval, this);
|
|
72
57
|
}
|
|
73
58
|
;
|
|
74
59
|
/**
|
|
@@ -81,19 +66,15 @@ class UserInteraction {
|
|
|
81
66
|
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
82
67
|
* @example await ui5.userInteraction.clickTab(selector);
|
|
83
68
|
*/
|
|
84
|
-
clickTab(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}, [selector, index, timeout], 3, 5000, this);
|
|
96
|
-
});
|
|
69
|
+
async clickTab(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
70
|
+
await util.function.retry(async function (selector, index, timeout) {
|
|
71
|
+
await ui5.userInteraction.click(selector);
|
|
72
|
+
const tab = await ui5.element.getDisplayed(selector, index, timeout);
|
|
73
|
+
const classList = await tab.getAttribute("class");
|
|
74
|
+
if (!classList.includes("sapUxAPAnchorBarButtonSelected")) {
|
|
75
|
+
throw new Error();
|
|
76
|
+
}
|
|
77
|
+
}, [selector, index, timeout], 3, 5000, this);
|
|
97
78
|
}
|
|
98
79
|
;
|
|
99
80
|
/**
|
|
@@ -107,16 +88,14 @@ class UserInteraction {
|
|
|
107
88
|
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
108
89
|
* @example await ui5.userInteraction.clickListItem(selector);
|
|
109
90
|
*/
|
|
110
|
-
clickListItem(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}, elem);
|
|
119
|
-
});
|
|
91
|
+
async clickListItem(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
92
|
+
const elem = await ui5.element.getDisplayed(selector, index, timeout);
|
|
93
|
+
await ui5.control.execute(function (control, done) {
|
|
94
|
+
control.attachPress(function () {
|
|
95
|
+
done();
|
|
96
|
+
});
|
|
97
|
+
control.firePress();
|
|
98
|
+
}, elem);
|
|
120
99
|
}
|
|
121
100
|
;
|
|
122
101
|
// =================================== FILL ===================================
|
|
@@ -130,20 +109,18 @@ class UserInteraction {
|
|
|
130
109
|
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
131
110
|
* @example await ui5.userInteraction.fill(selector, "My Value");
|
|
132
111
|
*/
|
|
133
|
-
fill(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
elem = yield nonUi5.element.getByCss("[id='" + id + "'] textarea", index, timeout);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
elem = yield nonUi5.element.getByCss("[id='" + id + "'] input", index, timeout);
|
|
143
|
-
}
|
|
144
|
-
yield elem.setValue(value);
|
|
112
|
+
async fill(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
113
|
+
if (value !== null) {
|
|
114
|
+
const id = await ui5.element.getId(selector, index, timeout);
|
|
115
|
+
let elem = null;
|
|
116
|
+
if (selector.elementProperties.metadata === "sap.m.TextArea") {
|
|
117
|
+
elem = await nonUi5.element.getByCss("[id='" + id + "'] textarea", index, timeout);
|
|
145
118
|
}
|
|
146
|
-
|
|
119
|
+
else {
|
|
120
|
+
elem = await nonUi5.element.getByCss("[id='" + id + "'] input", index, timeout);
|
|
121
|
+
}
|
|
122
|
+
await elem.setValue(value);
|
|
123
|
+
}
|
|
147
124
|
}
|
|
148
125
|
;
|
|
149
126
|
/**
|
|
@@ -158,10 +135,8 @@ class UserInteraction {
|
|
|
158
135
|
* @param {Number} [interval=5000] - The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals.
|
|
159
136
|
* @example await ui5.userInteraction.fillAndRetry(selector, "My Value");
|
|
160
137
|
*/
|
|
161
|
-
fillAndRetry(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, retries = 3, interval = 5000) {
|
|
162
|
-
|
|
163
|
-
yield util.function.retry(this.fill, [selector, value, index, timeout], retries, interval, this);
|
|
164
|
-
});
|
|
138
|
+
async fillAndRetry(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, retries = 3, interval = 5000) {
|
|
139
|
+
await util.function.retry(this.fill, [selector, value, index, timeout], retries, interval, this);
|
|
165
140
|
}
|
|
166
141
|
;
|
|
167
142
|
// =================================== CLEAR ===================================
|
|
@@ -175,10 +150,8 @@ class UserInteraction {
|
|
|
175
150
|
* @example await ui5.userInteraction.clear(selector);
|
|
176
151
|
*/
|
|
177
152
|
//TODO remove clearHelper and use clear
|
|
178
|
-
clear(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
179
|
-
|
|
180
|
-
yield this._clearHelper(selector, index, timeout);
|
|
181
|
-
});
|
|
153
|
+
async clear(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
154
|
+
await this._clearHelper(selector, index, timeout);
|
|
182
155
|
}
|
|
183
156
|
;
|
|
184
157
|
/**
|
|
@@ -192,10 +165,8 @@ class UserInteraction {
|
|
|
192
165
|
* @param {Number} [interval=5000] - The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals.
|
|
193
166
|
* @example await ui5.userInteraction.clearAndRetry(selector);
|
|
194
167
|
*/
|
|
195
|
-
clearAndRetry(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, retries = 3, interval = 5000) {
|
|
196
|
-
|
|
197
|
-
yield util.function.retry(this.clear, [selector, index, timeout], retries, interval, this);
|
|
198
|
-
});
|
|
168
|
+
async clearAndRetry(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, retries = 3, interval = 5000) {
|
|
169
|
+
await util.function.retry(this.clear, [selector, index, timeout], retries, interval, this);
|
|
199
170
|
}
|
|
200
171
|
;
|
|
201
172
|
/**
|
|
@@ -208,16 +179,14 @@ class UserInteraction {
|
|
|
208
179
|
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
209
180
|
* @example await ui5.userInteraction.clearAndFill(selector, "My Value");
|
|
210
181
|
*/
|
|
211
|
-
clearAndFill(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
});
|
|
182
|
+
async clearAndFill(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
183
|
+
if (value !== null) {
|
|
184
|
+
await this.clear(selector, index, timeout);
|
|
185
|
+
await common.userInteraction.fillActive(value);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
throw new Error("Function 'clearAndFill' failed. Please provide a value as second parameter.");
|
|
189
|
+
}
|
|
221
190
|
}
|
|
222
191
|
;
|
|
223
192
|
/**
|
|
@@ -233,22 +202,20 @@ class UserInteraction {
|
|
|
233
202
|
* @param {Boolean} [verify=true] - Specifies if the filled value should be verified.
|
|
234
203
|
* @example await ui5.userInteraction.clearAndFillAndRetry(selector, "My Value");
|
|
235
204
|
*/
|
|
236
|
-
clearAndFillAndRetry(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, retries = 3, interval = 5000, verify = true) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
205
|
+
async clearAndFillAndRetry(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, retries = 3, interval = 5000, verify = true) {
|
|
206
|
+
await util.function.retry(async (selector, value, index, timeout) => {
|
|
207
|
+
await this.clearAndFill(selector, value, index, timeout);
|
|
208
|
+
if (verify) {
|
|
209
|
+
const elem = await ui5.element.getDisplayed(selector);
|
|
210
|
+
let elemValue = await ui5.element.getValue(selector, index);
|
|
211
|
+
if (elemValue != value) { // IMPORTANT: keep non-strict comparison for format changes after input (10 -> 10.00)
|
|
212
|
+
elemValue = await ui5.element.getInnerAttribute(elem, "data-" + "value");
|
|
243
213
|
if (elemValue != value) { // IMPORTANT: keep non-strict comparison for format changes after input (10 -> 10.00)
|
|
244
|
-
elemValue
|
|
245
|
-
if (elemValue != value) { // IMPORTANT: keep non-strict comparison for format changes after input (10 -> 10.00)
|
|
246
|
-
throw new Error(`Actual value '${elemValue}' not equal to expected value '${value}'`);
|
|
247
|
-
}
|
|
214
|
+
throw new Error(`Actual value '${elemValue}' not equal to expected value '${value}'`);
|
|
248
215
|
}
|
|
249
216
|
}
|
|
250
|
-
}
|
|
251
|
-
});
|
|
217
|
+
}
|
|
218
|
+
}, [selector, value, index, timeout], retries, interval, this);
|
|
252
219
|
}
|
|
253
220
|
;
|
|
254
221
|
/**
|
|
@@ -260,10 +227,8 @@ class UserInteraction {
|
|
|
260
227
|
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
261
228
|
* @example await ui5.userInteraction.clearSmartFieldInput(selector);
|
|
262
229
|
*/
|
|
263
|
-
clearSmartFieldInput(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
264
|
-
|
|
265
|
-
yield ui5.userInteraction.clear(selector, index, timeout);
|
|
266
|
-
});
|
|
230
|
+
async clearSmartFieldInput(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
231
|
+
await ui5.userInteraction.clear(selector, index, timeout);
|
|
267
232
|
}
|
|
268
233
|
;
|
|
269
234
|
/**
|
|
@@ -276,14 +241,12 @@ class UserInteraction {
|
|
|
276
241
|
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
277
242
|
* @example await ui5.userInteraction.clearAndFillSmartFieldInput(selector, "My Value");
|
|
278
243
|
*/
|
|
279
|
-
clearAndFillSmartFieldInput(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
yield elem.setValue(value);
|
|
286
|
-
});
|
|
244
|
+
async clearAndFillSmartFieldInput(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
245
|
+
const id = await ui5.element.getId(selector, index, timeout);
|
|
246
|
+
const elem = await nonUi5.element.getByCss(`input[id*='${id}']`);
|
|
247
|
+
await elem.click();
|
|
248
|
+
await ui5.userInteraction.selectAll(selector, index, timeout);
|
|
249
|
+
await elem.setValue(value);
|
|
287
250
|
}
|
|
288
251
|
;
|
|
289
252
|
/**
|
|
@@ -298,10 +261,8 @@ class UserInteraction {
|
|
|
298
261
|
* @param {Number} [interval=5000] - The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals.
|
|
299
262
|
* @example await ui5.userInteraction.clearAndFillSmartFieldInputAndRetry(selector, "My Value");
|
|
300
263
|
*/
|
|
301
|
-
clearAndFillSmartFieldInputAndRetry(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, retries = 3, interval = 5000) {
|
|
302
|
-
|
|
303
|
-
yield util.function.retry(this.clearAndFillSmartFieldInput, [selector, value, index, timeout], retries, interval, this);
|
|
304
|
-
});
|
|
264
|
+
async clearAndFillSmartFieldInputAndRetry(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, retries = 3, interval = 5000) {
|
|
265
|
+
await util.function.retry(this.clearAndFillSmartFieldInput, [selector, value, index, timeout], retries, interval, this);
|
|
305
266
|
}
|
|
306
267
|
;
|
|
307
268
|
// =================================== SELECT ===================================
|
|
@@ -316,25 +277,23 @@ class UserInteraction {
|
|
|
316
277
|
* @param {Number} [index=0] - The index of the selector (in case there are more than one elements visible at the same time).
|
|
317
278
|
* @example await ui5.userInteraction.selectBox(selector, "Germany");
|
|
318
279
|
*/
|
|
319
|
-
selectBox(selector, value, index = 0) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
"
|
|
325
|
-
"
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
});
|
|
280
|
+
async selectBox(selector, value, index = 0) {
|
|
281
|
+
await this.clickSelectArrow(selector, index);
|
|
282
|
+
if (value) {
|
|
283
|
+
const itemSelector = {
|
|
284
|
+
"elementProperties": {
|
|
285
|
+
"mProperties": {
|
|
286
|
+
"text": value
|
|
287
|
+
},
|
|
288
|
+
"ancestorProperties": selector.elementProperties
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
await this.scrollToElement(itemSelector);
|
|
292
|
+
await this.click(itemSelector);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
throw new Error("Function 'selectBox' failed: Please provide a value as second argument.");
|
|
296
|
+
}
|
|
338
297
|
}
|
|
339
298
|
;
|
|
340
299
|
/**
|
|
@@ -348,25 +307,23 @@ class UserInteraction {
|
|
|
348
307
|
* @param {Number} [index=0] - The index of the selector (in case there are more than one elements visible at the same time).
|
|
349
308
|
* @example await ui5.userInteraction.selectComboBox(selector, "Germany");
|
|
350
309
|
*/
|
|
351
|
-
selectComboBox(selector, value, index = 0) {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
"
|
|
357
|
-
|
|
358
|
-
"
|
|
359
|
-
"title": value
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
"parentProperties": {
|
|
363
|
-
"metadata": "sap.m.List"
|
|
310
|
+
async selectComboBox(selector, value, index = 0) {
|
|
311
|
+
await this.clickSelectArrow(selector, index);
|
|
312
|
+
if (value) {
|
|
313
|
+
const selector = {
|
|
314
|
+
"elementProperties": {
|
|
315
|
+
"metadata": "sap.m.StandardListItem",
|
|
316
|
+
"mProperties": {
|
|
317
|
+
"title": value
|
|
364
318
|
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
319
|
+
},
|
|
320
|
+
"parentProperties": {
|
|
321
|
+
"metadata": "sap.m.List"
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
await this.scrollToElement(selector);
|
|
325
|
+
await this.click(selector);
|
|
326
|
+
}
|
|
370
327
|
}
|
|
371
328
|
;
|
|
372
329
|
/**
|
|
@@ -380,27 +337,25 @@ class UserInteraction {
|
|
|
380
337
|
* @param {Number} [index=0] - The index of the selector (in case there are more than one elements visible at the same time).
|
|
381
338
|
* @example await ui5.userInteraction.selectMultiComboBox(selector, ["Option 1", "Option 2"]);
|
|
382
339
|
*/
|
|
383
|
-
selectMultiComboBox(selector, values, index = 0) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
"
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
"
|
|
393
|
-
|
|
394
|
-
"
|
|
395
|
-
"title": values[v]
|
|
396
|
-
}
|
|
340
|
+
async selectMultiComboBox(selector, values, index = 0) {
|
|
341
|
+
await this.clickSelectArrow(selector, index);
|
|
342
|
+
for (const v in values) {
|
|
343
|
+
const ui5ControlProperties = {
|
|
344
|
+
"elementProperties": {
|
|
345
|
+
"metadata": "sap.m.CheckBox",
|
|
346
|
+
"mProperties": {}
|
|
347
|
+
},
|
|
348
|
+
"parentProperties": {
|
|
349
|
+
"metadata": "sap.m.StandardListItem",
|
|
350
|
+
"mProperties": {
|
|
351
|
+
"title": values[v]
|
|
397
352
|
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
await this.scrollToElement(ui5ControlProperties);
|
|
356
|
+
await this.click(ui5ControlProperties);
|
|
357
|
+
}
|
|
358
|
+
await common.userInteraction.pressEnter();
|
|
404
359
|
}
|
|
405
360
|
;
|
|
406
361
|
/**
|
|
@@ -411,12 +366,10 @@ class UserInteraction {
|
|
|
411
366
|
* @param {Number} [index=0] - The index of the selector (in case there are more than one elements visible at the same time).
|
|
412
367
|
* @example await ui5.userInteraction.clickSelectArrow(selector);
|
|
413
368
|
*/
|
|
414
|
-
clickSelectArrow(selector, index = 0) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
yield arrow.click();
|
|
419
|
-
});
|
|
369
|
+
async clickSelectArrow(selector, index = 0) {
|
|
370
|
+
const id = await ui5.element.getId(selector, index);
|
|
371
|
+
const arrow = await nonUi5.element.getByCss("[id='" + id + "-arrow']", 0, 3000);
|
|
372
|
+
await arrow.click();
|
|
420
373
|
}
|
|
421
374
|
;
|
|
422
375
|
/**
|
|
@@ -429,10 +382,8 @@ class UserInteraction {
|
|
|
429
382
|
* @param {Number} [interval=5000] - The delay between the retries (ms). Can be set in config for all functions under params.stepRetriesIntervals.
|
|
430
383
|
* @example await ui5.userInteraction.clickSelectArrowAndRetry(selector);
|
|
431
384
|
*/
|
|
432
|
-
clickSelectArrowAndRetry(selector, index = 0, retries = 3, interval = 5000) {
|
|
433
|
-
|
|
434
|
-
yield util.function.retry(this.clickSelectArrow, [selector, index], retries, interval, this);
|
|
435
|
-
});
|
|
385
|
+
async clickSelectArrowAndRetry(selector, index = 0, retries = 3, interval = 5000) {
|
|
386
|
+
await util.function.retry(this.clickSelectArrow, [selector, index], retries, interval, this);
|
|
436
387
|
}
|
|
437
388
|
;
|
|
438
389
|
// =================================== OTHERS ===================================
|
|
@@ -445,17 +396,15 @@ class UserInteraction {
|
|
|
445
396
|
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
446
397
|
* @example await ui5.userInteraction.mouseOverElement(selector);
|
|
447
398
|
*/
|
|
448
|
-
mouseOverElement(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
yield elem.moveTo();
|
|
458
|
-
});
|
|
399
|
+
async mouseOverElement(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
400
|
+
let elem;
|
|
401
|
+
try {
|
|
402
|
+
elem = await ui5.element.getDisplayed(selector, index, timeout);
|
|
403
|
+
}
|
|
404
|
+
catch (error) {
|
|
405
|
+
throw new Error(`Function: 'mouseOverElement' failed: No element found for selector ${selector}`);
|
|
406
|
+
}
|
|
407
|
+
await elem.moveTo();
|
|
459
408
|
}
|
|
460
409
|
;
|
|
461
410
|
/**
|
|
@@ -470,17 +419,15 @@ class UserInteraction {
|
|
|
470
419
|
* @example await ui5.userInteraction.scrollToElement(selector);
|
|
471
420
|
* @example await ui5.userInteraction.scrollToElement(selector, 0, "start", 5000);
|
|
472
421
|
*/
|
|
473
|
-
scrollToElement(selector, index = 0, alignment = "center", timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
}
|
|
483
|
-
});
|
|
422
|
+
async scrollToElement(selector, index = 0, alignment = "center", timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
423
|
+
const elem = await ui5.element.getDisplayed(selector, index, timeout);
|
|
424
|
+
if (elem) {
|
|
425
|
+
const options = {
|
|
426
|
+
"block": alignment,
|
|
427
|
+
"inline": alignment
|
|
428
|
+
};
|
|
429
|
+
await elem.scrollIntoView(options);
|
|
430
|
+
}
|
|
484
431
|
}
|
|
485
432
|
;
|
|
486
433
|
/**
|
|
@@ -492,16 +439,14 @@ class UserInteraction {
|
|
|
492
439
|
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
493
440
|
* @example await ui5.userInteraction.selectAll(selector);
|
|
494
441
|
*/
|
|
495
|
-
selectAll(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
yield common.userInteraction.pressKey(["\uE051", "a"]);
|
|
504
|
-
});
|
|
442
|
+
async selectAll(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
443
|
+
if (selector !== undefined) {
|
|
444
|
+
await this.click(selector, index, timeout);
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
util.console.info("Selector properties are undefined. Action will be performed on current element.");
|
|
448
|
+
}
|
|
449
|
+
await common.userInteraction.pressKey(["\uE051", "a"]);
|
|
505
450
|
}
|
|
506
451
|
;
|
|
507
452
|
/**
|
|
@@ -515,18 +460,16 @@ class UserInteraction {
|
|
|
515
460
|
* The default value is true (triggered by pressing the F4-key). Set "useF4Key" to false, to trigger the search by clicking the button.
|
|
516
461
|
* @example await ui5.userInteraction.openF4Help(selector, 0, 30000, false);
|
|
517
462
|
*/
|
|
518
|
-
openF4Help(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, useF4Key = true) {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
});
|
|
463
|
+
async openF4Help(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, useF4Key = true) {
|
|
464
|
+
await ui5.userInteraction.click(selector, index, timeout);
|
|
465
|
+
if (useF4Key === true) {
|
|
466
|
+
await common.userInteraction.pressF4();
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
const id = await ui5.element.getId(selector);
|
|
470
|
+
const button = await nonUi5.element.getByCss("[id='" + id + "-vhi']", 0, timeout);
|
|
471
|
+
await button.click();
|
|
472
|
+
}
|
|
530
473
|
}
|
|
531
474
|
;
|
|
532
475
|
/**
|
|
@@ -541,18 +484,16 @@ class UserInteraction {
|
|
|
541
484
|
* The default value is true (triggered by pressing the Enter-key). Set "useEnter" to false, to trigger the search by clicking the search button.
|
|
542
485
|
* @example await ui5.userInteraction.searchFor(selector, "My Value", 0, 30000, false);
|
|
543
486
|
*/
|
|
544
|
-
searchFor(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, useEnter = true) {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}
|
|
555
|
-
});
|
|
487
|
+
async searchFor(selector, value, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000, useEnter = true) {
|
|
488
|
+
await ui5.userInteraction.clearAndFillAndRetry(selector, value, index, timeout);
|
|
489
|
+
if (useEnter === true) {
|
|
490
|
+
await common.userInteraction.pressEnter();
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
const id = await ui5.element.getId(selector, index, timeout);
|
|
494
|
+
const searchButton = await nonUi5.element.getByCss("[id='" + id + "-search']", 0, timeout);
|
|
495
|
+
await searchButton.click();
|
|
496
|
+
}
|
|
556
497
|
}
|
|
557
498
|
;
|
|
558
499
|
/**
|
|
@@ -564,51 +505,47 @@ class UserInteraction {
|
|
|
564
505
|
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
565
506
|
* @example await ui5.userInteraction.resetSearch(selector);
|
|
566
507
|
*/
|
|
567
|
-
resetSearch(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
yield resetButton.click();
|
|
572
|
-
});
|
|
508
|
+
async resetSearch(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
509
|
+
const id = await ui5.element.getId(selector, index, timeout);
|
|
510
|
+
const resetButton = await nonUi5.element.getByCss("[id='" + id + "-reset']", 0, timeout);
|
|
511
|
+
await resetButton.click();
|
|
573
512
|
}
|
|
574
513
|
;
|
|
575
514
|
// =================================== HELPER ===================================
|
|
576
515
|
//TODO: rework function in its whole. Why don't we use the clear function from native wdio here?
|
|
577
|
-
_clearHelper(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
516
|
+
async _clearHelper(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
517
|
+
let id, elem;
|
|
518
|
+
if (selector) {
|
|
519
|
+
await ui5.userInteraction.click(selector, index, timeout);
|
|
520
|
+
id = await ui5.element.getId(selector, index, timeout);
|
|
521
|
+
elem = await browser.getActiveElement();
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
elem = await browser.getActiveElement();
|
|
525
|
+
await elem.click();
|
|
526
|
+
// @ts-ignore
|
|
527
|
+
id = await util.function.getAttribute(elem, "id");
|
|
528
|
+
}
|
|
529
|
+
const tokenizers = await browser.execute(function (id) {
|
|
530
|
+
// @ts-ignore
|
|
531
|
+
const t = document.getElementById(id).querySelectorAll(".sapMTokenizer");
|
|
532
|
+
// @ts-ignore
|
|
533
|
+
const inputs = document.getElementById(id).getElementsByTagName("input");
|
|
534
|
+
// @ts-ignore
|
|
535
|
+
const textareas = document.getElementById(id).getElementsByTagName("textarea");
|
|
536
|
+
if (inputs.length) {
|
|
537
|
+
inputs[0].value = "";
|
|
538
|
+
inputs[0].focus();
|
|
584
539
|
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
yield elem.click();
|
|
588
|
-
// @ts-ignore
|
|
589
|
-
id = yield util.function.getAttribute(elem, "id");
|
|
540
|
+
if (textareas.length) {
|
|
541
|
+
textareas[0].value = "";
|
|
590
542
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
const textareas = document.getElementById(id).getElementsByTagName("textarea");
|
|
598
|
-
if (inputs.length) {
|
|
599
|
-
inputs[0].value = "";
|
|
600
|
-
inputs[0].focus();
|
|
601
|
-
}
|
|
602
|
-
if (textareas.length) {
|
|
603
|
-
textareas[0].value = "";
|
|
604
|
-
}
|
|
605
|
-
return t;
|
|
606
|
-
}, id);
|
|
607
|
-
if ((yield tokenizers) && (yield tokenizers.length)) {
|
|
608
|
-
yield ui5.userInteraction.selectAll(selector, index, timeout);
|
|
609
|
-
yield common.userInteraction.pressBackspace();
|
|
610
|
-
}
|
|
611
|
-
});
|
|
543
|
+
return t;
|
|
544
|
+
}, id);
|
|
545
|
+
if (await tokenizers && await tokenizers.length) {
|
|
546
|
+
await ui5.userInteraction.selectAll(selector, index, timeout);
|
|
547
|
+
await common.userInteraction.pressBackspace();
|
|
548
|
+
}
|
|
612
549
|
}
|
|
613
550
|
/**
|
|
614
551
|
* @function doubleClick
|
|
@@ -619,30 +556,26 @@ class UserInteraction {
|
|
|
619
556
|
* @param {Number} [timeout=30000] - The timeout to wait (ms).
|
|
620
557
|
* @example await ui5.userInteraction.doubleClick(selector);
|
|
621
558
|
*/
|
|
622
|
-
doubleClick(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
}, {
|
|
633
|
-
timeout,
|
|
634
|
-
timeoutMsg: `Element not clickable after ${+timeout / 1000}s`
|
|
635
|
-
});
|
|
636
|
-
try {
|
|
637
|
-
// @ts-ignore
|
|
638
|
-
yield elem.doubleClick();
|
|
639
|
-
}
|
|
640
|
-
catch (error) {
|
|
641
|
-
// @ts-ignore
|
|
642
|
-
const errorMessage = yield util.function.mapWdioErrorToQmateErrorMessage(error, "doubleClick");
|
|
643
|
-
throw new Error(errorMessage);
|
|
644
|
-
}
|
|
559
|
+
async doubleClick(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
560
|
+
let elem = null;
|
|
561
|
+
await browser.waitUntil(async function () {
|
|
562
|
+
elem = await ui5.element.getDisplayed(selector, index, timeout);
|
|
563
|
+
if (!elem)
|
|
564
|
+
return false;
|
|
565
|
+
return elem.isClickable();
|
|
566
|
+
}, {
|
|
567
|
+
timeout,
|
|
568
|
+
timeoutMsg: `Element not clickable after ${+timeout / 1000}s`
|
|
645
569
|
});
|
|
570
|
+
try {
|
|
571
|
+
// @ts-ignore
|
|
572
|
+
await elem.doubleClick();
|
|
573
|
+
}
|
|
574
|
+
catch (error) {
|
|
575
|
+
// @ts-ignore
|
|
576
|
+
const errorMessage = await util.function.mapWdioErrorToQmateErrorMessage(error, "doubleClick");
|
|
577
|
+
throw new Error(errorMessage);
|
|
578
|
+
}
|
|
646
579
|
}
|
|
647
580
|
;
|
|
648
581
|
/**
|
|
@@ -655,32 +588,28 @@ class UserInteraction {
|
|
|
655
588
|
* @example const elem = await nonUi5.element.getById("button01");
|
|
656
589
|
* await ui5.userInteraction.rightClick(elem);
|
|
657
590
|
*/
|
|
658
|
-
rightClick(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
}, {
|
|
669
|
-
timeout,
|
|
670
|
-
timeoutMsg: `Element not clickable after ${+timeout / 1000}s`
|
|
671
|
-
});
|
|
672
|
-
try {
|
|
673
|
-
// @ts-ignore
|
|
674
|
-
yield elem.click({
|
|
675
|
-
button: "right"
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
catch (error) {
|
|
679
|
-
// @ts-ignore
|
|
680
|
-
const errorMessage = yield util.function.mapWdioErrorToQmateErrorMessage(error, "rightClick");
|
|
681
|
-
throw new Error(errorMessage);
|
|
682
|
-
}
|
|
591
|
+
async rightClick(selector, index = 0, timeout = process.env.QMATE_CUSTOM_TIMEOUT || 30000) {
|
|
592
|
+
let elem = null;
|
|
593
|
+
await browser.waitUntil(async function () {
|
|
594
|
+
elem = await ui5.element.getDisplayed(selector, index, timeout);
|
|
595
|
+
if (!elem)
|
|
596
|
+
return false;
|
|
597
|
+
return elem.isClickable();
|
|
598
|
+
}, {
|
|
599
|
+
timeout,
|
|
600
|
+
timeoutMsg: `Element not clickable after ${+timeout / 1000}s`
|
|
683
601
|
});
|
|
602
|
+
try {
|
|
603
|
+
// @ts-ignore
|
|
604
|
+
await elem.click({
|
|
605
|
+
button: "right"
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
catch (error) {
|
|
609
|
+
// @ts-ignore
|
|
610
|
+
const errorMessage = await util.function.mapWdioErrorToQmateErrorMessage(error, "rightClick");
|
|
611
|
+
throw new Error(errorMessage);
|
|
612
|
+
}
|
|
684
613
|
}
|
|
685
614
|
;
|
|
686
615
|
}
|