@sapui5/sap.fe.test 1.130.6 → 1.132.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.
@@ -4,285 +4,290 @@
4
4
  (c) Copyright 2009-2021 SAP SE. All rights reserved
5
5
 
6
6
  */
7
- sap.ui.define(["sap/ui/test/OpaBuilder", "sap/ui/test/Opa5", "sap/fe/test/Utils"], function (OpaBuilder, Opa5, Utils) {
8
- "use strict";
7
+ sap.ui.define(
8
+ ["sap/ui/test/OpaBuilder", "sap/ui/test/Opa5", "sap/fe/test/Utils", "sap/ui/test/actions/Press"],
9
+ function (OpaBuilder, Opa5, Utils, Press) {
10
+ "use strict";
9
11
 
10
- /**
11
- * Constructs a test page definition for the shell.
12
- * @class Provides a test page definition for the shell.
13
- *
14
- * When using {@link sap.fe.test.JourneyRunner}, this page is made available by default via <code>onTheShell</code>.
15
- * @param {...object} [aAdditionalPageDefinitions] Additional custom page functions, provided in an object containing <code>actions</code> and <code>assertions</code>
16
- * @returns {sap.fe.test.Shell} A shell page definition
17
- * @name sap.fe.test.Shell
18
- * @public
19
- */
20
- function ShellPage(aAdditionalPageDefinitions) {
21
- aAdditionalPageDefinitions = Array.isArray(arguments[0]) ? arguments[0] : Array.prototype.slice.call(arguments, 0);
22
- return Utils.mergeObjects.apply(
23
- Utils,
24
- [
25
- {
26
- actions: {
27
- /**
28
- * Navigates back via shell back button.
29
- * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
30
- * @function
31
- * @name sap.fe.test.Shell#iNavigateBack
32
- * @public
33
- */
34
- iNavigateBack: function () {
35
- return OpaBuilder.create(this).hasId("backBtn").doPress().description("Navigating back via shell").execute();
36
- },
37
- /**
38
- * Navigates to the launch pad via the home button.
39
- * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
40
- * @function
41
- * @name sap.fe.test.Shell#iNavigateHome
42
- * @public
43
- */
44
- iNavigateHome: function () {
45
- return OpaBuilder.create(this)
46
- .hasId("shell-header")
47
- .do(function () {
48
- // the logo is not a UI5 control
49
- var oTestWindow = Opa5.getWindow();
50
- oTestWindow.document.getElementById("shell-header-logo").click();
51
- })
52
- .description("Pressing Home button in Shell header")
53
- .execute();
54
- },
55
- /**
56
- * Opens the navigation menu in the shell header.
57
- * @param {string} [NavigationTitle] The title of the navigation menu to be clicked. If undefined the menu is identified by the internal id only.
58
- * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
59
- * @function
60
- * @name sap.fe.test.Shell#iOpenNavigationMenu
61
- * @public
62
- */
63
- iOpenNavigationMenu: function (NavigationTitle) {
64
- return OpaBuilder.create(this)
65
- .pollingInterval(1000) // the shell needs some time to prepare the navigation menu
66
- .hasId("shellAppTitle")
67
- .has(function (oShellObject) {
68
- return NavigationTitle ? oShellObject.getText() === NavigationTitle : true;
69
- })
70
- .doPress()
71
- .description("Expanding Shell Navigation Menu")
72
- .execute();
73
- },
74
- /**
75
- * Navigates via a navigation item in the shell's navigation menu.
76
- * @param {string} sItem The label of the navigation item
77
- * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
78
- * @function
79
- * @name sap.fe.test.Shell#iNavigateViaMenu
80
- * @public
81
- */
82
- iNavigateViaMenu: function (sItem) {
83
- return OpaBuilder.create(this)
84
- .hasId("sapUshellNavHierarchyItems")
85
- .doOnAggregation("items", OpaBuilder.Matchers.properties({ title: sItem }), OpaBuilder.Actions.press())
86
- .description(Utils.formatMessage("Navigating to '{0}' via Shell Navigation Menu", sItem))
87
- .execute();
88
- },
89
- /**
90
- * Selecting a tile in the launchpad by its target app, for example <code>iPressTile("SalesOrder-manage")</code>.
91
- * @param {string} sTarget The target application (hash)
92
- * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
93
- * @function
94
- * @name sap.fe.test.Shell#iPressTile
95
- * @public
96
- */
97
- iPressTile: function (sTarget) {
98
- return this.waitFor({
99
- controlType: "sap.ushell.ui.launchpad.Tile",
100
- matchers: function (oTile) {
101
- return oTile.getTarget() === "#" + sTarget;
102
- },
103
- actions: function (oTile) {
104
- oTile.getTileViews()[0].$().trigger("tap");
105
- },
106
- success: function () {
107
- Opa5.assert.ok(true, Utils.formatMessage("Clicking on tile with target '{0}'", sTarget));
108
- },
109
- errorMessage: "Could not find the tile"
110
- });
111
- },
112
- iOpenDefaultValues: function () {
113
- return OpaBuilder.create(this)
114
- .hasId("userActionsMenuHeaderButton")
115
- .doPress()
116
- .description("Opening FLP Default Values dialog")
117
- .execute();
118
- },
119
- iEnterAValueForUserDefaults: function (oField, vValue) {
120
- return OpaBuilder.create(this)
121
- .hasProperties({
122
- name: oField.field
123
- })
124
- .isDialogElement()
125
- .doEnterText(vValue)
126
- .description("Entering text in the field '" + oField.field + "' with value '" + oField + "'")
127
- .execute();
128
- },
129
- iSelectAListItem: function (sOption) {
130
- return OpaBuilder.create(this)
131
- .hasType("sap.m.StandardListItem")
132
- .hasProperties({ title: sOption })
133
- .doPress()
134
- .description("Selecting item: " + sOption)
135
- .execute();
136
- },
137
- iLaunchExtendedParameterDialog: function () {
138
- return OpaBuilder.create(this)
139
- .hasType("sap.m.Button")
140
- .isDialogElement()
141
- .hasProperties({
142
- text: "Additional Values"
143
- })
144
- .doPress()
145
- .description("Launching Extended Parameter Dialog")
146
- .execute();
147
- },
148
- iClickOnButtonWithText: function (sText) {
149
- return OpaBuilder.create(this)
150
- .hasType("sap.m.Button")
151
- .hasProperties({
152
- text: sText
153
- })
154
- .doPress()
155
- .description("Clicking on button with text: " + sText)
156
- .execute();
157
- },
158
- iClickOnButtonWithIcon: function (sIcon) {
159
- return OpaBuilder.create(this)
160
- .hasType("sap.m.Button")
161
- .hasProperties({
162
- icon: "sap-icon://" + sIcon
163
- })
164
- .doPress()
165
- .description("Clicking on button with icon: " + sIcon)
166
- .execute();
167
- }
168
- },
169
- assertions: {
170
- iSeeFlpDashboard: function () {
171
- return OpaBuilder.create(this).hasId("mainShell").description("Seeing FLP Dashboard").execute();
172
- },
173
- iShouldSeeTheAppTile: function (sTitle) {
174
- return OpaBuilder.create(this)
175
- .hasType("sap.ushell.ui.launchpad.Tile")
176
- .hasProperties({
177
- target: sTitle
178
- })
179
- .description("Seeing Tile " + sTitle)
180
- .execute();
181
- },
182
- iSeeNavigateBack: function () {
183
- return OpaBuilder.create(this).hasId("backBtn").description("I see the back navigation button").execute();
12
+ /**
13
+ * Constructs a test page definition for the shell.
14
+ * @class Provides a test page definition for the shell.
15
+ *
16
+ * When using {@link sap.fe.test.JourneyRunner}, this page is made available by default via <code>onTheShell</code>.
17
+ * @param {...object} [aAdditionalPageDefinitions] Additional custom page functions, provided in an object containing <code>actions</code> and <code>assertions</code>
18
+ * @returns {sap.fe.test.Shell} A shell page definition
19
+ * @name sap.fe.test.Shell
20
+ * @public
21
+ */
22
+ function ShellPage(aAdditionalPageDefinitions) {
23
+ aAdditionalPageDefinitions = Array.isArray(arguments[0]) ? arguments[0] : Array.prototype.slice.call(arguments, 0);
24
+ return Utils.mergeObjects.apply(
25
+ Utils,
26
+ [
27
+ {
28
+ actions: {
29
+ /**
30
+ * Navigates back via shell back button.
31
+ * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
32
+ * @function
33
+ * @name sap.fe.test.Shell#iNavigateBack
34
+ * @public
35
+ */
36
+ iNavigateBack: function () {
37
+ return OpaBuilder.create(this)
38
+ .hasId("backBtn")
39
+ .doPress()
40
+ .description("Navigating back via shell")
41
+ .execute();
42
+ },
43
+ /**
44
+ * Navigates to the launch pad via the home button.
45
+ * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
46
+ * @function
47
+ * @name sap.fe.test.Shell#iNavigateHome
48
+ * @public
49
+ */
50
+ iNavigateHome: function () {
51
+ return OpaBuilder.create(this)
52
+ .hasId("shell-header")
53
+ .do(function () {
54
+ // the logo is not a UI5 control
55
+ var oTestWindow = Opa5.getWindow();
56
+ oTestWindow.document.getElementById("shell-header-logo").click();
57
+ })
58
+ .description("Pressing Home button in Shell header")
59
+ .execute();
60
+ },
61
+ /**
62
+ * Opens the navigation menu in the shell header.
63
+ * @param {string} [NavigationTitle] The title of the navigation menu to be clicked. If undefined the menu is identified by the internal id only.
64
+ * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
65
+ * @function
66
+ * @name sap.fe.test.Shell#iOpenNavigationMenu
67
+ * @public
68
+ */
69
+ iOpenNavigationMenu: function (NavigationTitle) {
70
+ return OpaBuilder.create(this)
71
+ .pollingInterval(1000) // the shell needs some time to prepare the navigation menu
72
+ .hasId("shellAppTitle")
73
+ .has(function (oShellObject) {
74
+ return NavigationTitle ? oShellObject.getText() === NavigationTitle : true;
75
+ })
76
+ .doPress()
77
+ .description("Expanding Shell Navigation Menu")
78
+ .execute();
79
+ },
80
+ /**
81
+ * Navigates via a navigation item in the shell's navigation menu.
82
+ * @param {string} sItem The label of the navigation item
83
+ * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
84
+ * @function
85
+ * @name sap.fe.test.Shell#iNavigateViaMenu
86
+ * @public
87
+ */
88
+ iNavigateViaMenu: function (sItem) {
89
+ return OpaBuilder.create(this)
90
+ .hasId("sapUshellNavHierarchyItems")
91
+ .doOnAggregation("items", OpaBuilder.Matchers.properties({ title: sItem }), OpaBuilder.Actions.press())
92
+ .description(Utils.formatMessage("Navigating to '{0}' via Shell Navigation Menu", sItem))
93
+ .execute();
94
+ },
95
+ /**
96
+ * Selecting a tile in the launchpad by its target app, for example <code>iPressTile("SalesOrder-manage")</code>.
97
+ * @param {string} sTarget The target application (hash)
98
+ * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
99
+ * @function
100
+ * @name sap.fe.test.Shell#iPressTile
101
+ * @public
102
+ */
103
+ iPressTile: function (sTarget) {
104
+ return this.waitFor({
105
+ controlType: "sap.ushell.ui.launchpad.VizInstanceCdm",
106
+ matchers: function (oTile) {
107
+ return oTile.getTargetURL() === "#" + sTarget;
108
+ },
109
+ actions: new Press(),
110
+ success: function () {
111
+ Opa5.assert.ok(true, Utils.formatMessage("Clicking on tile with target '{0}'", sTarget));
112
+ },
113
+ errorMessage: "Could not find the tile"
114
+ });
115
+ },
116
+ iOpenDefaultValues: function () {
117
+ return OpaBuilder.create(this)
118
+ .hasId("userActionsMenuHeaderButton")
119
+ .doPress()
120
+ .description("Opening FLP Default Values dialog")
121
+ .execute();
122
+ },
123
+ iEnterAValueForUserDefaults: function (oField, vValue) {
124
+ return OpaBuilder.create(this)
125
+ .hasProperties({
126
+ name: oField.field
127
+ })
128
+ .isDialogElement()
129
+ .doEnterText(vValue)
130
+ .description("Entering text in the field '" + oField.field + "' with value '" + oField + "'")
131
+ .execute();
132
+ },
133
+ iSelectAListItem: function (sOption) {
134
+ return OpaBuilder.create(this)
135
+ .hasType("sap.m.StandardListItem")
136
+ .hasProperties({ title: sOption })
137
+ .doPress()
138
+ .description("Selecting item: " + sOption)
139
+ .execute();
140
+ },
141
+ iLaunchExtendedParameterDialog: function () {
142
+ return OpaBuilder.create(this)
143
+ .hasType("sap.m.Button")
144
+ .isDialogElement()
145
+ .hasProperties({
146
+ text: "Additional Values"
147
+ })
148
+ .doPress()
149
+ .description("Launching Extended Parameter Dialog")
150
+ .execute();
151
+ },
152
+ iClickOnButtonWithText: function (sText) {
153
+ return OpaBuilder.create(this)
154
+ .hasType("sap.m.Button")
155
+ .hasProperties({
156
+ text: sText
157
+ })
158
+ .doPress()
159
+ .description("Clicking on button with text: " + sText)
160
+ .execute();
161
+ },
162
+ iClickOnButtonWithIcon: function (sIcon) {
163
+ return OpaBuilder.create(this)
164
+ .hasType("sap.m.Button")
165
+ .hasProperties({
166
+ icon: "sap-icon://" + sIcon
167
+ })
168
+ .doPress()
169
+ .description("Clicking on button with icon: " + sIcon)
170
+ .execute();
171
+ }
184
172
  },
185
- iSeeShellNavHierarchyItem: function (sItemTitle, iItemPosition, iItemNumbers, sItemDesc) {
186
- return OpaBuilder.create(this)
187
- .viewId(null)
188
- .hasId("backBtn")
189
- .hasId("sapUshellNavHierarchyItems")
190
- .hasAggregationLength("items", iItemNumbers)
191
- .has(OpaBuilder.Matchers.aggregationAtIndex("items", iItemPosition - 1))
192
- .hasProperties({ title: sItemTitle, description: sItemDesc })
193
- .description(
194
- Utils.formatMessage(
195
- "Checking Navigation Hierarchy Items ({2}): Name={0}, Position={1}, Description={3}",
196
- sItemTitle,
197
- iItemPosition,
198
- iItemNumbers,
199
- sItemDesc
173
+ assertions: {
174
+ iSeeFlpDashboard: function () {
175
+ return OpaBuilder.create(this).hasId("mainShell").description("Seeing FLP Dashboard").execute();
176
+ },
177
+ iShouldSeeTheAppTile: function (sTitle) {
178
+ return OpaBuilder.create(this)
179
+ .hasType("sap.ushell.ui.launchpad.VizInstanceCdm")
180
+ .hasProperties({
181
+ targetURL: sTitle
182
+ })
183
+ .description("Seeing Tile " + sTitle)
184
+ .execute();
185
+ },
186
+ iSeeNavigateBack: function () {
187
+ return OpaBuilder.create(this).hasId("backBtn").description("I see the back navigation button").execute();
188
+ },
189
+ iSeeShellNavHierarchyItem: function (sItemTitle, iItemPosition, iItemNumbers, sItemDesc) {
190
+ return OpaBuilder.create(this)
191
+ .viewId(null)
192
+ .hasId("backBtn")
193
+ .hasId("sapUshellNavHierarchyItems")
194
+ .hasAggregationLength("items", iItemNumbers)
195
+ .has(OpaBuilder.Matchers.aggregationAtIndex("items", iItemPosition - 1))
196
+ .hasProperties({ title: sItemTitle, description: sItemDesc })
197
+ .description(
198
+ Utils.formatMessage(
199
+ "Checking Navigation Hierarchy Items ({2}): Name={0}, Position={1}, Description={3}",
200
+ sItemTitle,
201
+ iItemPosition,
202
+ iItemNumbers,
203
+ sItemDesc
204
+ )
200
205
  )
201
- )
202
- .execute();
203
- },
204
- iSeeShellAppTitle: function (sTitle) {
205
- return OpaBuilder.create(this)
206
- .viewId(null)
207
- .hasId("shellAppTitle")
208
- .hasProperties({ text: sTitle })
209
- .description(sTitle + " is the Shell App Title")
210
- .execute();
211
- },
212
- /**
213
- * Check an intent-based navigation.
214
- * The function checks the semantic object and the action within the URL of an application.
215
- * Optionally, further URL parameters can be checked.
216
- * @param {string} sSemanticObject The semantic object of the application
217
- * @param {string} sAction The action of the application
218
- * @param {Array} [aURLParams] More URL parameters to be checked. The pattern is:
219
- * <code><pre>
220
- * [{
221
- * property: &lt;expected name of URL parameter>,
222
- * value: &lt;expected value of URL parameter>
223
- * }]
224
- * </pre></code>
225
- * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
226
- * @function
227
- * @name sap.fe.test.Shell#iCheckIntentBasedNavigation
228
- * @public
229
- */
230
- iCheckIntentBasedNavigation: function (sSemanticObject, sAction, aURLParams) {
231
- function _hasAllURLParameters(oURLParams, aInputURLParams) {
232
- try {
233
- aInputURLParams.forEach(function (oParam) {
234
- if (oURLParams.hasOwnProperty(oParam.property)) {
235
- if (oURLParams[oParam.property][0] !== oParam.value) {
236
- throw "input parameter not equal to actual URL parameter";
206
+ .execute();
207
+ },
208
+ iSeeShellAppTitle: function (sTitle) {
209
+ return OpaBuilder.create(this)
210
+ .viewId(null)
211
+ .hasId("shellAppTitle")
212
+ .hasProperties({ text: sTitle })
213
+ .description(sTitle + " is the Shell App Title")
214
+ .execute();
215
+ },
216
+ /**
217
+ * Check an intent-based navigation.
218
+ * The function checks the semantic object and the action within the URL of an application.
219
+ * Optionally, further URL parameters can be checked.
220
+ * @param {string} sSemanticObject The semantic object of the application
221
+ * @param {string} sAction The action of the application
222
+ * @param {Array} [aURLParams] More URL parameters to be checked. The pattern is:
223
+ * <code><pre>
224
+ * [{
225
+ * property: &lt;expected name of URL parameter>,
226
+ * value: &lt;expected value of URL parameter>
227
+ * }]
228
+ * </pre></code>
229
+ * @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
230
+ * @function
231
+ * @name sap.fe.test.Shell#iCheckIntentBasedNavigation
232
+ * @public
233
+ */
234
+ iCheckIntentBasedNavigation: function (sSemanticObject, sAction, aURLParams) {
235
+ function _hasAllURLParameters(oURLParams, aInputURLParams) {
236
+ try {
237
+ aInputURLParams.forEach(function (oParam) {
238
+ if (oURLParams.hasOwnProperty(oParam.property)) {
239
+ if (oURLParams[oParam.property][0] !== oParam.value) {
240
+ throw "input parameter not equal to actual URL parameter";
241
+ }
242
+ } else {
243
+ throw "input parameter not found in URL";
237
244
  }
245
+ });
246
+ return true;
247
+ } catch (error) {
248
+ return false;
249
+ }
250
+ }
251
+
252
+ return OpaBuilder.create(this)
253
+ .check(function () {
254
+ var oParsedHash = Opa5.getWindow()
255
+ .sap.ushell.Container.getService("URLParsing")
256
+ .parseShellHash(Opa5.getWindow().document.location.hash);
257
+ if (oParsedHash.semanticObject === sSemanticObject && oParsedHash.action === sAction) {
258
+ return !aURLParams || _hasAllURLParameters(oParsedHash.params, aURLParams) ? true : false;
238
259
  } else {
239
- throw "input parameter not found in URL";
260
+ return false;
240
261
  }
241
- });
242
- return true;
243
- } catch (error) {
244
- return false;
245
- }
262
+ })
263
+ .error(function () {
264
+ var sHash = Opa5.getWindow().document.location.hash,
265
+ sLogErr = "Expected properties/values: ";
266
+ Opa5.assert.ok(false, "Current hash value: " + sHash);
267
+ Opa5.assert.ok(false, "Expected semantic object: " + sSemanticObject);
268
+ Opa5.assert.ok(false, "Expected action: " + sAction);
269
+ if (aURLParams) {
270
+ aURLParams.forEach(function (oParam) {
271
+ sLogErr = sLogErr + oParam.property + "=" + oParam.value + ",";
272
+ });
273
+ Opa5.assert.ok(false, sLogErr);
274
+ }
275
+ })
276
+ .success(
277
+ "Navigation successful. SemanticObject: " +
278
+ sSemanticObject +
279
+ ", Action: " +
280
+ sAction +
281
+ " and all URL parameters are valid."
282
+ )
283
+ .execute();
246
284
  }
247
-
248
- return OpaBuilder.create(this)
249
- .check(function () {
250
- var oParsedHash = Opa5.getWindow()
251
- .sap.ushell.Container.getService("URLParsing")
252
- .parseShellHash(Opa5.getWindow().document.location.hash);
253
- if (oParsedHash.semanticObject === sSemanticObject && oParsedHash.action === sAction) {
254
- return !aURLParams || _hasAllURLParameters(oParsedHash.params, aURLParams) ? true : false;
255
- } else {
256
- return false;
257
- }
258
- })
259
- .error(function () {
260
- var sHash = Opa5.getWindow().document.location.hash,
261
- sLogErr = "Expected properties/values: ";
262
- Opa5.assert.ok(false, "Current hash value: " + sHash);
263
- Opa5.assert.ok(false, "Expected semantic object: " + sSemanticObject);
264
- Opa5.assert.ok(false, "Expected action: " + sAction);
265
- if (aURLParams) {
266
- aURLParams.forEach(function (oParam) {
267
- sLogErr = sLogErr + oParam.property + "=" + oParam.value + ",";
268
- });
269
- Opa5.assert.ok(false, sLogErr);
270
- }
271
- })
272
- .success(
273
- "Navigation successful. SemanticObject: " +
274
- sSemanticObject +
275
- ", Action: " +
276
- sAction +
277
- " and all URL parameters are valid."
278
- )
279
- .execute();
280
285
  }
281
286
  }
282
- }
283
- ].concat(aAdditionalPageDefinitions)
284
- );
285
- }
287
+ ].concat(aAdditionalPageDefinitions)
288
+ );
289
+ }
286
290
 
287
- return ShellPage;
288
- });
291
+ return ShellPage;
292
+ }
293
+ );
@@ -47,29 +47,31 @@ sap.ui.define([], function () {
47
47
 
48
48
  stubMessageToast: function (oWindow) {
49
49
  Stubs.prepareStubs(oWindow);
50
- var oMessageToast = oWindow.sap.ui.require("sap/m/MessageToast");
51
- oWindow.sapFEStubs._sapMMessageToastShowOriginal = oMessageToast.show;
52
- oWindow.sapFEStubs.setLastToastMessage = function (sMessage) {
53
- oWindow.sapFEStubs._sapMMessageToastLastMessage = sMessage;
54
- };
55
- oWindow.sapFEStubs.getLastToastMessage = function () {
56
- return oWindow.sapFEStubs._sapMMessageToastLastMessage;
57
- };
58
- oMessageToast.show = function (sMessage) {
59
- oWindow.sapFEStubs.setLastToastMessage(sMessage);
60
- return oWindow.sapFEStubs._sapMMessageToastShowOriginal.apply(this, arguments);
61
- };
50
+ oWindow.sap.ui.require(["sap/m/MessageToast"], (oMessageToast) => {
51
+ oWindow.sapFEStubs._sapMMessageToastShowOriginal = oMessageToast.show;
52
+ oWindow.sapFEStubs.setLastToastMessage = function (sMessage) {
53
+ oWindow.sapFEStubs._sapMMessageToastLastMessage = sMessage;
54
+ };
55
+ oWindow.sapFEStubs.getLastToastMessage = function () {
56
+ return oWindow.sapFEStubs._sapMMessageToastLastMessage;
57
+ };
58
+ oMessageToast.show = function (sMessage) {
59
+ oWindow.sapFEStubs.setLastToastMessage(sMessage);
60
+ return oWindow.sapFEStubs._sapMMessageToastShowOriginal.apply(this, arguments);
61
+ };
62
+ });
62
63
  },
63
64
  restoreMessageToast: function (oWindow) {
64
65
  if (!oWindow.sapFEStubs || !oWindow.sapFEStubs._sapMMessageToastShowOriginal) {
65
66
  return;
66
67
  }
67
- var oMessageToast = oWindow.sap.ui.require("sap/m/MessageToast");
68
- oMessageToast.show = oWindow.sapFEStubs._sapMMessageToastShowOriginal;
69
- delete oWindow.sapFEStubs._sapMMessageToastShowOriginal;
70
- delete oWindow.sapFEStubs._sapMMessageToastLastMessage;
71
- delete oWindow.sapFEStubs.setLastToastMessage;
72
- delete oWindow.sapFEStubs.getLastToastMessage;
68
+ oWindow.sap.ui.require(["sap/m/MessageToast"], (oMessageToast) => {
69
+ oMessageToast.show = oWindow.sapFEStubs._sapMMessageToastShowOriginal;
70
+ delete oWindow.sapFEStubs._sapMMessageToastShowOriginal;
71
+ delete oWindow.sapFEStubs._sapMMessageToastLastMessage;
72
+ delete oWindow.sapFEStubs.setLastToastMessage;
73
+ delete oWindow.sapFEStubs.getLastToastMessage;
74
+ });
73
75
  },
74
76
 
75
77
  stubMisc: function (oWindow) {