@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.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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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
|
-
|
|
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
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
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
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
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
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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 {
|