@sapui5/sap.fe.test 1.101.1 → 1.102.0
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 +1 -1
- package/src/sap/fe/test/.library +1 -1
- package/src/sap/fe/test/CollaborationClient.js +77 -0
- package/src/sap/fe/test/CollaborationClient.ts +105 -0
- package/src/sap/fe/test/FeMocks.js +1 -1
- package/src/sap/fe/test/FeMocks.ts +6 -2
- package/src/sap/fe/test/JestTemplatingHelper.js +19 -1
- package/src/sap/fe/test/JestTemplatingHelper.ts +13 -0
- package/src/sap/fe/test/ListReport.js +7 -15
- package/src/sap/fe/test/LocationUtil.js +12 -16
- package/src/sap/fe/test/ObjectPage.js +38 -6
- package/src/sap/fe/test/Shell.js +94 -34
- package/src/sap/fe/test/TemplatePage.js +6 -0
- package/src/sap/fe/test/UI5MockHelper.js +98 -18
- package/src/sap/fe/test/UI5MockHelper.ts +79 -14
- package/src/sap/fe/test/api/CollaborationAPI.js +215 -0
- package/src/sap/fe/test/api/CollaborationAPI.ts +240 -0
- package/src/sap/fe/test/api/HeaderAssertions.js +76 -41
- package/src/sap/fe/test/api/TableAPI.js +30 -34
- package/src/sap/fe/test/api/TableActions.js +1 -1
- package/src/sap/fe/test/api/TableAssertions.js +51 -46
- package/src/sap/fe/test/builder/MacroFieldBuilder.js +161 -156
- package/src/sap/fe/test/builder/MdcTableBuilder.js +89 -12
- package/src/sap/fe/test/library.js +1 -1
|
@@ -14,7 +14,7 @@ sap.ui.define(
|
|
|
14
14
|
"sap/ui/core/SortOrder",
|
|
15
15
|
"./APIHelper"
|
|
16
16
|
],
|
|
17
|
-
function(TableAPI, Utils, OpaBuilder, FEBuilder, TableBuilder, FilterFieldBuilder, SortOrder, APIHelper) {
|
|
17
|
+
function (TableAPI, Utils, OpaBuilder, FEBuilder, TableBuilder, FilterFieldBuilder, SortOrder, APIHelper) {
|
|
18
18
|
"use strict";
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -29,7 +29,7 @@ sap.ui.define(
|
|
|
29
29
|
* @hideconstructor
|
|
30
30
|
* @public
|
|
31
31
|
*/
|
|
32
|
-
var TableAssertions = function(oBuilderInstance, vTableDescription) {
|
|
32
|
+
var TableAssertions = function (oBuilderInstance, vTableDescription) {
|
|
33
33
|
return TableAPI.call(this, oBuilderInstance, vTableDescription);
|
|
34
34
|
};
|
|
35
35
|
TableAssertions.prototype = Object.create(TableAPI.prototype);
|
|
@@ -44,7 +44,7 @@ sap.ui.define(
|
|
|
44
44
|
*
|
|
45
45
|
* @public
|
|
46
46
|
*/
|
|
47
|
-
TableAssertions.prototype.iCheckState = function(mState) {
|
|
47
|
+
TableAssertions.prototype.iCheckState = function (mState) {
|
|
48
48
|
var oTableBuilder = this.getBuilder();
|
|
49
49
|
return this.prepareResult(
|
|
50
50
|
oTableBuilder
|
|
@@ -74,7 +74,7 @@ sap.ui.define(
|
|
|
74
74
|
*
|
|
75
75
|
* @public
|
|
76
76
|
*/
|
|
77
|
-
TableAssertions.prototype.iCheckRows = function(mRowValues, iExpectedNumberOfRows, mState, vEmptyColumns) {
|
|
77
|
+
TableAssertions.prototype.iCheckRows = function (mRowValues, iExpectedNumberOfRows, mState, vEmptyColumns) {
|
|
78
78
|
var aArguments = Utils.parseArguments([Object, Number, Object, Array], arguments),
|
|
79
79
|
iNumberOfRows = aArguments[1],
|
|
80
80
|
aRowMatcher = TableAPI.createRowMatchers(aArguments[0], aArguments[2], undefined, aArguments[3]),
|
|
@@ -83,7 +83,7 @@ sap.ui.define(
|
|
|
83
83
|
// the order of the matchers matters here
|
|
84
84
|
if (aRowMatcher.length) {
|
|
85
85
|
// if matchers are defined, first match rows, then check number of results
|
|
86
|
-
oTableBuilder.hasRows(aRowMatcher, true).has(function(aRows) {
|
|
86
|
+
oTableBuilder.hasRows(aRowMatcher, true).has(function (aRows) {
|
|
87
87
|
return Utils.isOfType(iNumberOfRows, Number) ? aRows.length === iNumberOfRows : aRows.length > 0;
|
|
88
88
|
});
|
|
89
89
|
} else {
|
|
@@ -124,7 +124,7 @@ sap.ui.define(
|
|
|
124
124
|
*
|
|
125
125
|
* @public
|
|
126
126
|
*/
|
|
127
|
-
TableAssertions.prototype.iCheckCreationRow = function(mRowValues, mState) {
|
|
127
|
+
TableAssertions.prototype.iCheckCreationRow = function (mRowValues, mState) {
|
|
128
128
|
var oTableBuilder = this.getBuilder();
|
|
129
129
|
return this.prepareResult(
|
|
130
130
|
oTableBuilder
|
|
@@ -156,7 +156,7 @@ sap.ui.define(
|
|
|
156
156
|
*
|
|
157
157
|
* @public
|
|
158
158
|
*/
|
|
159
|
-
TableAssertions.prototype.iCheckQuickFilterItems = function(iExpectedNumberOfItems) {
|
|
159
|
+
TableAssertions.prototype.iCheckQuickFilterItems = function (iExpectedNumberOfItems) {
|
|
160
160
|
return this.prepareResult(
|
|
161
161
|
this.getBuilder()
|
|
162
162
|
.hasQuickFilterItems(iExpectedNumberOfItems)
|
|
@@ -183,7 +183,7 @@ sap.ui.define(
|
|
|
183
183
|
*
|
|
184
184
|
* @public
|
|
185
185
|
*/
|
|
186
|
-
TableAssertions.prototype.iCheckColumns = function(iExpectedNumberOfColumns, mColumnStateMap) {
|
|
186
|
+
TableAssertions.prototype.iCheckColumns = function (iExpectedNumberOfColumns, mColumnStateMap) {
|
|
187
187
|
var aArguments = Utils.parseArguments([Number, Object], arguments),
|
|
188
188
|
mColumns = aArguments[1],
|
|
189
189
|
iNumberOfColumns = aArguments[0],
|
|
@@ -232,7 +232,7 @@ sap.ui.define(
|
|
|
232
232
|
*
|
|
233
233
|
* @public
|
|
234
234
|
*/
|
|
235
|
-
TableAssertions.prototype.iCheckCells = function(vRowValues, mColumnStateMap) {
|
|
235
|
+
TableAssertions.prototype.iCheckCells = function (vRowValues, mColumnStateMap) {
|
|
236
236
|
var mRows = arguments.length > 1 ? arguments[0] : undefined,
|
|
237
237
|
mColumns = arguments.length > 1 ? arguments[1] : arguments[0],
|
|
238
238
|
aRowMatcher = TableAPI.createRowMatchers(mRows, TableBuilder.Row.Matchers.cellProperties(mColumns)),
|
|
@@ -262,7 +262,7 @@ sap.ui.define(
|
|
|
262
262
|
*
|
|
263
263
|
* @public
|
|
264
264
|
*/
|
|
265
|
-
TableAssertions.prototype.iCheckAction = function(vActionIdentifier, mState) {
|
|
265
|
+
TableAssertions.prototype.iCheckAction = function (vActionIdentifier, mState) {
|
|
266
266
|
var oTableBuilder = this.getBuilder(),
|
|
267
267
|
vActionMatcher = this.createActionMatcher(vActionIdentifier),
|
|
268
268
|
vAggregationMatcher = FEBuilder.Matchers.deepAggregationMatcher("actions/action", [
|
|
@@ -301,7 +301,7 @@ sap.ui.define(
|
|
|
301
301
|
*
|
|
302
302
|
* @public
|
|
303
303
|
*/
|
|
304
|
-
TableAssertions.prototype.iCheckMenuAction = function(vAction) {
|
|
304
|
+
TableAssertions.prototype.iCheckMenuAction = function (vAction) {
|
|
305
305
|
return this.prepareResult(APIHelper.createMenuActionCheckBuilder(vAction).execute());
|
|
306
306
|
};
|
|
307
307
|
|
|
@@ -313,7 +313,7 @@ sap.ui.define(
|
|
|
313
313
|
*
|
|
314
314
|
* @public
|
|
315
315
|
*/
|
|
316
|
-
TableAssertions.prototype.iCheckDelete = function(mState) {
|
|
316
|
+
TableAssertions.prototype.iCheckDelete = function (mState) {
|
|
317
317
|
return this.iCheckAction({ service: "StandardAction", action: "Delete", unbound: true }, mState);
|
|
318
318
|
};
|
|
319
319
|
|
|
@@ -326,7 +326,7 @@ sap.ui.define(
|
|
|
326
326
|
*
|
|
327
327
|
* @public
|
|
328
328
|
*/
|
|
329
|
-
TableAssertions.prototype.iCheckSearchField = function(sSearchText, mState) {
|
|
329
|
+
TableAssertions.prototype.iCheckSearchField = function (sSearchText, mState) {
|
|
330
330
|
var aArguments = Utils.parseArguments([String, Object], arguments),
|
|
331
331
|
oTableBuilder = this.getBuilder();
|
|
332
332
|
return this.prepareResult(
|
|
@@ -352,7 +352,7 @@ sap.ui.define(
|
|
|
352
352
|
*
|
|
353
353
|
* @public
|
|
354
354
|
*/
|
|
355
|
-
TableAssertions.prototype.iCheckCreate = function(mState) {
|
|
355
|
+
TableAssertions.prototype.iCheckCreate = function (mState) {
|
|
356
356
|
return this.iCheckAction({ service: "StandardAction", action: "Create", unbound: true }, mState);
|
|
357
357
|
};
|
|
358
358
|
|
|
@@ -363,7 +363,7 @@ sap.ui.define(
|
|
|
363
363
|
*
|
|
364
364
|
* @public
|
|
365
365
|
*/
|
|
366
|
-
TableAssertions.prototype.iCheckPaste = function() {
|
|
366
|
+
TableAssertions.prototype.iCheckPaste = function () {
|
|
367
367
|
return this._iCheckTableProvidedAction("Paste");
|
|
368
368
|
};
|
|
369
369
|
|
|
@@ -375,11 +375,11 @@ sap.ui.define(
|
|
|
375
375
|
*
|
|
376
376
|
* @public
|
|
377
377
|
*/
|
|
378
|
-
TableAssertions.prototype.iCheckFullScreen = function(mState) {
|
|
378
|
+
TableAssertions.prototype.iCheckFullScreen = function (mState) {
|
|
379
379
|
return this.iCheckAction({ service: "StandardAction", action: "FullScreen", unbound: true }, mState);
|
|
380
380
|
};
|
|
381
381
|
|
|
382
|
-
TableAssertions.prototype._iCheckTableProvidedAction = function(sProvidedAction) {
|
|
382
|
+
TableAssertions.prototype._iCheckTableProvidedAction = function (sProvidedAction) {
|
|
383
383
|
var oTableBuilder = this.getBuilder();
|
|
384
384
|
return this.prepareResult(
|
|
385
385
|
oTableBuilder["has" + sProvidedAction]()
|
|
@@ -397,7 +397,7 @@ sap.ui.define(
|
|
|
397
397
|
*
|
|
398
398
|
* @public
|
|
399
399
|
*/
|
|
400
|
-
TableAssertions.prototype.iCheckColumnAdaptation = function() {
|
|
400
|
+
TableAssertions.prototype.iCheckColumnAdaptation = function () {
|
|
401
401
|
return this._iCheckTableProvidedAction("ColumnAdaptation");
|
|
402
402
|
};
|
|
403
403
|
|
|
@@ -408,7 +408,7 @@ sap.ui.define(
|
|
|
408
408
|
*
|
|
409
409
|
* @public
|
|
410
410
|
*/
|
|
411
|
-
TableAssertions.prototype.iCheckColumnSorting = function() {
|
|
411
|
+
TableAssertions.prototype.iCheckColumnSorting = function () {
|
|
412
412
|
this.iOpenColumnSorting();
|
|
413
413
|
TableBuilder.createSortingDialogBuilder(this.getOpaInstance()).execute();
|
|
414
414
|
return this.iConfirmColumnSorting();
|
|
@@ -421,7 +421,7 @@ sap.ui.define(
|
|
|
421
421
|
*
|
|
422
422
|
* @public
|
|
423
423
|
*/
|
|
424
|
-
TableAssertions.prototype.iCheckColumnFiltering = function() {
|
|
424
|
+
TableAssertions.prototype.iCheckColumnFiltering = function () {
|
|
425
425
|
this.iOpenFilterDialog();
|
|
426
426
|
TableBuilder.createFilteringDialogBuilder(this.getOpaInstance()).execute();
|
|
427
427
|
return this.iConfirmFilterDialog();
|
|
@@ -435,7 +435,7 @@ sap.ui.define(
|
|
|
435
435
|
*
|
|
436
436
|
* @public
|
|
437
437
|
*/
|
|
438
|
-
TableAssertions.prototype.iCheckExport = function() {
|
|
438
|
+
TableAssertions.prototype.iCheckExport = function () {
|
|
439
439
|
return this._iCheckTableProvidedAction("ColumnExport");
|
|
440
440
|
};
|
|
441
441
|
|
|
@@ -447,7 +447,7 @@ sap.ui.define(
|
|
|
447
447
|
*
|
|
448
448
|
* @public
|
|
449
449
|
*/
|
|
450
|
-
TableAssertions.prototype.iCheckQuickFilter = function(mState) {
|
|
450
|
+
TableAssertions.prototype.iCheckQuickFilter = function (mState) {
|
|
451
451
|
var oTableBuilder = this.getBuilder();
|
|
452
452
|
return this.prepareResult(
|
|
453
453
|
oTableBuilder
|
|
@@ -470,7 +470,7 @@ sap.ui.define(
|
|
|
470
470
|
*
|
|
471
471
|
* @public
|
|
472
472
|
*/
|
|
473
|
-
TableAssertions.prototype.iCheckColumnAdaptationDialog = function() {
|
|
473
|
+
TableAssertions.prototype.iCheckColumnAdaptationDialog = function () {
|
|
474
474
|
var oAdaptationDialogBuilder = TableBuilder.createAdaptationDialogBuilder(this.getOpaInstance());
|
|
475
475
|
return this.prepareResult(
|
|
476
476
|
oAdaptationDialogBuilder
|
|
@@ -488,7 +488,7 @@ sap.ui.define(
|
|
|
488
488
|
*
|
|
489
489
|
* @public
|
|
490
490
|
*/
|
|
491
|
-
TableAssertions.prototype.iCheckAdaptationColumn = function(vColumnIdentifier, mState) {
|
|
491
|
+
TableAssertions.prototype.iCheckAdaptationColumn = function (vColumnIdentifier, mState) {
|
|
492
492
|
return this.columnAdaptation(
|
|
493
493
|
vColumnIdentifier,
|
|
494
494
|
mState,
|
|
@@ -512,7 +512,7 @@ sap.ui.define(
|
|
|
512
512
|
*
|
|
513
513
|
* @public
|
|
514
514
|
*/
|
|
515
|
-
TableAssertions.prototype.iCheckSortOrder = function(vColumnIdentifier, sSortOrder, bCheckPersonalization) {
|
|
515
|
+
TableAssertions.prototype.iCheckSortOrder = function (vColumnIdentifier, sSortOrder, bCheckPersonalization) {
|
|
516
516
|
var aArguments = Utils.parseArguments([[String, Object], String, Boolean], arguments);
|
|
517
517
|
sSortOrder = aArguments[1] || SortOrder.Ascending;
|
|
518
518
|
bCheckPersonalization = aArguments[2];
|
|
@@ -536,12 +536,7 @@ sap.ui.define(
|
|
|
536
536
|
mColumnDefinition[Utils.isOfType(vColumnIdentifier, Object) ? vColumnIdentifier.name : vColumnIdentifier] = {
|
|
537
537
|
sortOrder: sSortOrder
|
|
538
538
|
};
|
|
539
|
-
return this.prepareResult(
|
|
540
|
-
this.getBuilder()
|
|
541
|
-
.hasColumns(mColumnDefinition)
|
|
542
|
-
.description(sDescription)
|
|
543
|
-
.execute()
|
|
544
|
-
);
|
|
539
|
+
return this.prepareResult(this.getBuilder().hasColumns(mColumnDefinition).description(sDescription).execute());
|
|
545
540
|
};
|
|
546
541
|
|
|
547
542
|
/**
|
|
@@ -553,7 +548,7 @@ sap.ui.define(
|
|
|
553
548
|
*
|
|
554
549
|
* @public
|
|
555
550
|
*/
|
|
556
|
-
TableAssertions.prototype.iCheckFilterField = function(vColumnIdentifier, mState) {
|
|
551
|
+
TableAssertions.prototype.iCheckFilterField = function (vColumnIdentifier, mState) {
|
|
557
552
|
var oFilterFieldBuilder = FilterFieldBuilder.create(this.getOpaInstance())
|
|
558
553
|
.isDialogElement()
|
|
559
554
|
.hasType("sap.ui.mdc.FilterField")
|
|
@@ -574,9 +569,9 @@ sap.ui.define(
|
|
|
574
569
|
fnCloseDialog = this.iConfirmFilterDialog.bind(this);
|
|
575
570
|
|
|
576
571
|
if (bCheckForNotVisible) {
|
|
577
|
-
oFilterFieldBuilder.check(function(aFoundFilterFields) {
|
|
572
|
+
oFilterFieldBuilder.check(function (aFoundFilterFields) {
|
|
578
573
|
// every field should not match name/fieldPath
|
|
579
|
-
return aFoundFilterFields.every(function(oFilterField) {
|
|
574
|
+
return aFoundFilterFields.every(function (oFilterField) {
|
|
580
575
|
return OpaBuilder.Matchers.not(oFilterFieldMatcher)(oFilterField);
|
|
581
576
|
});
|
|
582
577
|
});
|
|
@@ -589,7 +584,7 @@ sap.ui.define(
|
|
|
589
584
|
|
|
590
585
|
return this.prepareResult(
|
|
591
586
|
FEBuilder.create(this.getOpaInstance())
|
|
592
|
-
.success(function() {
|
|
587
|
+
.success(function () {
|
|
593
588
|
bDialogOpen = FEBuilder.controlsExist(oFilterFieldBuilder);
|
|
594
589
|
if (!bDialogOpen) {
|
|
595
590
|
fnOpenDialog();
|
|
@@ -608,17 +603,11 @@ sap.ui.define(
|
|
|
608
603
|
*
|
|
609
604
|
* @public
|
|
610
605
|
*/
|
|
611
|
-
TableAssertions.prototype.iCheckMessageStrip = function(mProperty) {
|
|
606
|
+
TableAssertions.prototype.iCheckMessageStrip = function (mProperty) {
|
|
612
607
|
var oTableBuilder = this.getBuilder();
|
|
613
608
|
return this.prepareResult(
|
|
614
609
|
oTableBuilder
|
|
615
|
-
.has(
|
|
616
|
-
OpaBuilder.Matchers.childrenMatcher(
|
|
617
|
-
FEBuilder.create(this)
|
|
618
|
-
.hasType("sap.m.MessageStrip")
|
|
619
|
-
.hasProperties(mProperty)
|
|
620
|
-
)
|
|
621
|
-
)
|
|
610
|
+
.has(OpaBuilder.Matchers.childrenMatcher(FEBuilder.create(this).hasType("sap.m.MessageStrip").hasProperties(mProperty)))
|
|
622
611
|
.description(
|
|
623
612
|
Utils.formatMessage(
|
|
624
613
|
"Checking table '{0}' having a MessageStrip with text ='{1}' and type ='{2}'",
|
|
@@ -631,6 +620,22 @@ sap.ui.define(
|
|
|
631
620
|
);
|
|
632
621
|
};
|
|
633
622
|
|
|
623
|
+
/**
|
|
624
|
+
* Checks if the focus is on a table.
|
|
625
|
+
* @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
|
|
626
|
+
*
|
|
627
|
+
* @public
|
|
628
|
+
*/
|
|
629
|
+
TableAssertions.prototype.iSeeFocusOnHeader = function () {
|
|
630
|
+
var oTableBuilder = this.getBuilder();
|
|
631
|
+
return this.prepareResult(
|
|
632
|
+
oTableBuilder
|
|
633
|
+
.hasHeaderFocused()
|
|
634
|
+
.description(Utils.formatMessage("Checking focus on table '{0}' ", this.getIdentifier()))
|
|
635
|
+
.execute()
|
|
636
|
+
);
|
|
637
|
+
};
|
|
638
|
+
|
|
634
639
|
/**
|
|
635
640
|
* Checks if a given column supports grouping.
|
|
636
641
|
* If <code>iExpectedNumber</code> and <code>sFieldLabel</code> are not provided, we just check that the column header has a group icon.
|
|
@@ -642,7 +647,7 @@ sap.ui.define(
|
|
|
642
647
|
* @param {string} sFieldLabel The target field to group on in case of a complex property
|
|
643
648
|
* @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
|
|
644
649
|
*/
|
|
645
|
-
TableAssertions.prototype.iCheckGroupByColumn = function(vColumnIdentifier, iExpectedNumber, sFieldLabel) {
|
|
650
|
+
TableAssertions.prototype.iCheckGroupByColumn = function (vColumnIdentifier, iExpectedNumber, sFieldLabel) {
|
|
646
651
|
var oTableBuilder = this.getBuilder(),
|
|
647
652
|
vColumn = Utils.isOfType(vColumnIdentifier, Object) ? vColumnIdentifier.name : vColumnIdentifier;
|
|
648
653
|
return this.prepareResult(
|
|
@@ -672,7 +677,7 @@ sap.ui.define(
|
|
|
672
677
|
* @param {string} sFieldLabel The target field to aggregate on in case of a complex property
|
|
673
678
|
* @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
|
|
674
679
|
*/
|
|
675
|
-
TableAssertions.prototype.iCheckAggregationColumn = function(vColumnIdentifier, iExpectedNumber, sFieldLabel) {
|
|
680
|
+
TableAssertions.prototype.iCheckAggregationColumn = function (vColumnIdentifier, iExpectedNumber, sFieldLabel) {
|
|
676
681
|
var oTableBuilder = this.getBuilder(),
|
|
677
682
|
vColumn = Utils.isOfType(vColumnIdentifier, Object) ? vColumnIdentifier.name : vColumnIdentifier;
|
|
678
683
|
return this.prepareResult(
|
|
@@ -691,7 +696,7 @@ sap.ui.define(
|
|
|
691
696
|
);
|
|
692
697
|
};
|
|
693
698
|
|
|
694
|
-
TableAssertions.prototype.iCheckTitle = function(sTitle) {
|
|
699
|
+
TableAssertions.prototype.iCheckTitle = function (sTitle) {
|
|
695
700
|
var oTableBuilder = this.getBuilder();
|
|
696
701
|
|
|
697
702
|
return this.prepareResult(
|
|
@@ -3,177 +3,182 @@
|
|
|
3
3
|
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
4
|
|
|
5
5
|
*/
|
|
6
|
-
sap.ui.define(
|
|
7
|
-
FEBuilder,
|
|
8
|
-
FieldBuilder,
|
|
9
|
-
|
|
10
|
-
Utils
|
|
11
|
-
) {
|
|
12
|
-
"use strict";
|
|
6
|
+
sap.ui.define(
|
|
7
|
+
["./FEBuilder", "./MdcFieldBuilder", "sap/ui/test/OpaBuilder", "sap/fe/test/Utils"],
|
|
8
|
+
function (FEBuilder, FieldBuilder, OpaBuilder, Utils) {
|
|
9
|
+
"use strict";
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
11
|
+
function _getValueMatcher(oControl, vExpectedValue) {
|
|
12
|
+
if (oControl.isA("sap.ui.mdc.Field")) {
|
|
13
|
+
return FieldBuilder.Matchers.value(vExpectedValue);
|
|
14
|
+
}
|
|
15
|
+
if (oControl.isA("sap.ui.unified.Currency")) {
|
|
16
|
+
return OpaBuilder.Matchers.properties({ stringValue: vExpectedValue.stringValue, currency: vExpectedValue.description });
|
|
17
|
+
}
|
|
18
|
+
var sExpectedValue = vExpectedValue;
|
|
19
|
+
// we should avoid using the value description syntax when using non MDC controls but this is a workaround to have it working
|
|
20
|
+
if (vExpectedValue.value) {
|
|
21
|
+
sExpectedValue = vExpectedValue.description
|
|
22
|
+
? vExpectedValue.description + " (" + vExpectedValue.value + ")"
|
|
23
|
+
: vExpectedValue.value;
|
|
24
|
+
}
|
|
25
|
+
if (oControl.isA("sap.m.InputBase")) {
|
|
26
|
+
return OpaBuilder.Matchers.properties({ value: sExpectedValue });
|
|
27
|
+
}
|
|
28
|
+
if (oControl.isA("sap.m.ObjectIdentifier")) {
|
|
29
|
+
return OpaBuilder.Matchers.properties({ title: sExpectedValue });
|
|
30
|
+
}
|
|
31
|
+
return OpaBuilder.Matchers.properties({ text: sExpectedValue });
|
|
33
32
|
}
|
|
34
|
-
return OpaBuilder.Matchers.properties({ text: sExpectedValue });
|
|
35
|
-
}
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
function _getStateMatcher(oControl, sName, vValue) {
|
|
35
|
+
if (oControl.isA("sap.ui.mdc.Field")) {
|
|
36
|
+
return FieldBuilder.Matchers.state(sName, vValue);
|
|
37
|
+
} else if (sName === "lockedBy") {
|
|
38
|
+
return function (oControl) {
|
|
39
|
+
var oMatcher = OpaBuilder.Matchers.childrenMatcher(
|
|
40
|
+
FEBuilder.create(this).hasType("sap.m.Avatar").hasProperties({ initials: vValue })
|
|
41
|
+
);
|
|
42
|
+
return FEBuilder.Matchers.match(oMatcher)(oControl);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return FEBuilder.Matchers.state(sName, vValue);
|
|
40
46
|
}
|
|
41
|
-
return FEBuilder.Matchers.state(sName, vValue);
|
|
42
|
-
}
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
function _getMainControls(oContent) {
|
|
49
|
+
if (oContent.isA("sap.fe.macros.FieldAPI")) {
|
|
50
|
+
return _getMainControls(oContent.getContent());
|
|
51
|
+
}
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
if (oContent.isA("sap.fe.core.controls.FileWrapper")) {
|
|
54
|
-
return _getMainControls(oContent.getAvatar());
|
|
55
|
-
}
|
|
56
|
-
if (oContent.isA("sap.fe.core.controls.FieldWrapper")) {
|
|
57
|
-
if (oContent.getEditMode() === "Display") {
|
|
58
|
-
return _getMainControls(oContent.getContentDisplay());
|
|
59
|
-
} else {
|
|
60
|
-
return _getMainControls(oContent.getContentEdit()[0]);
|
|
53
|
+
if (oContent.isA("sap.fe.core.controls.FormElementWrapper")) {
|
|
54
|
+
// we need to do this to be able to retrieve the child of the FormElementWrapper when its child is not visible
|
|
55
|
+
return _getMainControls(oContent.getContent());
|
|
61
56
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
if (oContent.isA("sap.fe.core.controls.FileWrapper")) {
|
|
58
|
+
return _getMainControls(oContent.getAvatar());
|
|
59
|
+
}
|
|
60
|
+
if (oContent.isA("sap.fe.core.controls.FieldWrapper")) {
|
|
61
|
+
if (oContent.getEditMode() === "Display") {
|
|
62
|
+
return _getMainControls(oContent.getContentDisplay());
|
|
63
|
+
} else {
|
|
64
|
+
return _getMainControls(oContent.getContentEdit()[0]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (oContent.isA("sap.fe.core.controls.ConditionalWrapper")) {
|
|
68
|
+
var oLink = oContent.getCondition() ? oContent.getContentTrue() : oContent.getContentFalse();
|
|
69
|
+
return _getMainControls(oLink);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return oContent.isA("sap.ui.mdc.Field") ||
|
|
73
|
+
oContent.isA("sap.m.Text") ||
|
|
74
|
+
oContent.isA("sap.m.ExpandableText") ||
|
|
75
|
+
oContent.isA("sap.m.Label") ||
|
|
76
|
+
oContent.isA("sap.m.CheckBox") ||
|
|
77
|
+
oContent.isA("sap.m.Link") ||
|
|
78
|
+
oContent.isA("sap.m.ObjectStatus") ||
|
|
79
|
+
oContent.isA("sap.m.InputBase") ||
|
|
80
|
+
oContent.isA("sap.m.Avatar") ||
|
|
81
|
+
oContent.isA("sap.ui.unified.Currency") ||
|
|
82
|
+
oContent.isA("sap.m.ObjectIdentifier") ||
|
|
83
|
+
oContent.isA("sap.m.RatingIndicator") ||
|
|
84
|
+
oContent.isA("sap.m.ProgressIndicator")
|
|
85
|
+
? [oContent]
|
|
86
|
+
: OpaBuilder.Matchers.children(
|
|
87
|
+
OpaBuilder.create().hasSome(
|
|
88
|
+
FEBuilder.Matchers.state("controlType", "sap.ui.mdc.Field"),
|
|
89
|
+
FEBuilder.Matchers.state("controlType", "sap.m.Text"),
|
|
90
|
+
FEBuilder.Matchers.state("controlType", "sap.m.ExpandableText"),
|
|
91
|
+
FEBuilder.Matchers.state("controlType", "sap.m.Label"),
|
|
92
|
+
FEBuilder.Matchers.state("controlType", "sap.m.Link"),
|
|
93
|
+
FEBuilder.Matchers.state("controlType", "sap.m.ObjectStatus"),
|
|
94
|
+
FEBuilder.Matchers.state("controlType", "sap.m.InputBase"),
|
|
95
|
+
FEBuilder.Matchers.state("controlType", "sap.m.Avatar"),
|
|
96
|
+
FEBuilder.Matchers.state("controlType", "sap.ui.unified.Currency"),
|
|
97
|
+
FEBuilder.Matchers.state("controlType", "sap.m.ObjectIdentifier"),
|
|
98
|
+
FEBuilder.Matchers.state("controlType", "sap.m.RatingIndicator"),
|
|
99
|
+
FEBuilder.Matchers.state("controlType", "sap.m.ProgressIndicator")
|
|
100
|
+
)
|
|
101
|
+
)(oContent);
|
|
66
102
|
}
|
|
67
103
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
oContent.isA("sap.m.Label") ||
|
|
72
|
-
oContent.isA("sap.m.CheckBox") ||
|
|
73
|
-
oContent.isA("sap.m.Link") ||
|
|
74
|
-
oContent.isA("sap.m.ObjectStatus") ||
|
|
75
|
-
oContent.isA("sap.m.InputBase") ||
|
|
76
|
-
oContent.isA("sap.m.Avatar") ||
|
|
77
|
-
oContent.isA("sap.ui.unified.Currency") ||
|
|
78
|
-
oContent.isA("sap.m.ObjectIdentifier") ||
|
|
79
|
-
oContent.isA("sap.m.RatingIndicator") ||
|
|
80
|
-
oContent.isA("sap.m.ProgressIndicator")
|
|
81
|
-
? [oContent]
|
|
82
|
-
: OpaBuilder.Matchers.children(
|
|
83
|
-
OpaBuilder.create().hasSome(
|
|
84
|
-
FEBuilder.Matchers.state("controlType", "sap.ui.mdc.Field"),
|
|
85
|
-
FEBuilder.Matchers.state("controlType", "sap.m.Text"),
|
|
86
|
-
FEBuilder.Matchers.state("controlType", "sap.m.ExpandableText"),
|
|
87
|
-
FEBuilder.Matchers.state("controlType", "sap.m.Label"),
|
|
88
|
-
FEBuilder.Matchers.state("controlType", "sap.m.Link"),
|
|
89
|
-
FEBuilder.Matchers.state("controlType", "sap.m.ObjectStatus"),
|
|
90
|
-
FEBuilder.Matchers.state("controlType", "sap.m.InputBase"),
|
|
91
|
-
FEBuilder.Matchers.state("controlType", "sap.m.Avatar"),
|
|
92
|
-
FEBuilder.Matchers.state("controlType", "sap.ui.unified.Currency"),
|
|
93
|
-
FEBuilder.Matchers.state("controlType", "sap.m.ObjectIdentifier"),
|
|
94
|
-
FEBuilder.Matchers.state("controlType", "sap.m.RatingIndicator"),
|
|
95
|
-
FEBuilder.Matchers.state("controlType", "sap.m.ProgressIndicator")
|
|
96
|
-
)
|
|
97
|
-
)(oContent);
|
|
98
|
-
}
|
|
104
|
+
var MacroFieldBuilder = function () {
|
|
105
|
+
return FEBuilder.apply(this, arguments);
|
|
106
|
+
};
|
|
99
107
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
MacroFieldBuilder.create = function (oOpaInstance) {
|
|
109
|
+
return new MacroFieldBuilder(oOpaInstance);
|
|
110
|
+
};
|
|
103
111
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
112
|
+
MacroFieldBuilder.prototype = Object.create(FEBuilder.prototype);
|
|
113
|
+
MacroFieldBuilder.prototype.constructor = MacroFieldBuilder;
|
|
107
114
|
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Returns the state matcher for the MdcField control.
|
|
117
|
+
* @param mState
|
|
118
|
+
* @returns {*}
|
|
119
|
+
* @protected
|
|
120
|
+
*/
|
|
121
|
+
MacroFieldBuilder.prototype.getStatesMatcher = function (mState) {
|
|
122
|
+
return MacroFieldBuilder.Matchers.states(mState);
|
|
123
|
+
};
|
|
110
124
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return MacroFieldBuilder.Matchers.states(mState);
|
|
119
|
-
};
|
|
125
|
+
MacroFieldBuilder.prototype.hasValue = function (vValue) {
|
|
126
|
+
// silently ignore undefined argument for convenience
|
|
127
|
+
if (vValue === undefined) {
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
return this.has(MacroFieldBuilder.Matchers.value(vValue));
|
|
131
|
+
};
|
|
120
132
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
133
|
+
MacroFieldBuilder.prototype.do = function (vAction) {
|
|
134
|
+
// whenever an action is performed on a MacroField we want it to be perform on its main control
|
|
135
|
+
this.has(function (vControls) {
|
|
136
|
+
if (!vControls) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
if (!Array.isArray(vControls)) {
|
|
140
|
+
vControls = [vControls];
|
|
141
|
+
}
|
|
142
|
+
return vControls.reduce(function (aMainControls, vControl) {
|
|
143
|
+
return aMainControls.concat(_getMainControls(vControl));
|
|
144
|
+
}, []);
|
|
145
|
+
});
|
|
146
|
+
return FEBuilder.prototype.do.call(this, OpaBuilder.Actions.executor(vAction));
|
|
147
|
+
};
|
|
128
148
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
vControls = [vControls];
|
|
137
|
-
}
|
|
138
|
-
return vControls.reduce(function(aMainControls, vControl) {
|
|
139
|
-
return aMainControls.concat(_getMainControls(vControl));
|
|
140
|
-
}, []);
|
|
141
|
-
});
|
|
142
|
-
return FEBuilder.prototype.do.call(this, OpaBuilder.Actions.executor(vAction));
|
|
143
|
-
};
|
|
149
|
+
MacroFieldBuilder.prototype.doOpenValueHelp = function () {
|
|
150
|
+
return this.do(function (oControl) {
|
|
151
|
+
if (oControl.isA("sap.ui.mdc.Field")) {
|
|
152
|
+
FEBuilder.Actions.keyboardShortcut("F4", "input")(oControl);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
};
|
|
144
156
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
157
|
+
MacroFieldBuilder.Matchers = {
|
|
158
|
+
value: function (vExpectedValue) {
|
|
159
|
+
return function (oControl) {
|
|
160
|
+
var aMainControls = _getMainControls(oControl);
|
|
161
|
+
return aMainControls.some(function (oMainControl) {
|
|
162
|
+
return OpaBuilder.Matchers.match(_getValueMatcher(oMainControl, vExpectedValue))(oMainControl);
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
empty: function (oControl) {
|
|
167
|
+
return oControl.getVisible() === false;
|
|
168
|
+
},
|
|
169
|
+
state: function (sName, vValue) {
|
|
170
|
+
return function (oControl) {
|
|
171
|
+
var aMainControls = [oControl].concat(_getMainControls(oControl));
|
|
172
|
+
return aMainControls.some(function (oMainControl) {
|
|
173
|
+
return OpaBuilder.Matchers.match(_getStateMatcher(oMainControl, sName, vValue))(oMainControl);
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
},
|
|
177
|
+
states: function (mStateMap) {
|
|
178
|
+
return FEBuilder.Matchers.states(mStateMap, MacroFieldBuilder.Matchers.state);
|
|
149
179
|
}
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
MacroFieldBuilder.Matchers = {
|
|
154
|
-
value: function(vExpectedValue) {
|
|
155
|
-
return function(oControl) {
|
|
156
|
-
var aMainControls = _getMainControls(oControl);
|
|
157
|
-
return aMainControls.some(function(oMainControl) {
|
|
158
|
-
return OpaBuilder.Matchers.match(_getValueMatcher(oMainControl, vExpectedValue))(oMainControl);
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
},
|
|
162
|
-
empty: function(oControl) {
|
|
163
|
-
return oControl.getVisible() === false;
|
|
164
|
-
},
|
|
165
|
-
state: function(sName, vValue) {
|
|
166
|
-
return function(oControl) {
|
|
167
|
-
var aMainControls = [oControl].concat(_getMainControls(oControl));
|
|
168
|
-
return aMainControls.some(function(oMainControl) {
|
|
169
|
-
return OpaBuilder.Matchers.match(_getStateMatcher(oMainControl, sName, vValue))(oMainControl);
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
},
|
|
173
|
-
states: function(mStateMap) {
|
|
174
|
-
return FEBuilder.Matchers.states(mStateMap, MacroFieldBuilder.Matchers.state);
|
|
175
|
-
}
|
|
176
|
-
};
|
|
180
|
+
};
|
|
177
181
|
|
|
178
|
-
|
|
179
|
-
}
|
|
182
|
+
return MacroFieldBuilder;
|
|
183
|
+
}
|
|
184
|
+
);
|