@sapui5/sap.fe.test 1.102.2 → 1.104.1
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/package.json +3 -4
- package/src/sap/fe/test/.library +1 -1
- package/src/sap/fe/test/BaseActions.js +103 -97
- package/src/sap/fe/test/BaseArrangements.js +4 -15
- package/src/sap/fe/test/BaseAssertions.js +39 -46
- package/src/sap/fe/test/CollaborationClient.js +5 -5
- package/src/sap/fe/test/CollaborationClient.ts +5 -5
- package/src/sap/fe/test/FeMocks.js +1 -1
- package/src/sap/fe/test/FeMocks.ts +4 -3
- package/src/sap/fe/test/Flexibility.js +115 -162
- package/src/sap/fe/test/JestTemplatingHelper.js +99 -7
- package/src/sap/fe/test/JestTemplatingHelper.ts +91 -14
- package/src/sap/fe/test/JourneyRunner.js +31 -37
- package/src/sap/fe/test/ListReport.js +9 -13
- package/src/sap/fe/test/ObjectPage.js +35 -33
- package/src/sap/fe/test/Shell.js +0 -6
- package/src/sap/fe/test/TemplatePage.js +0 -2
- package/src/sap/fe/test/TemplatingTestUtils.js +20 -20
- package/src/sap/fe/test/UI5MockHelper.js +16 -10
- package/src/sap/fe/test/UI5MockHelper.ts +28 -18
- package/src/sap/fe/test/Utils.js +19 -20
- package/src/sap/fe/test/api/BaseAPI.js +11 -26
- package/src/sap/fe/test/api/ChartActions.js +116 -119
- package/src/sap/fe/test/api/ChartAssertions.js +18 -22
- package/src/sap/fe/test/api/CollaborationAPI.js +6 -6
- package/src/sap/fe/test/api/CollaborationAPI.ts +9 -11
- package/src/sap/fe/test/api/DialogAPI.js +11 -13
- package/src/sap/fe/test/api/DialogActions.js +8 -8
- package/src/sap/fe/test/api/DialogAssertions.js +9 -10
- package/src/sap/fe/test/api/DialogHelper.js +63 -0
- package/src/sap/fe/test/api/DialogMessageActions.js +2 -1
- package/src/sap/fe/test/api/DialogValueHelpActions.js +17 -39
- package/src/sap/fe/test/api/DialogValueHelpAssertions.js +47 -19
- package/src/sap/fe/test/api/FilterBarAPI.js +11 -12
- package/src/sap/fe/test/api/FilterBarActions.js +26 -40
- package/src/sap/fe/test/api/FilterBarAssertions.js +28 -47
- package/src/sap/fe/test/api/FooterActionsBase.js +3 -4
- package/src/sap/fe/test/api/FooterActionsOP.js +6 -10
- package/src/sap/fe/test/api/FooterAssertionsBase.js +5 -10
- package/src/sap/fe/test/api/FooterAssertionsOP.js +8 -13
- package/src/sap/fe/test/api/FormAPI.js +5 -6
- package/src/sap/fe/test/api/FormActions.js +11 -21
- package/src/sap/fe/test/api/FormAssertions.js +14 -20
- package/src/sap/fe/test/api/HeaderAPI.js +12 -27
- package/src/sap/fe/test/api/HeaderActions.js +10 -12
- package/src/sap/fe/test/api/HeaderActionsLR.js +76 -82
- package/src/sap/fe/test/api/HeaderAssertions.js +2 -20
- package/src/sap/fe/test/api/HeaderAssertionsLR.js +5 -8
- package/src/sap/fe/test/api/HeaderLR.js +7 -19
- package/src/sap/fe/test/api/KPICardAssertions.js +18 -37
- package/src/sap/fe/test/api/TableAPI.js +3 -13
- package/src/sap/fe/test/api/TableActions.js +2 -34
- package/src/sap/fe/test/api/TableAssertions.js +1 -24
- package/src/sap/fe/test/builder/FEBuilder.js +71 -75
- package/src/sap/fe/test/builder/MacroFieldBuilder.js +4 -3
- package/src/sap/fe/test/builder/MdcFieldBuilder.js +33 -29
- package/src/sap/fe/test/builder/MdcFilterBarBuilder.js +102 -104
- package/src/sap/fe/test/builder/MdcFilterFieldBuilder.js +9 -7
- package/src/sap/fe/test/builder/MdcTableBuilder.js +8 -4
- package/src/sap/fe/test/builder/VMBuilder.js +39 -55
- package/src/sap/fe/test/internal/ConsoleErrorChecker.js +241 -0
- package/src/sap/fe/test/internal/ConsoleErrorChecker.ts +206 -0
- package/src/sap/fe/test/internal/FEArrangements.js +28 -8
- package/src/sap/fe/test/library.js +3 -2
- package/src/sap/fe/test/library.ts +1 -0
|
@@ -12,21 +12,25 @@ sap.ui.define(
|
|
|
12
12
|
"sap/ui/core/util/ShortcutHelper",
|
|
13
13
|
"sap/base/util/deepEqual"
|
|
14
14
|
],
|
|
15
|
-
function(OpaBuilder, Utils, Opa5, Matcher, ShortcutHelper, deepEqual) {
|
|
15
|
+
function (OpaBuilder, Utils, Opa5, Matcher, ShortcutHelper, deepEqual) {
|
|
16
16
|
"use strict";
|
|
17
17
|
|
|
18
|
+
var FEBuilder = function () {
|
|
19
|
+
return OpaBuilder.apply(this, arguments);
|
|
20
|
+
};
|
|
21
|
+
|
|
18
22
|
var ElementStates = {
|
|
19
|
-
focused: function(bFocused) {
|
|
23
|
+
focused: function (bFocused) {
|
|
20
24
|
var fnFocusedMatcher = OpaBuilder.Matchers.focused(true);
|
|
21
25
|
return bFocused ? fnFocusedMatcher : OpaBuilder.Matchers.not(fnFocusedMatcher);
|
|
22
26
|
},
|
|
23
|
-
controlType: function(vType) {
|
|
24
|
-
return function(oControl) {
|
|
27
|
+
controlType: function (vType) {
|
|
28
|
+
return function (oControl) {
|
|
25
29
|
return oControl && oControl.isA(vType);
|
|
26
30
|
};
|
|
27
31
|
},
|
|
28
|
-
content: function(mState) {
|
|
29
|
-
return function(oControl) {
|
|
32
|
+
content: function (mState) {
|
|
33
|
+
return function (oControl) {
|
|
30
34
|
if (!oControl) {
|
|
31
35
|
return false;
|
|
32
36
|
}
|
|
@@ -38,17 +42,17 @@ sap.ui.define(
|
|
|
38
42
|
if (!Array.isArray(vAggControls)) {
|
|
39
43
|
vAggControls = [vAggControls];
|
|
40
44
|
}
|
|
41
|
-
return vAggControls.some(function(oAggControl) {
|
|
45
|
+
return vAggControls.some(function (oAggControl) {
|
|
42
46
|
return FEBuilder.Matchers.states(mState)(oAggControl);
|
|
43
47
|
});
|
|
44
48
|
};
|
|
45
49
|
},
|
|
46
|
-
p13nMode: function(aMode) {
|
|
50
|
+
p13nMode: function (aMode) {
|
|
47
51
|
if (!Array.isArray(aMode)) {
|
|
48
52
|
aMode = [];
|
|
49
53
|
}
|
|
50
54
|
aMode.sort();
|
|
51
|
-
return function(oControl) {
|
|
55
|
+
return function (oControl) {
|
|
52
56
|
var p13nMode = oControl.getP13nMode();
|
|
53
57
|
if (!Array.isArray(p13nMode)) {
|
|
54
58
|
p13nMode = [];
|
|
@@ -57,8 +61,8 @@ sap.ui.define(
|
|
|
57
61
|
return deepEqual(aMode, p13nMode);
|
|
58
62
|
};
|
|
59
63
|
},
|
|
60
|
-
label: function(sLabel) {
|
|
61
|
-
return function(oControl) {
|
|
64
|
+
label: function (sLabel) {
|
|
65
|
+
return function (oControl) {
|
|
62
66
|
if (oControl.getMetadata().getProperty("label")) {
|
|
63
67
|
return OpaBuilder.Matchers.match(OpaBuilder.Matchers.properties({ label: sLabel }))(oControl);
|
|
64
68
|
}
|
|
@@ -67,11 +71,7 @@ sap.ui.define(
|
|
|
67
71
|
}
|
|
68
72
|
};
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
return OpaBuilder.apply(this, arguments);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
FEBuilder.create = function(oOpaInstance) {
|
|
74
|
+
FEBuilder.create = function (oOpaInstance) {
|
|
75
75
|
return new FEBuilder(oOpaInstance);
|
|
76
76
|
};
|
|
77
77
|
|
|
@@ -81,16 +81,16 @@ sap.ui.define(
|
|
|
81
81
|
/**
|
|
82
82
|
* Returns the matcher for states, which might be control specific. This function is meant to be overridden
|
|
83
83
|
* by concrete control builder if necessary.
|
|
84
|
-
* @param mState
|
|
85
|
-
* @returns {Function} The state matcher function
|
|
86
84
|
*
|
|
85
|
+
* @param {any} mState
|
|
86
|
+
* @returns {Function} The state matcher function
|
|
87
87
|
* @protected
|
|
88
88
|
*/
|
|
89
|
-
FEBuilder.prototype.getStatesMatcher = function(mState) {
|
|
89
|
+
FEBuilder.prototype.getStatesMatcher = function (mState) {
|
|
90
90
|
return FEBuilder.Matchers.states(mState);
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
FEBuilder.prototype.hasState = function(mState) {
|
|
93
|
+
FEBuilder.prototype.hasState = function (mState) {
|
|
94
94
|
if (!mState) {
|
|
95
95
|
return this;
|
|
96
96
|
}
|
|
@@ -105,23 +105,23 @@ sap.ui.define(
|
|
|
105
105
|
return this.has(this.getStatesMatcher(mState));
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
FEBuilder.prototype.doPressKeyboardShortcut = function(sShortcut) {
|
|
108
|
+
FEBuilder.prototype.doPressKeyboardShortcut = function (sShortcut) {
|
|
109
109
|
return this.do(FEBuilder.Actions.keyboardShortcut(sShortcut));
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
// overrides the base implementation to support operating on "deep" aggregation, e.g. "content/items" or "actions/action"
|
|
113
|
-
FEBuilder.prototype.doOnAggregation = function(sAggregationName, vMatchers, vActions) {
|
|
113
|
+
FEBuilder.prototype.doOnAggregation = function (sAggregationName, vMatchers, vActions) {
|
|
114
114
|
if (arguments.length < 3) {
|
|
115
115
|
vActions = vMatchers;
|
|
116
116
|
vMatchers = undefined;
|
|
117
117
|
}
|
|
118
118
|
var fnDeepAggregation = FEBuilder.Matchers.deepAggregation(sAggregationName, vMatchers);
|
|
119
|
-
return this.do(function(oControl) {
|
|
119
|
+
return this.do(function (oControl) {
|
|
120
120
|
OpaBuilder.Actions.executor(vActions)(fnDeepAggregation(oControl));
|
|
121
121
|
});
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
FEBuilder.getControls = function(vBuilder, bSingle) {
|
|
124
|
+
FEBuilder.getControls = function (vBuilder, bSingle) {
|
|
125
125
|
var oOptions = vBuilder.build(),
|
|
126
126
|
vControls = Opa5.getPlugin().getMatchingControls(oOptions),
|
|
127
127
|
aControls = OpaBuilder.Matchers.filter(oOptions.matchers)(vControls);
|
|
@@ -134,26 +134,26 @@ sap.ui.define(
|
|
|
134
134
|
return aControls;
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
FEBuilder.controlsExist = function(vBuilder) {
|
|
137
|
+
FEBuilder.controlsExist = function (vBuilder) {
|
|
138
138
|
return !!FEBuilder.getControls(vBuilder).length;
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
FEBuilder.createClosePopoverBuilder = function(oOpaInstance, vPopoverMatchers, bStrict) {
|
|
142
|
-
return OpaBuilder.create(oOpaInstance).success(function() {
|
|
141
|
+
FEBuilder.createClosePopoverBuilder = function (oOpaInstance, vPopoverMatchers, bStrict) {
|
|
142
|
+
return OpaBuilder.create(oOpaInstance).success(function () {
|
|
143
143
|
var bPopoverClosed = false,
|
|
144
|
-
fnCloseCallback = function() {
|
|
144
|
+
fnCloseCallback = function () {
|
|
145
145
|
bPopoverClosed = true;
|
|
146
146
|
},
|
|
147
147
|
oBuilder = FEBuilder.createPopoverBuilder(oOpaInstance, vPopoverMatchers);
|
|
148
148
|
|
|
149
149
|
if (bStrict || FEBuilder.controlsExist(oBuilder)) {
|
|
150
150
|
return oBuilder
|
|
151
|
-
.do(function(oPopover) {
|
|
151
|
+
.do(function (oPopover) {
|
|
152
152
|
oPopover.attachEventOnce("afterClose", fnCloseCallback);
|
|
153
153
|
oPopover.close();
|
|
154
154
|
})
|
|
155
155
|
.success(
|
|
156
|
-
OpaBuilder.create(oOpaInstance).check(function() {
|
|
156
|
+
OpaBuilder.create(oOpaInstance).check(function () {
|
|
157
157
|
return bPopoverClosed;
|
|
158
158
|
})
|
|
159
159
|
)
|
|
@@ -162,11 +162,11 @@ sap.ui.define(
|
|
|
162
162
|
});
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
-
FEBuilder.createPopoverBuilder = function(oOpaInstance, vPopoverMatchers) {
|
|
165
|
+
FEBuilder.createPopoverBuilder = function (oOpaInstance, vPopoverMatchers) {
|
|
166
166
|
var oBuilder = OpaBuilder.create(oOpaInstance)
|
|
167
167
|
.hasType("sap.m.Popover")
|
|
168
168
|
.isDialogElement(true)
|
|
169
|
-
.has(function(oPopover) {
|
|
169
|
+
.has(function (oPopover) {
|
|
170
170
|
return oPopover.isOpen();
|
|
171
171
|
})
|
|
172
172
|
.checkNumberOfMatches(1);
|
|
@@ -178,9 +178,9 @@ sap.ui.define(
|
|
|
178
178
|
return oBuilder;
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
FEBuilder.createMessageToastBuilder = function(sText) {
|
|
181
|
+
FEBuilder.createMessageToastBuilder = function (sText) {
|
|
182
182
|
return OpaBuilder.create()
|
|
183
|
-
.check(function() {
|
|
183
|
+
.check(function () {
|
|
184
184
|
var oWindow = Opa5.getWindow();
|
|
185
185
|
return (
|
|
186
186
|
oWindow.sapFEStubs && oWindow.sapFEStubs.getLastToastMessage && oWindow.sapFEStubs.getLastToastMessage() === sText
|
|
@@ -190,7 +190,7 @@ sap.ui.define(
|
|
|
190
190
|
};
|
|
191
191
|
|
|
192
192
|
FEBuilder.Matchers = {
|
|
193
|
-
FOCUSED_ELEMENT: function() {
|
|
193
|
+
FOCUSED_ELEMENT: function () {
|
|
194
194
|
var oTestCore = Opa5.getWindow().sap.ui.getCore(),
|
|
195
195
|
sFocusedId = oTestCore.getCurrentFocusedControlId();
|
|
196
196
|
if (sFocusedId) {
|
|
@@ -198,11 +198,11 @@ sap.ui.define(
|
|
|
198
198
|
}
|
|
199
199
|
return null;
|
|
200
200
|
},
|
|
201
|
-
state: function(sName, vValue) {
|
|
201
|
+
state: function (sName, vValue) {
|
|
202
202
|
if (sName in ElementStates) {
|
|
203
203
|
return ElementStates[sName](vValue);
|
|
204
204
|
}
|
|
205
|
-
return function(oControl) {
|
|
205
|
+
return function (oControl) {
|
|
206
206
|
// check whether an aggregation exists with given name...
|
|
207
207
|
var oMetadata = oControl.getMetadata(),
|
|
208
208
|
vAggControls =
|
|
@@ -223,20 +223,20 @@ sap.ui.define(
|
|
|
223
223
|
if (Utils.isOfType(vValue, Number)) {
|
|
224
224
|
return vAggControls.length === vValue;
|
|
225
225
|
}
|
|
226
|
-
return vAggControls.some(function(oAggControl) {
|
|
226
|
+
return vAggControls.some(function (oAggControl) {
|
|
227
227
|
return FEBuilder.Matchers.states(vValue)(oAggControl);
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
// at this point we have both vAggControls and vValue as arrays => we check each single element against its corresponding state
|
|
231
231
|
return (
|
|
232
232
|
vValue.length === vAggControls.length &&
|
|
233
|
-
vAggControls.every(function(oAggControl, iIndex) {
|
|
233
|
+
vAggControls.every(function (oAggControl, iIndex) {
|
|
234
234
|
return FEBuilder.Matchers.states(vValue[iIndex])(oAggControl);
|
|
235
235
|
})
|
|
236
236
|
);
|
|
237
237
|
};
|
|
238
238
|
},
|
|
239
|
-
states: function(mStateMap, fnSingleStateMatcher) {
|
|
239
|
+
states: function (mStateMap, fnSingleStateMatcher) {
|
|
240
240
|
if (!Utils.isOfType(mStateMap, Object)) {
|
|
241
241
|
return OpaBuilder.Matchers.TRUE;
|
|
242
242
|
}
|
|
@@ -244,33 +244,33 @@ sap.ui.define(
|
|
|
244
244
|
fnSingleStateMatcher = FEBuilder.Matchers.state;
|
|
245
245
|
}
|
|
246
246
|
return FEBuilder.Matchers.match(
|
|
247
|
-
Object.keys(mStateMap).map(function(sProperty) {
|
|
247
|
+
Object.keys(mStateMap).map(function (sProperty) {
|
|
248
248
|
return fnSingleStateMatcher(sProperty, mStateMap[sProperty]);
|
|
249
249
|
})
|
|
250
250
|
);
|
|
251
251
|
},
|
|
252
|
-
match: function(vMatchers) {
|
|
252
|
+
match: function (vMatchers) {
|
|
253
253
|
var fnMatch = OpaBuilder.Matchers.match(vMatchers);
|
|
254
|
-
return function(oControl) {
|
|
254
|
+
return function (oControl) {
|
|
255
255
|
// ensure that the result is a boolean
|
|
256
256
|
return !!fnMatch(oControl);
|
|
257
257
|
};
|
|
258
258
|
},
|
|
259
|
-
bound: function() {
|
|
260
|
-
return function(oControl) {
|
|
259
|
+
bound: function () {
|
|
260
|
+
return function (oControl) {
|
|
261
261
|
return oControl && !!oControl.getBindingContext();
|
|
262
262
|
};
|
|
263
263
|
},
|
|
264
|
-
allMatch: function(vMatchers) {
|
|
264
|
+
allMatch: function (vMatchers) {
|
|
265
265
|
var fnFilterMatcher = OpaBuilder.Matchers.filter(vMatchers);
|
|
266
|
-
return function(aItems) {
|
|
266
|
+
return function (aItems) {
|
|
267
267
|
var iExpectedLength = (aItems && aItems.length) || 0;
|
|
268
268
|
return iExpectedLength === fnFilterMatcher(aItems).length;
|
|
269
269
|
};
|
|
270
270
|
},
|
|
271
|
-
someMatch: function(vMatchers) {
|
|
271
|
+
someMatch: function (vMatchers) {
|
|
272
272
|
var fnFilterMatcher = OpaBuilder.Matchers.filter(vMatchers);
|
|
273
|
-
return function(aItems) {
|
|
273
|
+
return function (aItems) {
|
|
274
274
|
return fnFilterMatcher(aItems).length > 0;
|
|
275
275
|
};
|
|
276
276
|
},
|
|
@@ -283,8 +283,8 @@ sap.ui.define(
|
|
|
283
283
|
* @public
|
|
284
284
|
* @static
|
|
285
285
|
*/
|
|
286
|
-
id: function(vId) {
|
|
287
|
-
return function(oControl) {
|
|
286
|
+
id: function (vId) {
|
|
287
|
+
return function (oControl) {
|
|
288
288
|
if (Utils.isOfType(vId, String)) {
|
|
289
289
|
return oControl.getId() === vId;
|
|
290
290
|
} else {
|
|
@@ -301,8 +301,8 @@ sap.ui.define(
|
|
|
301
301
|
* @public
|
|
302
302
|
* @static
|
|
303
303
|
*/
|
|
304
|
-
type: function(vType) {
|
|
305
|
-
return function(oControl) {
|
|
304
|
+
type: function (vType) {
|
|
305
|
+
return function (oControl) {
|
|
306
306
|
if (Utils.isOfType(vType, String)) {
|
|
307
307
|
return oControl.getMetadata().getName() === vType;
|
|
308
308
|
} else {
|
|
@@ -316,8 +316,8 @@ sap.ui.define(
|
|
|
316
316
|
* @param {number} iIndex The index of the element to be returned
|
|
317
317
|
* @returns {Function} The matcher function returning element at given index
|
|
318
318
|
*/
|
|
319
|
-
atIndex: function(iIndex) {
|
|
320
|
-
return function(vInput) {
|
|
319
|
+
atIndex: function (iIndex) {
|
|
320
|
+
return function (vInput) {
|
|
321
321
|
if (Utils.isOfType(vInput, [null, undefined])) {
|
|
322
322
|
return null;
|
|
323
323
|
}
|
|
@@ -326,8 +326,8 @@ sap.ui.define(
|
|
|
326
326
|
};
|
|
327
327
|
},
|
|
328
328
|
|
|
329
|
-
singleElement: function() {
|
|
330
|
-
return function(vControls) {
|
|
329
|
+
singleElement: function () {
|
|
330
|
+
return function (vControls) {
|
|
331
331
|
if (!Array.isArray(vControls)) {
|
|
332
332
|
vControls = [vControls];
|
|
333
333
|
}
|
|
@@ -338,28 +338,24 @@ sap.ui.define(
|
|
|
338
338
|
};
|
|
339
339
|
},
|
|
340
340
|
|
|
341
|
-
label: function(sText) {
|
|
341
|
+
label: function (sText) {
|
|
342
342
|
// either Label control exists having labelFor target the control, or ariaLabelledBy is available on control
|
|
343
343
|
return OpaBuilder.Matchers.some(
|
|
344
344
|
// alternative implementation to sap.ui.test.matchers.LabelFor, which does not support labels for links
|
|
345
|
-
function(vControl) {
|
|
345
|
+
function (vControl) {
|
|
346
346
|
var sControlId = vControl.getId && vControl.getId();
|
|
347
347
|
return (
|
|
348
348
|
sControlId &&
|
|
349
349
|
FEBuilder.controlsExist(
|
|
350
|
-
FEBuilder.create()
|
|
351
|
-
.hasType("sap.m.Label")
|
|
352
|
-
.hasProperties({ text: sText, labelFor: sControlId })
|
|
350
|
+
FEBuilder.create().hasType("sap.m.Label").hasProperties({ text: sText, labelFor: sControlId })
|
|
353
351
|
)
|
|
354
352
|
);
|
|
355
353
|
},
|
|
356
|
-
function(vControl) {
|
|
354
|
+
function (vControl) {
|
|
357
355
|
var aAriaLabelledBy = vControl.getAriaLabelledBy && vControl.getAriaLabelledBy();
|
|
358
356
|
if (Array.isArray(aAriaLabelledBy) && aAriaLabelledBy.length > 0) {
|
|
359
|
-
return aAriaLabelledBy.some(function(sAriaLabelledById) {
|
|
360
|
-
var oAriaLabelledBy = Opa5.getWindow()
|
|
361
|
-
.sap.ui.getCore()
|
|
362
|
-
.byId(sAriaLabelledById);
|
|
357
|
+
return aAriaLabelledBy.some(function (sAriaLabelledById) {
|
|
358
|
+
var oAriaLabelledBy = Opa5.getWindow().sap.ui.getCore().byId(sAriaLabelledById);
|
|
363
359
|
return oAriaLabelledBy && oAriaLabelledBy.getText && oAriaLabelledBy.getText() === sText;
|
|
364
360
|
});
|
|
365
361
|
}
|
|
@@ -373,15 +369,15 @@ sap.ui.define(
|
|
|
373
369
|
* @param {any} [vMatchers] Matchers against target controls
|
|
374
370
|
* @returns {function(*): *} A matcher function that returns always an array with matching controls
|
|
375
371
|
*/
|
|
376
|
-
deepAggregation: function(sAggregationPath, vMatchers) {
|
|
372
|
+
deepAggregation: function (sAggregationPath, vMatchers) {
|
|
377
373
|
var fnFilter = OpaBuilder.Matchers.filter(vMatchers),
|
|
378
|
-
fnMapControlToAggregationName = function(oControl) {
|
|
374
|
+
fnMapControlToAggregationName = function (oControl) {
|
|
379
375
|
return Utils.getAggregation(oControl, this);
|
|
380
376
|
};
|
|
381
|
-
return function(oControl) {
|
|
377
|
+
return function (oControl) {
|
|
382
378
|
var aAggregationNames = sAggregationPath.split("/"),
|
|
383
379
|
aTargetControls = aAggregationNames.reduce(
|
|
384
|
-
function(aCurrentControls, sAggregationName) {
|
|
380
|
+
function (aCurrentControls, sAggregationName) {
|
|
385
381
|
return Array.prototype.concat.apply(
|
|
386
382
|
[],
|
|
387
383
|
aCurrentControls.map(fnMapControlToAggregationName.bind(sAggregationName))
|
|
@@ -393,21 +389,21 @@ sap.ui.define(
|
|
|
393
389
|
};
|
|
394
390
|
},
|
|
395
391
|
|
|
396
|
-
deepAggregationMatcher: function(sAggregationPath, vMatchers) {
|
|
392
|
+
deepAggregationMatcher: function (sAggregationPath, vMatchers) {
|
|
397
393
|
var fnDeepAggregation = FEBuilder.Matchers.deepAggregation(sAggregationPath, vMatchers);
|
|
398
|
-
return function(oControl) {
|
|
394
|
+
return function (oControl) {
|
|
399
395
|
return fnDeepAggregation(oControl).length > 0;
|
|
400
396
|
};
|
|
401
397
|
}
|
|
402
398
|
};
|
|
403
399
|
|
|
404
400
|
FEBuilder.Actions = {
|
|
405
|
-
keyboardShortcut: function(sShortcut, sChildElement, bIgnoreFocus) {
|
|
401
|
+
keyboardShortcut: function (sShortcut, sChildElement, bIgnoreFocus) {
|
|
406
402
|
var aArguments = Utils.parseArguments([String, String, Boolean], arguments);
|
|
407
403
|
sShortcut = aArguments[0];
|
|
408
404
|
sChildElement = aArguments[1];
|
|
409
405
|
bIgnoreFocus = aArguments[2];
|
|
410
|
-
return function(oElement) {
|
|
406
|
+
return function (oElement) {
|
|
411
407
|
var oNormalizedShortCut = ShortcutHelper.parseShortcut(sShortcut);
|
|
412
408
|
oNormalizedShortCut.type = "keydown";
|
|
413
409
|
// do not lower-case single key definitions (e.g. Enter, Space, ...), else the event might not be triggered properly
|
|
@@ -35,11 +35,11 @@ sap.ui.define(
|
|
|
35
35
|
if (oControl.isA("sap.ui.mdc.Field")) {
|
|
36
36
|
return FieldBuilder.Matchers.state(sName, vValue);
|
|
37
37
|
} else if (sName === "lockedBy") {
|
|
38
|
-
return function (
|
|
38
|
+
return function (oSubControl) {
|
|
39
39
|
var oMatcher = OpaBuilder.Matchers.childrenMatcher(
|
|
40
40
|
FEBuilder.create(this).hasType("sap.m.Avatar").hasProperties({ initials: vValue })
|
|
41
41
|
);
|
|
42
|
-
return FEBuilder.Matchers.match(oMatcher)(
|
|
42
|
+
return FEBuilder.Matchers.match(oMatcher)(oSubControl);
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
return FEBuilder.Matchers.state(sName, vValue);
|
|
@@ -114,7 +114,8 @@ sap.ui.define(
|
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
116
|
* Returns the state matcher for the MdcField control.
|
|
117
|
-
*
|
|
117
|
+
*
|
|
118
|
+
* @param {any} mState
|
|
118
119
|
* @returns {*}
|
|
119
120
|
* @protected
|
|
120
121
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
sap.ui.define(
|
|
7
7
|
["./FEBuilder", "sap/ui/test/OpaBuilder", "sap/ui/mdc/enum/FieldDisplay", "sap/fe/test/Utils", "sap/ui/mdc/enum/ConditionValidated"],
|
|
8
|
-
function(FEBuilder, OpaBuilder, FieldDisplay, Utils, ConditionValidated) {
|
|
8
|
+
function (FEBuilder, OpaBuilder, FieldDisplay, Utils, ConditionValidated) {
|
|
9
9
|
"use strict";
|
|
10
10
|
|
|
11
11
|
var VALUE_DESCRIPTION_PATTERN = /(.+?) \((.+?)\)/;
|
|
@@ -14,6 +14,7 @@ sap.ui.define(
|
|
|
14
14
|
* This function checks whether the expected value is fulfilled by the checked value.
|
|
15
15
|
* Both values can be either an array or a single element.
|
|
16
16
|
* In case of arrays, the it checks the second parameter to start with the same vales as the expected value array.
|
|
17
|
+
*
|
|
17
18
|
* @param {any} vExpectedValue
|
|
18
19
|
* @param {any} vValueToCheck
|
|
19
20
|
* @returns {boolean} `true` if expected values are met, `false` else
|
|
@@ -23,18 +24,19 @@ sap.ui.define(
|
|
|
23
24
|
vExpectedValue = (vExpectedValue && [].concat(vExpectedValue)) || [];
|
|
24
25
|
vValueToCheck = (vValueToCheck && [].concat(vValueToCheck)) || [];
|
|
25
26
|
|
|
26
|
-
return vExpectedValue.every(function(vValue, iIndex) {
|
|
27
|
+
return vExpectedValue.every(function (vValue, iIndex) {
|
|
27
28
|
return iIndex < vValueToCheck.length && (vValue || "") == (vValueToCheck[iIndex] || "");
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* This function checks the current value against expected values with respect to the display type.
|
|
34
|
+
*
|
|
33
35
|
* @param {sap.ui.mdc.enum.FieldDisplay} sDisplay The type of display
|
|
34
|
-
* @param oExpectedValue
|
|
35
|
-
* @param oExpectedDescription
|
|
36
|
-
* @param vActualValue
|
|
37
|
-
* @param vActualDescription
|
|
36
|
+
* @param {any} oExpectedValue
|
|
37
|
+
* @param {any} oExpectedDescription
|
|
38
|
+
* @param {any} vActualValue
|
|
39
|
+
* @param {any} vActualDescription
|
|
38
40
|
* @returns {boolean|boolean}
|
|
39
41
|
* @private
|
|
40
42
|
*/
|
|
@@ -89,18 +91,18 @@ sap.ui.define(
|
|
|
89
91
|
return mResult;
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
var FieldBuilder = function() {
|
|
94
|
+
var FieldBuilder = function () {
|
|
93
95
|
return FEBuilder.apply(this, arguments);
|
|
94
96
|
};
|
|
95
97
|
|
|
96
|
-
FieldBuilder.create = function(oOpaInstance) {
|
|
98
|
+
FieldBuilder.create = function (oOpaInstance) {
|
|
97
99
|
return new FieldBuilder(oOpaInstance);
|
|
98
100
|
};
|
|
99
101
|
|
|
100
102
|
FieldBuilder.prototype = Object.create(FEBuilder.prototype);
|
|
101
103
|
FieldBuilder.prototype.constructor = FieldBuilder;
|
|
102
104
|
|
|
103
|
-
FieldBuilder.prototype.hasValue = function(vValue) {
|
|
105
|
+
FieldBuilder.prototype.hasValue = function (vValue) {
|
|
104
106
|
// silently ignore undefined argument for convenience
|
|
105
107
|
if (vValue === undefined) {
|
|
106
108
|
return this;
|
|
@@ -110,13 +112,14 @@ sap.ui.define(
|
|
|
110
112
|
|
|
111
113
|
/**
|
|
112
114
|
* Checks for certain condition value(s).
|
|
115
|
+
*
|
|
113
116
|
* @param {string|object|Array} [vValue] The expected value(s)
|
|
114
117
|
* @param {string} [sOperator] The expected operator
|
|
115
118
|
* @returns {sap.fe.test.builder.FieldBuilder} `this`
|
|
116
119
|
* @public
|
|
117
120
|
* @ui5-restricted
|
|
118
121
|
*/
|
|
119
|
-
FieldBuilder.prototype.hasConditionValues = function(vValue, sOperator) {
|
|
122
|
+
FieldBuilder.prototype.hasConditionValues = function (vValue, sOperator) {
|
|
120
123
|
// silently ignore undefined argument for convenience
|
|
121
124
|
if (vValue === undefined) {
|
|
122
125
|
return this;
|
|
@@ -126,12 +129,13 @@ sap.ui.define(
|
|
|
126
129
|
|
|
127
130
|
/**
|
|
128
131
|
* Changes the value of the field.
|
|
132
|
+
*
|
|
129
133
|
* @param {string} vValue The new value
|
|
130
134
|
* @returns {sap.fe.test.builder.FieldBuilder} `this`
|
|
131
135
|
* @public
|
|
132
136
|
* @ui5-restricted
|
|
133
137
|
*/
|
|
134
|
-
FieldBuilder.prototype.doChangeValue = function(vValue) {
|
|
138
|
+
FieldBuilder.prototype.doChangeValue = function (vValue) {
|
|
135
139
|
// silently ignore undefined argument for convenience
|
|
136
140
|
if (vValue === undefined) {
|
|
137
141
|
return this;
|
|
@@ -141,25 +145,26 @@ sap.ui.define(
|
|
|
141
145
|
|
|
142
146
|
/**
|
|
143
147
|
* Returns the state matcher for the MdcField control.
|
|
144
|
-
*
|
|
148
|
+
*
|
|
149
|
+
* @param {any} mState
|
|
145
150
|
* @returns {*}
|
|
146
151
|
* @protected
|
|
147
152
|
*/
|
|
148
|
-
FieldBuilder.prototype.getStatesMatcher = function(mState) {
|
|
153
|
+
FieldBuilder.prototype.getStatesMatcher = function (mState) {
|
|
149
154
|
return FieldBuilder.Matchers.states(mState);
|
|
150
155
|
};
|
|
151
156
|
|
|
152
|
-
FieldBuilder.prototype.doPressKeyboardShortcut = function(sShortcut) {
|
|
157
|
+
FieldBuilder.prototype.doPressKeyboardShortcut = function (sShortcut) {
|
|
153
158
|
return this.do(FEBuilder.Actions.keyboardShortcut(sShortcut, "input"));
|
|
154
159
|
};
|
|
155
160
|
|
|
156
|
-
FieldBuilder.prototype.doOpenValueHelp = function() {
|
|
161
|
+
FieldBuilder.prototype.doOpenValueHelp = function () {
|
|
157
162
|
return this.doPressKeyboardShortcut("F4");
|
|
158
163
|
};
|
|
159
164
|
|
|
160
165
|
FieldBuilder.Matchers = {
|
|
161
|
-
value: function(vExpectedValue) {
|
|
162
|
-
return function(oField) {
|
|
166
|
+
value: function (vExpectedValue) {
|
|
167
|
+
return function (oField) {
|
|
163
168
|
if (!oField.isA("sap.ui.mdc.Field")) {
|
|
164
169
|
throw new Error("Expected sap.ui.mdc.Field but got " + oField.getMetadata().getName());
|
|
165
170
|
}
|
|
@@ -177,27 +182,26 @@ sap.ui.define(
|
|
|
177
182
|
* @param {string|object|Array} vExpectedValue The expected value
|
|
178
183
|
* @param {string} [sOperator] The operator of the condition
|
|
179
184
|
* @returns {function(*=): *|boolean}
|
|
180
|
-
*
|
|
181
185
|
* @static
|
|
182
186
|
* @ui5-restricted
|
|
183
187
|
*/
|
|
184
|
-
conditionsValue: function(vExpectedValue, sOperator) {
|
|
188
|
+
conditionsValue: function (vExpectedValue, sOperator) {
|
|
185
189
|
if (!Utils.isOfType(vExpectedValue, Array)) {
|
|
186
190
|
vExpectedValue = [vExpectedValue];
|
|
187
191
|
}
|
|
188
|
-
return function(oField) {
|
|
189
|
-
var aExpectedValues = vExpectedValue.map(function(vElement) {
|
|
192
|
+
return function (oField) {
|
|
193
|
+
var aExpectedValues = vExpectedValue.map(function (vElement) {
|
|
190
194
|
return _parseValue(vElement, oField.getDisplay());
|
|
191
195
|
}),
|
|
192
|
-
aConditions = oField.getConditions().map(function(oCondition) {
|
|
196
|
+
aConditions = oField.getConditions().map(function (oCondition) {
|
|
193
197
|
return {
|
|
194
198
|
conditionOperator: oCondition.operator,
|
|
195
199
|
conditionValue: _parseValue(oCondition.values),
|
|
196
200
|
conditionValidated: oCondition.validated === ConditionValidated.Validated
|
|
197
201
|
};
|
|
198
202
|
}),
|
|
199
|
-
fnConditionsCheck = function(vExpected) {
|
|
200
|
-
return function(oCondition) {
|
|
203
|
+
fnConditionsCheck = function (vExpected) {
|
|
204
|
+
return function (oCondition) {
|
|
201
205
|
if (sOperator && oCondition.conditionOperator !== sOperator) {
|
|
202
206
|
return false;
|
|
203
207
|
}
|
|
@@ -212,16 +216,16 @@ sap.ui.define(
|
|
|
212
216
|
};
|
|
213
217
|
return (
|
|
214
218
|
aConditions &&
|
|
215
|
-
aExpectedValues.every(function(vExpected) {
|
|
219
|
+
aExpectedValues.every(function (vExpected) {
|
|
216
220
|
return aConditions.some(fnConditionsCheck(vExpected));
|
|
217
221
|
})
|
|
218
222
|
);
|
|
219
223
|
};
|
|
220
224
|
},
|
|
221
|
-
state: function(sName, vValue) {
|
|
225
|
+
state: function (sName, vValue) {
|
|
222
226
|
switch (sName) {
|
|
223
227
|
case "content":
|
|
224
|
-
return function(oField) {
|
|
228
|
+
return function (oField) {
|
|
225
229
|
var oContentDisplay = oField.getContentDisplay(),
|
|
226
230
|
oContentEdit = oField.getContentEdit(),
|
|
227
231
|
oContent = oField.getContent(),
|
|
@@ -235,14 +239,14 @@ sap.ui.define(
|
|
|
235
239
|
};
|
|
236
240
|
case "contentEdit":
|
|
237
241
|
case "contentDisplay":
|
|
238
|
-
return function(oField) {
|
|
242
|
+
return function (oField) {
|
|
239
243
|
return FEBuilder.Matchers.states(vValue)(oField.getAggregation(sName));
|
|
240
244
|
};
|
|
241
245
|
default:
|
|
242
246
|
return FEBuilder.Matchers.state(sName, vValue);
|
|
243
247
|
}
|
|
244
248
|
},
|
|
245
|
-
states: function(mStateMap) {
|
|
249
|
+
states: function (mStateMap) {
|
|
246
250
|
return FEBuilder.Matchers.states(mStateMap, FieldBuilder.Matchers.state);
|
|
247
251
|
}
|
|
248
252
|
};
|