@sapui5/sap.fe.test 1.96.4 → 1.99.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 +6 -3
- package/src/sap/fe/test/.library +1 -1
- package/src/sap/fe/test/BaseActions.js +3 -2
- package/src/sap/fe/test/BaseArrangements.js +3 -2
- package/src/sap/fe/test/BaseAssertions.js +3 -2
- package/src/sap/fe/test/ConfirmDialog.js +3 -2
- package/src/sap/fe/test/FCLView.js +3 -2
- package/src/sap/fe/test/FeMocks.js +66 -0
- package/src/sap/fe/test/FeMocks.ts +77 -0
- package/src/sap/fe/test/Flexibility.js +17 -5
- package/src/sap/fe/test/FlexibleColumnLayout.js +3 -2
- package/src/sap/fe/test/JestTemplatingHelper.js +78 -22
- package/src/sap/fe/test/JestTemplatingHelper.ts +66 -22
- package/src/sap/fe/test/JourneyRunner.js +11 -5
- package/src/sap/fe/test/ListReport.js +11 -16
- package/src/sap/fe/test/LocationUtil.js +3 -2
- package/src/sap/fe/test/ObjectPage.js +28 -55
- package/src/sap/fe/test/Shell.js +3 -2
- package/src/sap/fe/test/Stubs.js +3 -2
- package/src/sap/fe/test/TemplatePage.js +3 -14
- package/src/sap/fe/test/TemplatingTestUtils.js +4 -3
- package/src/sap/fe/test/UI5MockHelper.js +249 -39
- package/src/sap/fe/test/UI5MockHelper.ts +138 -9
- package/src/sap/fe/test/Utils.js +3 -14
- package/src/sap/fe/test/api/APIHelper.js +3 -2
- package/src/sap/fe/test/api/BaseAPI.js +26 -9
- package/src/sap/fe/test/api/ChartActions.js +3 -2
- package/src/sap/fe/test/api/ChartAssertions.js +7 -6
- package/src/sap/fe/test/api/DialogAPI.js +26 -9
- package/src/sap/fe/test/api/DialogActions.js +21 -7
- package/src/sap/fe/test/api/DialogAssertions.js +28 -7
- package/src/sap/fe/test/api/DialogCreateActions.js +4 -3
- package/src/sap/fe/test/api/DialogCreateAssertions.js +4 -3
- package/src/sap/fe/test/api/DialogMessageActions.js +19 -3
- package/src/sap/fe/test/api/DialogMessageAssertions.js +4 -3
- package/src/sap/fe/test/api/DialogType.js +3 -2
- package/src/sap/fe/test/api/DialogValueHelpActions.js +4 -3
- package/src/sap/fe/test/api/DialogValueHelpAssertions.js +4 -3
- package/src/sap/fe/test/api/EditState.js +12 -2
- package/src/sap/fe/test/api/FilterBarAPI.js +3 -2
- package/src/sap/fe/test/api/FilterBarActions.js +41 -6
- package/src/sap/fe/test/api/FilterBarAssertions.js +3 -2
- package/src/sap/fe/test/api/FooterAPI.js +3 -2
- package/src/sap/fe/test/api/FooterActionsBase.js +3 -2
- package/src/sap/fe/test/api/FooterActionsOP.js +3 -2
- package/src/sap/fe/test/api/FooterAssertionsBase.js +3 -2
- package/src/sap/fe/test/api/FooterAssertionsOP.js +3 -2
- package/src/sap/fe/test/api/FormAPI.js +3 -2
- package/src/sap/fe/test/api/FormActions.js +3 -2
- package/src/sap/fe/test/api/FormAssertions.js +36 -6
- package/src/sap/fe/test/api/HeaderAPI.js +3 -2
- package/src/sap/fe/test/api/HeaderActions.js +3 -2
- package/src/sap/fe/test/api/HeaderActionsLR.js +3 -2
- package/src/sap/fe/test/api/HeaderAssertions.js +3 -2
- package/src/sap/fe/test/api/HeaderAssertionsLR.js +3 -2
- package/src/sap/fe/test/api/HeaderLR.js +3 -2
- package/src/sap/fe/test/api/KPICardAPI.js +3 -2
- package/src/sap/fe/test/api/KPICardActions.js +43 -0
- package/src/sap/fe/test/api/KPICardAssertions.js +22 -17
- package/src/sap/fe/test/api/TableAPI.js +3 -2
- package/src/sap/fe/test/api/TableActions.js +4 -22
- package/src/sap/fe/test/api/TableAssertions.js +17 -6
- package/src/sap/fe/test/builder/DialogBuilder.js +3 -2
- package/src/sap/fe/test/builder/FEBuilder.js +3 -2
- package/src/sap/fe/test/builder/KPIBuilder.js +14 -4
- package/src/sap/fe/test/builder/MacroFieldBuilder.js +3 -2
- package/src/sap/fe/test/builder/MdcFieldBuilder.js +3 -2
- package/src/sap/fe/test/builder/MdcFilterBarBuilder.js +3 -2
- package/src/sap/fe/test/builder/MdcFilterFieldBuilder.js +3 -2
- package/src/sap/fe/test/builder/MdcTableBuilder.js +15 -2
- package/src/sap/fe/test/builder/OverflowToolbarBuilder.js +3 -2
- package/src/sap/fe/test/builder/VMBuilder.js +3 -2
- package/src/sap/fe/test/internal/FEArrangements.js +3 -2
- package/src/sap/fe/test/internal/FEJourneyRunner.js +9 -5
- package/src/sap/fe/test/library.js +4 -3
- package/src/sap/fe/test/massEdit.js +3 -2
- package/ui5.yaml +0 -3
|
@@ -1,18 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Mock class for a V4 Context
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
import
|
|
4
|
+
import Event from "sap/ui/base/Event";
|
|
5
|
+
import Control from "sap/ui/core/Control";
|
|
6
|
+
import UI5Element from "sap/ui/core/Element";
|
|
7
|
+
import Controller from "sap/ui/core/mvc/Controller";
|
|
8
|
+
import View from "sap/ui/core/mvc/View";
|
|
9
|
+
import Context from "sap/ui/model/odata/v4/Context";
|
|
10
|
+
import ODataListBinding from "sap/ui/model/odata/v4/ODataListBinding";
|
|
11
|
+
import ODataContextBinding from "sap/ui/model/odata/v4/ODataContextBinding";
|
|
12
|
+
import ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
|
|
13
|
+
import ODataModel from "sap/ui/model/odata/v4/ODataModel";
|
|
6
14
|
|
|
7
15
|
export class MockContext implements Partial<Context> {
|
|
8
|
-
public constructor(private oValues
|
|
16
|
+
public constructor(private oValues?: any, private oBinding?: any) {}
|
|
17
|
+
|
|
18
|
+
public isA(sClassName: string): boolean {
|
|
19
|
+
return sClassName === "sap.ui.model.odata.v4.Context";
|
|
20
|
+
}
|
|
9
21
|
|
|
10
22
|
public getProperty = jest.fn((key: string) => {
|
|
11
23
|
return this.oValues[key];
|
|
12
24
|
});
|
|
13
|
-
public
|
|
25
|
+
public setProperty = jest.fn((key: string, value: any) => {
|
|
26
|
+
this.oValues[key] = value;
|
|
14
27
|
return this.oValues[key];
|
|
15
28
|
});
|
|
29
|
+
|
|
30
|
+
public getObject = jest.fn((path: string) => {
|
|
31
|
+
const that = this as any;
|
|
32
|
+
let result = path ? that.oValues[path] : that.oValues;
|
|
33
|
+
|
|
34
|
+
if (!result && path && path.indexOf("/") > -1) {
|
|
35
|
+
const parts = path.split("/");
|
|
36
|
+
result = parts.reduce((sum, part: any) => {
|
|
37
|
+
sum = part ? sum[part] : sum;
|
|
38
|
+
return sum;
|
|
39
|
+
}, that.oValues);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return result;
|
|
43
|
+
});
|
|
16
44
|
public getPath = jest.fn(() => {
|
|
17
45
|
return this.oValues["$path"];
|
|
18
46
|
});
|
|
@@ -20,11 +48,33 @@ export class MockContext implements Partial<Context> {
|
|
|
20
48
|
public getBinding = jest.fn(() => {
|
|
21
49
|
return this.oBinding;
|
|
22
50
|
});
|
|
51
|
+
public getModel = jest.fn(() => {
|
|
52
|
+
return (this.oBinding?.getModel() as any) as ODataModel;
|
|
53
|
+
});
|
|
54
|
+
public isTransient = jest.fn();
|
|
23
55
|
}
|
|
24
56
|
|
|
25
|
-
export class
|
|
26
|
-
|
|
57
|
+
export class MockUI5Element implements Partial<UI5Element> {
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
public bindingContext = new MockContext({});
|
|
27
60
|
public getBinding = jest.fn();
|
|
61
|
+
public getBindingContext = jest.fn().mockReturnValue(this.bindingContext);
|
|
62
|
+
public getBindingInfo = jest.fn();
|
|
63
|
+
public data = jest.fn();
|
|
64
|
+
public getModel = jest.fn();
|
|
65
|
+
public getParent = jest.fn();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export class MockControl extends MockUI5Element implements Partial<Control> {
|
|
69
|
+
public getBindingContext: jest.Mock<any, any> = jest.fn();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export class MockEvent implements Partial<Event> {
|
|
73
|
+
public constructor(public params: { [key: string]: any } = {}, public source: MockUI5Element = new MockUI5Element()) {}
|
|
74
|
+
|
|
75
|
+
public getParameter = jest.fn(name => this.params[name]);
|
|
76
|
+
|
|
77
|
+
public getSource = jest.fn(() => this.source as any);
|
|
28
78
|
}
|
|
29
79
|
|
|
30
80
|
/**
|
|
@@ -33,7 +83,7 @@ export class MockControl {
|
|
|
33
83
|
export class MockListBinding implements Partial<ODataListBinding> {
|
|
34
84
|
private aMockContexts: MockContext[];
|
|
35
85
|
|
|
36
|
-
public constructor(aContexts?: any[]) {
|
|
86
|
+
public constructor(aContexts?: any[], private mockModel?: MockModel) {
|
|
37
87
|
aContexts = aContexts || [];
|
|
38
88
|
|
|
39
89
|
this.aMockContexts = aContexts.map(context => {
|
|
@@ -45,6 +95,10 @@ export class MockListBinding implements Partial<ODataListBinding> {
|
|
|
45
95
|
return sClassName === "sap.ui.model.odata.v4.ODataListBinding";
|
|
46
96
|
}
|
|
47
97
|
|
|
98
|
+
public setModel(oModel: MockModel) {
|
|
99
|
+
this.mockModel = oModel;
|
|
100
|
+
}
|
|
101
|
+
|
|
48
102
|
// Mocked API
|
|
49
103
|
public setAggregation = jest.fn();
|
|
50
104
|
public filter = jest.fn();
|
|
@@ -58,12 +112,15 @@ export class MockListBinding implements Partial<ODataListBinding> {
|
|
|
58
112
|
public getCurrentContexts = jest.fn((...args) => {
|
|
59
113
|
return (this.aMockContexts as any) as Context[];
|
|
60
114
|
});
|
|
115
|
+
public getModel = jest.fn(() => {
|
|
116
|
+
return (this.mockModel as any) as ODataModel;
|
|
117
|
+
});
|
|
61
118
|
}
|
|
62
119
|
|
|
63
120
|
export class MockContextBinding implements Partial<ODataContextBinding> {
|
|
64
121
|
private oMockContext: MockContext;
|
|
65
122
|
|
|
66
|
-
public constructor(oContext?: any) {
|
|
123
|
+
public constructor(oContext?: any, private mockModel?: MockModel) {
|
|
67
124
|
this.oMockContext = new MockContext(oContext || {}, this);
|
|
68
125
|
}
|
|
69
126
|
|
|
@@ -73,12 +130,18 @@ export class MockContextBinding implements Partial<ODataContextBinding> {
|
|
|
73
130
|
public getInternalMockContext(): MockContext {
|
|
74
131
|
return this.oMockContext;
|
|
75
132
|
}
|
|
133
|
+
public setModel(oModel: MockModel) {
|
|
134
|
+
this.mockModel = oModel;
|
|
135
|
+
}
|
|
76
136
|
|
|
77
137
|
// Mocked API
|
|
78
138
|
public getBoundContext = jest.fn(() => {
|
|
79
139
|
return (this.oMockContext as any) as Context;
|
|
80
140
|
});
|
|
81
141
|
public attachEventOnce = jest.fn();
|
|
142
|
+
public getModel = jest.fn(() => {
|
|
143
|
+
return (this.mockModel as any) as ODataModel;
|
|
144
|
+
});
|
|
82
145
|
}
|
|
83
146
|
|
|
84
147
|
/**
|
|
@@ -99,6 +162,12 @@ export class MockMetaModel implements Partial<ODataMetaModel> {
|
|
|
99
162
|
public getObject = jest.fn((sPath: string) => {
|
|
100
163
|
return this.oMetaContext.getProperty(sPath);
|
|
101
164
|
});
|
|
165
|
+
public requestObject = jest.fn();
|
|
166
|
+
public createBindingContext = jest.fn((sPath: string) => {
|
|
167
|
+
return (new MockContext({ $path: sPath }) as any) as Context;
|
|
168
|
+
});
|
|
169
|
+
public getMetaPath = jest.fn();
|
|
170
|
+
public getContext = jest.fn();
|
|
102
171
|
}
|
|
103
172
|
|
|
104
173
|
/**
|
|
@@ -108,7 +177,14 @@ export class MockMetaModel implements Partial<ODataMetaModel> {
|
|
|
108
177
|
export class MockModel implements Partial<ODataModel> {
|
|
109
178
|
private oMetaModel?: MockMetaModel;
|
|
110
179
|
|
|
111
|
-
public constructor(private mockListBinding?: MockListBinding, private mockContextBinding?: MockContextBinding) {
|
|
180
|
+
public constructor(private mockListBinding?: MockListBinding, private mockContextBinding?: MockContextBinding) {
|
|
181
|
+
if (mockListBinding) {
|
|
182
|
+
mockListBinding.setModel(this);
|
|
183
|
+
}
|
|
184
|
+
if (mockContextBinding) {
|
|
185
|
+
mockContextBinding.setModel(this);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
112
188
|
|
|
113
189
|
// Factories
|
|
114
190
|
static modelFromListBinding(mockListBinding: MockListBinding): MockModel {
|
|
@@ -134,4 +210,57 @@ export class MockModel implements Partial<ODataModel> {
|
|
|
134
210
|
public getMetaModel = jest.fn(() => {
|
|
135
211
|
return (this.oMetaModel as any) as ODataMetaModel;
|
|
136
212
|
});
|
|
213
|
+
|
|
214
|
+
public getProperty = jest.fn();
|
|
215
|
+
public setProperty = jest.fn();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export class MockView implements Partial<View> {
|
|
219
|
+
public getController = jest.fn();
|
|
220
|
+
|
|
221
|
+
public getModel = jest.fn();
|
|
222
|
+
|
|
223
|
+
public getViewData = jest.fn();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export class MockController implements Partial<Controller> {
|
|
227
|
+
public getView = jest.fn();
|
|
228
|
+
|
|
229
|
+
public _routing = {
|
|
230
|
+
navigateToTarget: jest.fn()
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
public _editFlow = {
|
|
234
|
+
syncTask: jest.fn()
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
public _sideEffects = {
|
|
238
|
+
handleFieldChange: jest.fn()
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
isA = jest.fn().mockReturnValue(false);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface MVCMock {
|
|
245
|
+
model: MockModel;
|
|
246
|
+
view: MockView;
|
|
247
|
+
controller: MockController;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Generate model, view and controller mocks that refer to each other.
|
|
252
|
+
*
|
|
253
|
+
* @param existing Optional existing mocked instances that should be used
|
|
254
|
+
* @returns Mocked model, view and controller instances
|
|
255
|
+
*/
|
|
256
|
+
export function mockMVC(existing?: Partial<MVCMock>): MVCMock {
|
|
257
|
+
const model = existing?.model || new MockModel();
|
|
258
|
+
const view = existing?.view || new MockView();
|
|
259
|
+
const controller = existing?.controller || new MockController();
|
|
260
|
+
|
|
261
|
+
view.getController.mockReturnValue(controller);
|
|
262
|
+
view.getModel.mockReturnValue(model);
|
|
263
|
+
controller.getView.mockReturnValue(view);
|
|
264
|
+
|
|
265
|
+
return { model, view, controller };
|
|
137
266
|
}
|
package/src/sap/fe/test/Utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* ! SAPUI5
|
|
3
|
-
|
|
2
|
+
* ! SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
4
5
|
*/
|
|
5
6
|
sap.ui.define(
|
|
6
7
|
[
|
|
@@ -287,18 +288,6 @@ sap.ui.define(
|
|
|
287
288
|
return vTarget;
|
|
288
289
|
};
|
|
289
290
|
|
|
290
|
-
Utils.getParametersArray = function(iStartIndex, aArguments) {
|
|
291
|
-
var aArguments = Array.prototype.slice.call(arguments, 1);
|
|
292
|
-
if (aArguments.length === 1 && Utils.isArguments(aArguments[0])) {
|
|
293
|
-
aArguments = Array.prototype.slice.call(aArguments[0], 0);
|
|
294
|
-
}
|
|
295
|
-
var aParameters = aArguments[iStartIndex];
|
|
296
|
-
if (aArguments.length > iStartIndex || (aParameters && !Array.isArray(aParameters))) {
|
|
297
|
-
aParameters = Array.prototype.slice.call(aArguments, iStartIndex);
|
|
298
|
-
}
|
|
299
|
-
return aParameters;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
291
|
return Utils;
|
|
303
292
|
}
|
|
304
293
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* ! SAPUI5
|
|
3
|
-
|
|
2
|
+
* ! SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
4
5
|
*/
|
|
5
6
|
sap.ui.define(["sap/fe/test/Utils", "sap/ui/test/OpaBuilder", "sap/fe/test/builder/FEBuilder"], function(Utils, OpaBuilder, FEBuilder) {
|
|
6
7
|
"use strict";
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* ! SAPUI5
|
|
3
|
-
|
|
2
|
+
* ! SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
4
5
|
*/
|
|
5
6
|
sap.ui.define(
|
|
6
|
-
[
|
|
7
|
-
"sap/fe/test/Utils",
|
|
8
|
-
"sap/ui/test/Opa5",
|
|
9
|
-
"sap/ui/test/OpaBuilder",
|
|
10
|
-
"sap/fe/test/builder/FEBuilder",
|
|
11
|
-
"sap/ui/mdc/p13n/panels/BasePanel"
|
|
12
|
-
],
|
|
7
|
+
["sap/fe/test/Utils", "sap/ui/test/Opa5", "sap/ui/test/OpaBuilder", "sap/fe/test/builder/FEBuilder", "sap/m/p13n/BasePanel"],
|
|
13
8
|
function(Utils, Opa5, OpaBuilder, FEBuilder, MdcP13nBasePanel) {
|
|
14
9
|
"use strict";
|
|
15
10
|
|
|
@@ -18,6 +13,7 @@ sap.ui.define(
|
|
|
18
13
|
*
|
|
19
14
|
* @typedef {object} TableIdentifier
|
|
20
15
|
* @property {string} property The name of the navigation property used for the table
|
|
16
|
+
* @property {string} [qualifier] The name of a qualifier for the table
|
|
21
17
|
*
|
|
22
18
|
* @name sap.fe.test.api.TableIdentifier
|
|
23
19
|
* @public
|
|
@@ -78,6 +74,27 @@ sap.ui.define(
|
|
|
78
74
|
* @public
|
|
79
75
|
*/
|
|
80
76
|
|
|
77
|
+
/**
|
|
78
|
+
* An dialog field identifier
|
|
79
|
+
*
|
|
80
|
+
* @typedef {object} DialogFieldIdentifier
|
|
81
|
+
* @property {string} property The name of the field
|
|
82
|
+
* In case of an action parameter dialog, this is the fieldname only
|
|
83
|
+
* <code><pre>
|
|
84
|
+
* {
|
|
85
|
+
* property: <fieldname>
|
|
86
|
+
* }
|
|
87
|
+
* </pre></code>
|
|
88
|
+
* In case of a create dialog, the concatenation of the entity and fieldname has to be provided
|
|
89
|
+
* <code><pre>
|
|
90
|
+
* {
|
|
91
|
+
* property: <entity>::<fieldname>
|
|
92
|
+
* }
|
|
93
|
+
* </pre></code>
|
|
94
|
+
* @name sap.fe.test.api.DialogFieldIdentifier
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
|
|
81
98
|
function _findParentChainFunction(oResult, sChainKeyword) {
|
|
82
99
|
var oAnd = oResult.and;
|
|
83
100
|
if (sChainKeyword in oAnd) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* ! SAPUI5
|
|
3
|
-
|
|
2
|
+
* ! SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
4
5
|
*/
|
|
5
6
|
sap.ui.define(["./BaseAPI", "sap/fe/test/Utils", "sap/ui/test/OpaBuilder", "sap/fe/test/builder/FEBuilder"], function(
|
|
6
7
|
BaseAPI,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* ! SAPUI5
|
|
3
|
-
|
|
2
|
+
* ! SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
4
5
|
*/
|
|
5
6
|
sap.ui.define(
|
|
6
7
|
["./BaseAPI", "sap/fe/test/Utils", "sap/ui/test/OpaBuilder", "sap/fe/test/builder/FEBuilder", "sap/ui/core/SortOrder"],
|
|
@@ -27,7 +28,7 @@ sap.ui.define(
|
|
|
27
28
|
|
|
28
29
|
ChartAssertions.prototype.iCheckItems = function(iNumberOfItems, sTab) {
|
|
29
30
|
return OpaBuilder.create(this)
|
|
30
|
-
.hasType("sap.ui.mdc.
|
|
31
|
+
.hasType("sap.ui.mdc.Chart")
|
|
31
32
|
.check(function(aCharts) {
|
|
32
33
|
var oChart;
|
|
33
34
|
if (sTab && aCharts && aCharts.length > 1) {
|
|
@@ -56,7 +57,7 @@ sap.ui.define(
|
|
|
56
57
|
|
|
57
58
|
ChartAssertions.prototype.iSeeChartType = function(sChartType) {
|
|
58
59
|
return OpaBuilder.create(this)
|
|
59
|
-
.hasType("sap.ui.mdc.
|
|
60
|
+
.hasType("sap.ui.mdc.Chart")
|
|
60
61
|
.check(function(oChart) {
|
|
61
62
|
return sChartType === oChart[0].getChartType();
|
|
62
63
|
}, true)
|
|
@@ -66,7 +67,7 @@ sap.ui.define(
|
|
|
66
67
|
|
|
67
68
|
ChartAssertions.prototype.iSeeChartVisible = function() {
|
|
68
69
|
return OpaBuilder.create(this)
|
|
69
|
-
.hasType("sap.ui.mdc.
|
|
70
|
+
.hasType("sap.ui.mdc.Chart")
|
|
70
71
|
.check(function(oChart) {
|
|
71
72
|
return oChart[0].getVisible() === true;
|
|
72
73
|
}, true)
|
|
@@ -103,7 +104,7 @@ sap.ui.define(
|
|
|
103
104
|
|
|
104
105
|
ChartAssertions.prototype.iCheckChartNoDataText = function(sNoDataText) {
|
|
105
106
|
return OpaBuilder.create(this)
|
|
106
|
-
.hasType("sap.ui.mdc.
|
|
107
|
+
.hasType("sap.ui.mdc.Chart")
|
|
107
108
|
.check(function(oChart) {
|
|
108
109
|
return sNoDataText === oChart[0].getNoDataText();
|
|
109
110
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* ! SAPUI5
|
|
3
|
-
|
|
2
|
+
* ! SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
4
5
|
*/
|
|
5
6
|
sap.ui.define(
|
|
6
7
|
[
|
|
@@ -28,25 +29,30 @@ sap.ui.define(
|
|
|
28
29
|
throw new Error("oDialogBuilder parameter must be a DialogBuilder instance");
|
|
29
30
|
}
|
|
30
31
|
this._iConfirmButtonIndex = iConfirmButtonIndex || 0;
|
|
32
|
+
this._iConfirmDiscardDraftButtonIndex = this._iConfirmButtonIndex + 1; // second button in the list
|
|
31
33
|
return BaseAPI.call(this, oDialogBuilder, vDialogDescription);
|
|
32
34
|
};
|
|
33
35
|
DialogAPI.prototype = Object.create(BaseAPI.prototype);
|
|
34
36
|
DialogAPI.prototype.constructor = DialogAPI;
|
|
35
37
|
|
|
36
38
|
/**
|
|
37
|
-
* Creates a matcher for fields within action dialogs.
|
|
39
|
+
* Creates a matcher for fields within create and action dialogs.
|
|
38
40
|
*
|
|
39
41
|
* @param {sap.fe.test.api.FieldIdentifier | string} vFieldIdentifier Identifier to be used for the matcher
|
|
42
|
+
* @param {object} oDialogIdentifier Identifier for the dialog (create/action)
|
|
40
43
|
*
|
|
41
44
|
* @returns {object} A matcher
|
|
42
45
|
*
|
|
43
46
|
* @private
|
|
44
47
|
*/
|
|
45
|
-
DialogAPI.prototype._createFieldMatcher = function(vFieldIdentifier) {
|
|
48
|
+
DialogAPI.prototype._createFieldMatcher = function(vFieldIdentifier, oDialogIdentifier) {
|
|
46
49
|
var vMatcher, sFieldId;
|
|
47
50
|
if (!Utils.isOfType(vFieldIdentifier, String)) {
|
|
48
51
|
if (typeof vFieldIdentifier.property === "string") {
|
|
49
|
-
sFieldId =
|
|
52
|
+
sFieldId =
|
|
53
|
+
oDialogIdentifier && oDialogIdentifier.type === "Create"
|
|
54
|
+
? "CreateDialog::" + vFieldIdentifier.property.replaceAll("/", "::")
|
|
55
|
+
: "APD_::" + vFieldIdentifier.property.replaceAll("/", "::");
|
|
50
56
|
} else {
|
|
51
57
|
throw new Error(
|
|
52
58
|
"The 'property' parameter for creating a control ID for a field in an action dialog is not supported: " +
|
|
@@ -61,12 +67,12 @@ sap.ui.define(
|
|
|
61
67
|
return vMatcher;
|
|
62
68
|
};
|
|
63
69
|
|
|
64
|
-
DialogAPI.prototype._createFieldBuilder = function(vFieldIdentifier) {
|
|
70
|
+
DialogAPI.prototype._createFieldBuilder = function(vFieldIdentifier, oDialogIdentifier) {
|
|
65
71
|
var oMdcFieldBuilder = new MdcFieldBuilder(this.getOpaInstance());
|
|
66
72
|
return oMdcFieldBuilder
|
|
67
73
|
.isDialogElement()
|
|
68
74
|
.hasType("sap.ui.mdc.Field")
|
|
69
|
-
.has(this._createFieldMatcher(vFieldIdentifier));
|
|
75
|
+
.has(this._createFieldMatcher(vFieldIdentifier, oDialogIdentifier));
|
|
70
76
|
};
|
|
71
77
|
|
|
72
78
|
DialogAPI.prototype._getConfirmButtonMatcher = function() {
|
|
@@ -82,8 +88,19 @@ sap.ui.define(
|
|
|
82
88
|
var iConfirmButtonIndex = this._iConfirmButtonIndex;
|
|
83
89
|
return function(oButton) {
|
|
84
90
|
var aButtons = oButton.getParent().getButtons();
|
|
85
|
-
// Cancel is (usually) right next to the first (confirm) button
|
|
86
|
-
return aButtons.
|
|
91
|
+
// Cancel is (usually) right next to the first (confirm) button and (usually) the last one in the list
|
|
92
|
+
return aButtons.length > 2
|
|
93
|
+
? aButtons.indexOf(oButton) === aButtons.length - 1
|
|
94
|
+
: aButtons.indexOf(oButton) === Math.min(aButtons.length - 1, iConfirmButtonIndex + 1);
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
DialogAPI.prototype._getConfirmDiscardDraftButtonMatcher = function() {
|
|
99
|
+
var iConfirmDiscardDraftButtonIndex = this._iConfirmDiscardDraftButtonIndex;
|
|
100
|
+
return function(oButton) {
|
|
101
|
+
var aButtons = oButton.getParent().getButtons();
|
|
102
|
+
// for the KeepDraft/DiscardDraft message, the DiscardDraft button is the second in the list
|
|
103
|
+
return aButtons.indexOf(oButton) === iConfirmDiscardDraftButtonIndex;
|
|
87
104
|
};
|
|
88
105
|
};
|
|
89
106
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* ! SAPUI5
|
|
3
|
-
|
|
2
|
+
* ! SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
4
5
|
*/
|
|
5
6
|
sap.ui.define(["./DialogAPI", "sap/fe/test/Utils", "sap/ui/test/OpaBuilder"], function(DialogAPI, Utils, OpaBuilder) {
|
|
6
7
|
"use strict";
|
|
@@ -70,22 +71,22 @@ sap.ui.define(["./DialogAPI", "sap/fe/test/Utils", "sap/ui/test/OpaBuilder"], fu
|
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
/**
|
|
73
|
-
* Changes the content of a field in
|
|
74
|
+
* Changes the content of a field in a dialog.
|
|
74
75
|
*
|
|
75
|
-
* @param {sap.fe.test.api.
|
|
76
|
+
* @param {sap.fe.test.api.DialogFieldIdentifier} vFieldIdentifier The identifier of the field
|
|
76
77
|
* @param {string} [vValue] The new target value.
|
|
77
78
|
* @param {boolean} [bClearFirst] Set to <code>true</code> to clear previously set filters, otherwise all previously set values will be kept
|
|
78
79
|
* @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, that can be used for chaining statements
|
|
79
80
|
* @public
|
|
80
81
|
*/
|
|
81
|
-
DialogActions.prototype.
|
|
82
|
+
DialogActions.prototype.iChangeDialogField = function(vFieldIdentifier, vValue, bClearFirst) {
|
|
82
83
|
var aArguments = Utils.parseArguments([Object, String, Boolean], arguments);
|
|
83
84
|
return this.prepareResult(
|
|
84
|
-
this._createFieldBuilder(vFieldIdentifier)
|
|
85
|
+
this._createFieldBuilder(vFieldIdentifier, this.getIdentifier())
|
|
85
86
|
.doChangeValue(aArguments[1], aArguments[2])
|
|
86
87
|
.description(
|
|
87
88
|
Utils.formatMessage(
|
|
88
|
-
"Changing the field '{1}' of
|
|
89
|
+
"Changing the field '{1}' of dialog '{0}' by adding '{2}' (was cleared first: {3})",
|
|
89
90
|
this.getIdentifier(),
|
|
90
91
|
aArguments[0],
|
|
91
92
|
aArguments[1],
|
|
@@ -96,5 +97,18 @@ sap.ui.define(["./DialogAPI", "sap/fe/test/Utils", "sap/ui/test/OpaBuilder"], fu
|
|
|
96
97
|
);
|
|
97
98
|
};
|
|
98
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Changes the content of a field in an action parameter dialog.
|
|
102
|
+
*
|
|
103
|
+
* @param {sap.fe.test.api.ActionDialogFieldIdentifier} vFieldIdentifier The identifier of the field
|
|
104
|
+
* @param {string} [vValue] The new target value.
|
|
105
|
+
* @param {boolean} [bClearFirst] Set to <code>true</code> to clear previously set filters, otherwise all previously set values will be kept
|
|
106
|
+
* @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, that can be used for chaining statements
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
DialogActions.prototype.iChangeActionParameterDialogField = function(vFieldIdentifier, vValue, bClearFirst) {
|
|
110
|
+
return this.iChangeDialogField(vFieldIdentifier, vValue, bClearFirst);
|
|
111
|
+
};
|
|
112
|
+
|
|
99
113
|
return DialogActions;
|
|
100
114
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* ! SAPUI5
|
|
3
|
-
|
|
2
|
+
* ! SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
4
5
|
*/
|
|
5
6
|
sap.ui.define(["./DialogAPI", "sap/fe/test/Utils"], function(DialogAPI, Utils) {
|
|
6
7
|
"use strict";
|
|
@@ -86,9 +87,9 @@ sap.ui.define(["./DialogAPI", "sap/fe/test/Utils"], function(DialogAPI, Utils) {
|
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
/**
|
|
89
|
-
* Checks the content and state of a field in
|
|
90
|
+
* Checks the content and state of a field in a dialog.
|
|
90
91
|
*
|
|
91
|
-
* @param {sap.fe.test.api.
|
|
92
|
+
* @param {sap.fe.test.api.DialogFieldIdentifier} vFieldIdentifier The identifier of the field
|
|
92
93
|
* @param {string | Array | object} [vValue] Expected value(s) of the field.
|
|
93
94
|
* if passed as an object, the following pattern will be considered:
|
|
94
95
|
* <code><pre>
|
|
@@ -100,15 +101,16 @@ sap.ui.define(["./DialogAPI", "sap/fe/test/Utils"], function(DialogAPI, Utils) {
|
|
|
100
101
|
* @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
|
|
101
102
|
* @public
|
|
102
103
|
*/
|
|
103
|
-
DialogAssertions.prototype.
|
|
104
|
+
DialogAssertions.prototype.iCheckDialogField = function(vFieldIdentifier, vValue, mState) {
|
|
104
105
|
var aArguments = Utils.parseArguments([Object, [String, Array, Object], Object], arguments);
|
|
105
106
|
return this.prepareResult(
|
|
106
|
-
this._createFieldBuilder(vFieldIdentifier)
|
|
107
|
+
this._createFieldBuilder(vFieldIdentifier, this.getIdentifier())
|
|
107
108
|
.hasValue(aArguments[1])
|
|
108
109
|
.hasState(aArguments[2])
|
|
109
110
|
.description(
|
|
110
111
|
Utils.formatMessage(
|
|
111
|
-
"Checking field '{0}' with content '{
|
|
112
|
+
"Checking field '{1}' of dialog '{0}' with content '{2}' and state '{3}'",
|
|
113
|
+
this.getIdentifier(),
|
|
112
114
|
aArguments[0],
|
|
113
115
|
aArguments[1],
|
|
114
116
|
aArguments[2]
|
|
@@ -118,5 +120,24 @@ sap.ui.define(["./DialogAPI", "sap/fe/test/Utils"], function(DialogAPI, Utils) {
|
|
|
118
120
|
);
|
|
119
121
|
};
|
|
120
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Checks the content and state of a field in an action parameter dialog.
|
|
125
|
+
*
|
|
126
|
+
* @param {sap.fe.test.api.ActionDialogFieldIdentifier} vFieldIdentifier The identifier of the field
|
|
127
|
+
* @param {string | Array | object} [vValue] Expected value(s) of the field.
|
|
128
|
+
* if passed as an object, the following pattern will be considered:
|
|
129
|
+
* <code><pre>
|
|
130
|
+
* {
|
|
131
|
+
* value: <string>, // optional
|
|
132
|
+
* }
|
|
133
|
+
* </pre></code>
|
|
134
|
+
* @param {object} [mState] Defines the expected state of the field
|
|
135
|
+
* @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
DialogAssertions.prototype.iCheckActionParameterDialogField = function(vFieldIdentifier, vValue, mState) {
|
|
139
|
+
return this.iCheckDialogField(vFieldIdentifier, vValue, mState);
|
|
140
|
+
};
|
|
141
|
+
|
|
121
142
|
return DialogAssertions;
|
|
122
143
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* ! SAPUI5
|
|
3
|
-
|
|
2
|
+
* ! SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
4
5
|
*/
|
|
5
6
|
sap.ui.define(["./DialogActions", "sap/fe/test/Utils", "sap/ui/test/OpaBuilder"], function(DialogActions, Utils, OpaBuilder) {
|
|
6
7
|
"use strict";
|
|
@@ -18,7 +19,7 @@ sap.ui.define(["./DialogActions", "sap/fe/test/Utils", "sap/ui/test/OpaBuilder"]
|
|
|
18
19
|
* @public
|
|
19
20
|
*/
|
|
20
21
|
var DialogCreateActions = function(oDialogBuilder, vDialogDescription) {
|
|
21
|
-
return DialogActions.call(this, oDialogBuilder, vDialogDescription,
|
|
22
|
+
return DialogActions.call(this, oDialogBuilder, vDialogDescription, 0);
|
|
22
23
|
};
|
|
23
24
|
DialogCreateActions.prototype = Object.create(DialogActions.prototype);
|
|
24
25
|
DialogCreateActions.prototype.constructor = DialogCreateActions;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* ! SAPUI5
|
|
3
|
-
|
|
2
|
+
* ! SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
4
5
|
*/
|
|
5
6
|
sap.ui.define(["./DialogAssertions", "sap/ui/test/OpaBuilder", "sap/fe/test/builder/FEBuilder", "sap/fe/test/Utils"], function(
|
|
6
7
|
DialogAssertions,
|
|
@@ -23,7 +24,7 @@ sap.ui.define(["./DialogAssertions", "sap/ui/test/OpaBuilder", "sap/fe/test/buil
|
|
|
23
24
|
* @public
|
|
24
25
|
*/
|
|
25
26
|
var DialogCreateAssertions = function(oDialogBuilder, vDialogDescription) {
|
|
26
|
-
return DialogAssertions.call(this, oDialogBuilder, vDialogDescription,
|
|
27
|
+
return DialogAssertions.call(this, oDialogBuilder, vDialogDescription, 0);
|
|
27
28
|
};
|
|
28
29
|
DialogCreateAssertions.prototype = Object.create(DialogAssertions.prototype);
|
|
29
30
|
DialogCreateAssertions.prototype.constructor = DialogCreateAssertions;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* ! SAPUI5
|
|
3
|
-
|
|
2
|
+
* ! SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
(c) Copyright 2009-2021 SAP SE. All rights reserved
|
|
4
|
+
|
|
4
5
|
*/
|
|
5
6
|
sap.ui.define(["./DialogActions", "sap/fe/test/Utils", "sap/ui/test/OpaBuilder"], function(DialogActions, Utils, OpaBuilder) {
|
|
6
7
|
"use strict";
|
|
@@ -18,7 +19,7 @@ sap.ui.define(["./DialogActions", "sap/fe/test/Utils", "sap/ui/test/OpaBuilder"]
|
|
|
18
19
|
* @public
|
|
19
20
|
*/
|
|
20
21
|
var DialogMessageActions = function(oDialogBuilder, vDialogDescription) {
|
|
21
|
-
return DialogActions.call(this, oDialogBuilder, vDialogDescription,
|
|
22
|
+
return DialogActions.call(this, oDialogBuilder, vDialogDescription, 0);
|
|
22
23
|
};
|
|
23
24
|
DialogMessageActions.prototype = Object.create(DialogActions.prototype);
|
|
24
25
|
DialogMessageActions.prototype.constructor = DialogMessageActions;
|
|
@@ -54,5 +55,20 @@ sap.ui.define(["./DialogActions", "sap/fe/test/Utils", "sap/ui/test/OpaBuilder"]
|
|
|
54
55
|
);
|
|
55
56
|
};
|
|
56
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Confirms the draft message with Discard Draft when navigating back to the list-report.
|
|
60
|
+
*
|
|
61
|
+
* @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
DialogMessageActions.prototype.iConfirmDiscardDraft = function() {
|
|
65
|
+
return this.prepareResult(
|
|
66
|
+
this.getBuilder()
|
|
67
|
+
.doPressFooterButton(this._getConfirmDiscardDraftButtonMatcher())
|
|
68
|
+
.description(Utils.formatMessage("Confirming dialog '{0}' with Discard Draft", this.getIdentifier()))
|
|
69
|
+
.execute()
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
57
73
|
return DialogMessageActions;
|
|
58
74
|
});
|