@sap-ux/ui5-test-writer 1.15.3 → 1.15.5

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.
Files changed (27) hide show
  1. package/dist/fiori-elements-opa-writer.d.ts +3 -3
  2. package/dist/fiori-elements-opa-writer.js +6 -5
  3. package/package.json +2 -2
  4. package/templates/v4/1.148/integration/FirstJourney.js +5 -5
  5. package/templates/v4/1.152/integration/FPMJourney.js +43 -0
  6. package/templates/v4/1.152/integration/FPMJourney.ts +40 -0
  7. package/templates/v4/1.152/integration/FirstJourney.js +37 -0
  8. package/templates/v4/1.152/integration/FirstJourney.ts +34 -0
  9. package/templates/v4/1.152/integration/ListReportJourney.js +261 -0
  10. package/templates/v4/1.152/integration/ListReportJourney.ts +271 -0
  11. package/templates/v4/1.152/integration/ObjectPageJourney.js +301 -0
  12. package/templates/v4/1.152/integration/ObjectPageJourney.ts +328 -0
  13. package/templates/v4/1.152/integration/opaTests.qunit.html +28 -0
  14. package/templates/v4/1.152/integration/opaTests.qunit.js +33 -0
  15. package/templates/v4/1.152/integration/pages/FPM.js +30 -0
  16. package/templates/v4/1.152/integration/pages/FPM.ts +25 -0
  17. package/templates/v4/1.152/integration/pages/JourneyRunner.js +17 -0
  18. package/templates/v4/1.152/integration/pages/JourneyRunner.ts +36 -0
  19. package/templates/v4/1.152/integration/pages/ListReport.js +35 -0
  20. package/templates/v4/1.152/integration/pages/ListReport.ts +25 -0
  21. package/templates/v4/1.152/integration/pages/ObjectPage.js +35 -0
  22. package/templates/v4/1.152/integration/pages/ObjectPage.ts +25 -0
  23. package/templates/v4/1.152/integration/types/OpaJourneyTypes.d.ts +79 -0
  24. package/templates/v4/1.84/integration/FirstJourney.js +5 -5
  25. package/templates/v4/latest/integration/FirstJourney.js +5 -5
  26. package/templates/v4/latest/integration/ListReportJourney.js +6 -6
  27. package/templates/v4/latest/integration/ListReportJourney.ts +6 -6
@@ -0,0 +1,271 @@
1
+ /******************************************************************************
2
+ * ╔═══════════════════════════════════════════════════════════════════════╗ *
3
+ * ║ ║ *
4
+ * ║ WARNING: AUTO-GENERATED FILE ║ *
5
+ * ║ ║ *
6
+ * ║ This file is automatically generated by SAP Fiori tools and is ║ *
7
+ * ║ overwritten when you run the OPA test generator again. ║ *
8
+ * ║ ║ *
9
+ * ║ To add your own custom tests: ║ *
10
+ * ║ - Create a new journey test file in this directory. ║ *
11
+ * ║ - Follow the same pattern as this file. ║ *
12
+ * ║ - Add the new file to the opaTests.qunit.js config file. ║ *
13
+ * ║ - Custom journey files are not overwritten. ║ *
14
+ * ║ ║ *
15
+ * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
+ ******************************************************************************/
17
+
18
+ import opaTest from "sap/ui/test/opaQunit";
19
+ import type { Given, When, Then } from "./types/OpaJourneyTypes.gen";
20
+ <%_
21
+ const usesFilterFieldIdentifier =
22
+ !hideFilterBar && filterBarItems && filterBarItems.some(function(item) { return item.custom; });
23
+ const toolBarHasMenu = (toolBarActions || []).some(function(item) { return item.visible && item.menuActions && !item.splitButton; });
24
+ const toolBarHasDialogAction = (toolBarActions || []).some(function(item) {
25
+ return item.visible && !item.menuActions && !item.custom && item.enabled !== 'dynamic' &&
26
+ (item.isCritical || (item.parameterDialogFields && item.parameterDialogFields.length > 0));
27
+ });
28
+ -%>
29
+ <% if (usesFilterFieldIdentifier) { -%>
30
+ import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
31
+ <% } -%>
32
+ import runner from "./pages/JourneyRunner";
33
+ <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
34
+ import { SortOrder } from "sap/ui/core/library";
35
+ <%_ } -%>
36
+
37
+ function journey() {
38
+ QUnit.module("<%- name%>ListReport journey");
39
+
40
+ const defaultTableId = <%- tableIdentifiers && tableIdentifiers.length > 0 ? '"' + tableIdentifiers[0] + '"' : '""' %>;
41
+
42
+ opaTest("Start application", function (Given: Given, _When: When, Then: Then) {
43
+ Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
44
+ Given.iResetTestData();
45
+ Given.iStartMyApp();
46
+ <%_ startPages.forEach(function(pageName) { %>
47
+ Then.onThe<%- pageName %>Generated.iSeeThisPage();
48
+ <%_ }); -%>
49
+ });
50
+
51
+ <%_ if (!hideFilterBar && filterBarItems && filterBarItems.length > 0) { -%>
52
+ opaTest("Check filter bar", function (_Given: Given, _When: When, Then: Then) {
53
+ <%_ filterBarItems.forEach(function(item) { _%>
54
+ <%_ if (item.custom) { _%>
55
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- item.description %>" as unknown as FilterFieldIdentifier);
56
+ <%_ } else { _%>
57
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- item.property %>" });
58
+ <%_ } _%>
59
+ <%_ }); -%>
60
+ });
61
+ <%_ } -%>
62
+ <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
63
+ opaTest("Add semantic key properties to filter bar", function (_Given: Given, When: When, Then: Then) {
64
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
65
+ <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
66
+ When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
67
+ <%_ }); -%>
68
+ When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
69
+ <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
70
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
71
+ <%_ }); -%>
72
+ <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
73
+ // When.onThe<%- startLR%>Generated.onFilterBar().iChangeFilterField({ property: "<%- property %>" }, "<value to filter>", false);
74
+ <%_ }); -%>
75
+ // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
76
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
77
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
78
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<Action Name>", { enabled: true });
79
+ });
80
+ <%_ } -%>
81
+
82
+ // Note: this test will only work if the ListReport page has a search field and shows data that matches the search term. Please ensure that the test data and search term are set up accordingly.
83
+ // opaTest("Perform a global search and check the result", function (Given: Given, When: When, Then: Then) {
84
+ // When.onThe<%- startLR%>Generated.onFilterBar().iChangeSearchField("Search Term");
85
+ // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
86
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
87
+ // When.onThe<%- startLR%>Generated.onFilterBar().iChangeSearchField(undefined);
88
+ // Then.onThe<%- startLR%>Generated.onFilterBar().iCheckSearchField(undefined);
89
+ // });
90
+
91
+ <%_ if (tabs && tabs.length > 0) { -%>
92
+ opaTest("Check table columns and actions per tab", function (_Given: Given, When: When, Then: Then) {
93
+ <%_ tabs.forEach(function(tab) { _%>
94
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
95
+ <%_ if (tab.createButton.visible && !isALP) { _%>
96
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckCreate({ visible: true });
97
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressCreate();
98
+ <%_ } _%>
99
+ <%_ if (tab.deleteButton.visible) { _%>
100
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressDelete();
101
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckDelete({ visible: true });
102
+ <%_ } _%>
103
+ <%_ tab.toolBarActions.forEach(function(item) { _%>
104
+ <%_ if (item.visible) { _%>
105
+ <%_ if (item.custom) { _%>
106
+ <%_ if (item.labelUnresolved) { _%>
107
+ // TODO: label is an unresolved i18n key; replace with the rendered action text
108
+ <%_ } _%>
109
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction("<%- item.label %>");
110
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction("<%- item.label %>", { visible: true });
111
+ <%_ } else { _%>
112
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
113
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: <%- item.enabled === true %> });
114
+ <%_ } _%>
115
+ <%_ } _%>
116
+ <%_ }); _%>
117
+ <%_ if (Object.keys(tab.tableColumns).length > 0) { _%>
118
+ Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckColumns(undefined, <%- JSON.stringify(tab.tableColumns) %>);
119
+ <%_ } _%>
120
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckRows();
121
+ <%_ if (tab.contactCardColumns.length > 0) { _%>
122
+ // Reveal popin details so low-priority (e.g. contact-card) columns become clickable; no-op on grid/analytical tables.
123
+ When.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iExecuteShowHideDetails(true);
124
+ <%_ } _%>
125
+ <%_ tab.contactCardColumns.forEach(function(column) { _%>
126
+ // May fail if the mock data has no row at index 0 or that row does not render the contact link; adjust the row selector if needed.
127
+ When.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iClickLink(0, "<%- column.property %>");
128
+ Then.onThe<%- startLR %>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
129
+ <%_ }); _%>
130
+ <%_ }); -%>
131
+ });
132
+ <%_ } else { -%>
133
+ <%_ if ((toolBarActions && toolBarActions.length > 0 ) || (tableColumns && Object.keys(tableColumns).length > 0)) { -%>
134
+ opaTest("Check table columns and actions", function (_Given: Given, <% if (toolBarHasMenu || toolBarHasDialogAction) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
135
+ <%_ if (toolBarActions && toolBarActions.length > 0) { -%>
136
+ <%_ if (createButton.visible && !isALP) { _%>
137
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
138
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressCreate();
139
+ <%_ } _%>
140
+ <%_ if (deleteButton.visible) { _%>
141
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
142
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
143
+ <%_ } _%>
144
+ <%_ if (!hideFilterBar && toolBarHasDialogAction) { _%>
145
+ // Populate the table so the actions below have a row to select.
146
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
147
+ <%_ } _%>
148
+ <%_ toolBarActions.forEach(function(item) { _%>
149
+ <%_ if (item.visible) { _%>
150
+ <%_ if (item.menuActions) { _%>
151
+ <%_ if (item.splitButton) { _%>
152
+ // "<%- item.label %>" is a split menu button (has a default action); its drop-down cannot be opened via the test API, so its menu items are not checked. Pressing it triggers the default action:
153
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>");
154
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
155
+ <%_ } else { _%>
156
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>");
157
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
158
+ <%_ item.menuActions.forEach(function(menuAction) { _%>
159
+ <%_ if (menuAction.visible) { _%>
160
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckMenuAction("<%- menuAction.label %>");
161
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteMenuAction("<%- menuAction.label %>");
162
+ <%_ } _%>
163
+ <%_ }); _%>
164
+ <%_ } _%>
165
+ <%_ } else if (item.custom) { _%>
166
+ <%_ if (item.labelUnresolved) { _%>
167
+ // TODO: label is an unresolved i18n key; replace with the rendered action text
168
+ <%_ } _%>
169
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
170
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { visible: true });
171
+ <%_ } else { _%>
172
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
173
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: <%- item.enabled === true %> });
174
+ <%_ const hasParamDialog = item.parameterDialogFields && item.parameterDialogFields.length > 0; _%>
175
+ <%_ if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
176
+ // "<%- item.label %>" is conditionally enabled (Core.OperationAvailable path); it may be disabled for the selected row. Uncomment and select a row that enables it to test the <%- hasParamDialog ? 'action parameter dialog' : 'confirmation dialog' %>.
177
+ <%_ if (!hideFilterBar) { _%>
178
+ // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
179
+ <%_ } _%>
180
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
181
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
182
+ <%_ if (hasParamDialog) { _%>
183
+ <%_ item.parameterDialogFields.forEach(function(parameter) { _%>
184
+ // Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
185
+ <%_ }); _%>
186
+ // When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
187
+ <%_ } else { _%>
188
+ // Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
189
+ // When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
190
+ <%_ } _%>
191
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
192
+ <%_ } else if (item.isCritical || hasParamDialog) { _%>
193
+ <%_ if (item.enabled !== true) { _%>
194
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
195
+ <%_ } _%>
196
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
197
+ <%_ if (hasParamDialog) { _%>
198
+ <%_ item.parameterDialogFields.forEach(function(parameter) { _%>
199
+ Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
200
+ <%_ }); _%>
201
+ When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
202
+ <%_ } else { _%>
203
+ Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
204
+ When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
205
+ <%_ } _%>
206
+ <%_ if (item.enabled !== true) { _%>
207
+ // Deselect the row so the following actions start with an empty selection.
208
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
209
+ <%_ } _%>
210
+ <%_ } _%>
211
+ <%_ } _%>
212
+ <%_ } _%>
213
+ <%_ }); -%>
214
+ <%_ } -%>
215
+ <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
216
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
217
+ <%_ } -%>
218
+ });
219
+ <%_ } -%>
220
+ <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
221
+ opaTest("Check text annotation for columns", function (_Given: Given, When: When, Then: Then) {
222
+ <%_ textAnnotationColumns.forEach(function(column) { _%>
223
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.textProperty %>" }, SortOrder.Ascending);
224
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- column.textProperty %>" }, SortOrder.Ascending, true);
225
+ <%_ }); -%>
226
+ });
227
+ <%_ } -%>
228
+
229
+ <%_ if (contactCardColumns.length > 0) { -%>
230
+ opaTest("Check contact card links", function (_Given: Given, When: When, Then: Then) {
231
+ // Reveal popin details so low-priority (e.g. contact-card) columns become clickable; no-op on grid/analytical tables.
232
+ When.onThe<%- startLR %>Generated.onTable(defaultTableId).iExecuteShowHideDetails(true);
233
+ <%_ contactCardColumns.forEach(function(column) { _%>
234
+ // May fail if the mock data has no row at index 0 or that row does not render the contact link; adjust the row selector if needed.
235
+ When.onThe<%- startLR %>Generated.onTable(defaultTableId).iClickLink(0, "<%- column.property %>");
236
+ Then.onThe<%- startLR %>Generated.onDialog(defaultTableId).iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
237
+ <%_ }); -%>
238
+ });
239
+ <%_ } -%>
240
+ <%_ } -%>
241
+ <%_ if (startLR) { -%>
242
+ opaTest("Navigate to ObjectPage", function (_Given: Given, When: When, Then: Then) {
243
+ // Note: this test will fail if the ListReport page doesn't show any data
244
+ <%_ if (!hideFilterBar) { -%>
245
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
246
+ <%_ } -%>
247
+ <%_ if (tabs && tabs.length > 0) { -%>
248
+ <%_ const navTabId = navigatedOPTabKey || tableIdentifiers[0]; -%>
249
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- navTabId %>" });
250
+ Then.onThe<%- startLR%>Generated.onTable("<%- navTabId %>").iCheckRows();
251
+ <%_ if (navigatedOP) { -%>
252
+ When.onThe<%- startLR%>Generated.onTable("<%- navTabId %>").iPressRow(0);
253
+ Then.onThe<%- navigatedOP%>Generated.iSeeThisPage();
254
+ <%_ } -%>
255
+ <%_ } else { -%>
256
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
257
+ <%_ if (navigatedOP) { -%>
258
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressRow(0);
259
+ Then.onThe<%- navigatedOP%>Generated.iSeeThisPage();
260
+ <%_ } -%>
261
+ <%_ } -%>
262
+ });
263
+ <%_ } -%>
264
+
265
+ opaTest("Teardown", function (Given: Given) {
266
+ // Cleanup
267
+ Given.iTearDownMyApp();
268
+ });
269
+ }
270
+
271
+ runner.run([journey]);
@@ -0,0 +1,301 @@
1
+ /******************************************************************************
2
+ * ╔═══════════════════════════════════════════════════════════════════════╗ *
3
+ * ║ ║ *
4
+ * ║ WARNING: AUTO-GENERATED FILE ║ *
5
+ * ║ ║ *
6
+ * ║ This file is automatically generated by SAP Fiori tools and is ║ *
7
+ * ║ overwritten when you run the OPA test generator again. ║ *
8
+ * ║ ║ *
9
+ * ║ To add your own custom tests: ║ *
10
+ * ║ - Create a new journey test file in this directory. ║ *
11
+ * ║ - Follow the same pattern as this file. ║ *
12
+ * ║ - Add the new file to the opaTests.qunit.js config file. ║ *
13
+ * ║ - Custom journey files are not overwritten. ║ *
14
+ * ║ ║ *
15
+ * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
+ ******************************************************************************/
17
+
18
+ sap.ui.define([
19
+ "sap/ui/test/opaQunit",
20
+ "./pages/JourneyRunner"
21
+ ], function (opaTest, runner) {
22
+ "use strict";
23
+
24
+ function journey() {
25
+ QUnit.module("<%- name%>ObjectPage journey");
26
+
27
+ opaTest("Navigate to <%- name%>ObjectPage", function (Given, When, Then) {
28
+ Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
29
+ Given.iResetTestData();
30
+ Given.iStartMyApp();
31
+ <% if(navigationParents.parentLRName) { -%>
32
+ <% const parentTableId = navigationParents.parentLRViewKey ? '"' + navigationParents.parentLRViewKey + '"' : ''; -%>
33
+ <% if (!hideFilterBar) { -%>
34
+ When.onThe<%- navigationParents.parentLRName%>Generated.onFilterBar().iExecuteSearch();
35
+ <% } -%>
36
+ <% if (navigationParents.parentLRViewKey && !navigationParents.parentLRViewIsDefault) { -%>
37
+ When.onThe<%- navigationParents.parentLRName%>Generated.iGoToView({ key: "<%- navigationParents.parentLRViewKey %>" });
38
+ <% } -%>
39
+ Then.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- parentTableId %>).iCheckRows();
40
+ When.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- parentTableId %>).iPressRow(0);
41
+ <% } -%>
42
+ <% navigationParents.parentOPs.forEach(function(parent) { %>
43
+ Then.onThe<%- parent.name %>Generated.iSeeThisPage();
44
+ Then.onThe<%- parent.name %>Generated.onTable({ property: "<%- parent.navigationProperty %>" }).iCheckRows();
45
+ When.onThe<%- parent.name %>Generated.onTable({ property: "<%- parent.navigationProperty %>" }).iPressRow(0);
46
+ <% }); %>
47
+ Then.onThe<%- name%>Generated.iSeeThisPage();
48
+ });
49
+
50
+ <% if (headerActions?.length > 0) { -%>
51
+ opaTest("Check header actions of the Object Page", function (Given, When, Then) {
52
+ <% if (editButton?.visible) { -%>
53
+ // Ensure the opened entity is not in Draft state before uncommenting
54
+ // Then.onThe<%- name%>Generated.onHeader().iCheckEdit({ visible: true });
55
+ // When.onThe<%- name%>Generated.onHeader().iExecuteEdit();
56
+ <% } -%>
57
+ <% headerActions.forEach(function(action) { -%>
58
+ <% if (action.visible) { -%>
59
+ <% if (action.menuActions) { -%>
60
+ <% if (action.splitButton) { -%>
61
+ // <%- JSON.stringify(action.label) %> is a split menu button (has a default action); its drop-down cannot be opened via the test API, so its menu items are not checked. Pressing it triggers the default action:
62
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>);
63
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
64
+ <% } else { -%>
65
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>);
66
+ When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
67
+ <% action.menuActions.forEach(function(menuAction) { -%>
68
+ <% if (menuAction.visible) { -%>
69
+ Then.onThe<%- name%>Generated.onHeader().iCheckMenuAction(<%- JSON.stringify(menuAction.label) %>);
70
+ // When.onThe<%- name%>Generated.onHeader().iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
71
+ <% } -%>
72
+ <% }); -%>
73
+ <% } -%>
74
+ <% } else if (action.custom) { -%>
75
+ <% if (action.labelUnresolved) { -%>
76
+ // TODO: label is an unresolved i18n key; replace with the rendered action text
77
+ <% } -%>
78
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
79
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
80
+ <% } else if (action.enabled === 'dynamic') { -%>
81
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
82
+ <% } else { -%>
83
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
84
+ <% } -%>
85
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
86
+ // "<%- action.label || action.action %>" is critical but conditionally enabled (Core.OperationAvailable path); it may be disabled for the opened entity. Uncomment when the entity state enables it to test the confirmation dialog.
87
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
88
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
89
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
90
+ <% } else if (action.isCritical) { -%>
91
+ When.onThe<%- name%>Generated.onHeader().iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
92
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
93
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
94
+ <% } else if (!action.custom && !action.menuActions) { -%>
95
+ // When.onThe<%- name%>Generated.onHeader().iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
96
+ <% } -%>
97
+ <% } -%>
98
+ <% }); -%>
99
+ });
100
+ <% } -%>
101
+
102
+ <% if (headerTitle) { -%>
103
+ opaTest("Check header title of the Object Page", function (_Given, _When, Then) {
104
+ Then.onThe<%- name%>Generated.onHeader().iCheckTitlePath(<%- JSON.stringify(headerTitle) %>);
105
+ });
106
+
107
+ <% } -%>
108
+ <% if (headerSections?.length > 0) { -%>
109
+ opaTest("Check header facets of the Object Page", function (Given, When, Then) {
110
+ <% headerSections.forEach(function(section) { -%>
111
+ <% if (section.microChart) { -%>
112
+ Then.onThe<%- name%>Generated.onHeader().iCheckMicroChart("<%- section.title %>");
113
+ <% } else { -%>
114
+ Then.onThe<%- name%>Generated.onHeader().iCheckHeaderFacet({ facetId: "<%- section.facetId %>"<% if (section.custom) { %>, custom: true<% } %> });
115
+ <% if (section.form) { -%>
116
+ <% section.fields.forEach(function(field) { -%>
117
+ Then.onThe<%- name%>Generated.onHeader().iCheckFieldInFieldGroup({
118
+ fieldGroup: "<%- field.fieldGroupQualifier %>",
119
+ field: "<%- field.field %>",
120
+ targetAnnotation: "<%- field.targetAnnotation %>"
121
+ });
122
+ <% }) -%>
123
+ <% section.contactCardFields.forEach(function(field) { -%>
124
+ When.onThe<%- name%>Generated.onHeader().iClickLink({ property: "<%- field.property %>" });
125
+ Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
126
+ <% }) -%>
127
+ <% } -%>
128
+ <% } -%>
129
+ <% }) -%>
130
+ });
131
+ <% } -%>
132
+
133
+ <% if (bodySections?.length > 1) { -%>
134
+ opaTest("Check the number of sections of the Object Page", function (_Given, _When, Then) {
135
+ Then.onThe<%- name%>Generated.iCheckNumberOfSections(<%- bodySections.length %>);
136
+ });
137
+
138
+ <% } -%>
139
+ <% if (bodySections?.length > 0) { -%>
140
+ <% bodySections.forEach(function(section) { -%>
141
+ opaTest("Check the <%- section.id %> section of the Object Page", function (_Given, <% if (bodySections.length > 1 || (section.subSections && section.subSections.length > 1) || (section.contactCardFields && section.contactCardFields.length > 0) || (section.contactCardColumns && section.contactCardColumns.length > 0) || (section.subSections || []).some(function(sub){ return (sub.contactCardFields && sub.contactCardFields.length > 0) || (sub.contactCardColumns && sub.contactCardColumns.length > 0); }) || (section.actions || []).some(function(a){ return a.visible && ((a.isCritical && a.enabled !== 'dynamic') || a.menuActions); })) { %>When<% } else { %>_When<% } %>, Then) {
142
+ <% if (bodySections.length > 1) { -%>
143
+ When.onThe<%- name%>Generated.iGoToSection({ section: "<%- section.id %>" });
144
+ <% } -%>
145
+ Then.onThe<%- name%>Generated.iCheckSection({ section: "<%- section.id %>" });
146
+ <% if (section.actions && section.actions.length > 0) { -%>
147
+ <% section.actions.forEach(function(action) { -%>
148
+ <% if (action.visible) { -%>
149
+ <% if (section.isTable && section.navigationProperty) { -%>
150
+ <% if (action.menuActions) { -%>
151
+ <% if (action.splitButton) { -%>
152
+ // <%- JSON.stringify(action.label) %> is a split menu button (has a default action); its drop-down cannot be opened via the test API, so its menu items are not checked. Pressing it triggers the default action:
153
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
154
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
155
+ <% } else { -%>
156
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
157
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
158
+ <% action.menuActions.forEach(function(menuAction) { -%>
159
+ <% if (menuAction.visible) { -%>
160
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckMenuAction(<%- JSON.stringify(menuAction.label) %>);
161
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
162
+ <% } -%>
163
+ <% }); -%>
164
+ <% } -%>
165
+ <% } else if (action.custom) { -%>
166
+ <% if (action.labelUnresolved) { -%>
167
+ // TODO: label is an unresolved i18n key; replace with the rendered action text
168
+ <% } -%>
169
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
170
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
171
+ <% } else if (action.enabled === 'dynamic') { -%>
172
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
173
+ <% } else { -%>
174
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
175
+ <% } -%>
176
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
177
+ // "<%- action.label || action.action %>" is critical but conditionally enabled (Core.OperationAvailable path); it may be disabled for the selected row. Uncomment and select a row that enables it to test the confirmation dialog.
178
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
179
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
180
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
181
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
182
+ <% } else if (action.isCritical) { -%>
183
+ // Critical action (Common.IsActionCritical): select a row, press it, assert the confirmation dialog opens, then cancel so it is not executed.
184
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
185
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
186
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
187
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
188
+ // Deselect the row so the following actions start with an empty selection.
189
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
190
+ <% } else if (!action.custom && !action.menuActions) { -%>
191
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
192
+ <% } -%>
193
+ <% } else { -%>
194
+ <% if (action.menuActions) { -%>
195
+ <% if (action.splitButton) { -%>
196
+ // <%- JSON.stringify(action.label) %> is a split menu button (has a default action); its drop-down cannot be opened via the test API, so its menu items are not checked. Pressing it triggers the default action:
197
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
198
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
199
+ <% } else { -%>
200
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
201
+ When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
202
+ <% action.menuActions.forEach(function(menuAction) { -%>
203
+ <% if (menuAction.visible) { -%>
204
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckMenuAction(<%- JSON.stringify(menuAction.label) %>);
205
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
206
+ <% } -%>
207
+ <% }); -%>
208
+ <% } -%>
209
+ <% } else if (action.custom) { -%>
210
+ <% if (action.labelUnresolved) { -%>
211
+ // TODO: label is an unresolved i18n key; replace with the rendered action text
212
+ <% } -%>
213
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
214
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
215
+ <% } else if (action.enabled === 'dynamic') { -%>
216
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
217
+ <% } else { -%>
218
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
219
+ <% } -%>
220
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
221
+ // "<%- action.label || action.action %>" is critical but conditionally enabled (Core.OperationAvailable path); it may be disabled for the opened entity. Uncomment when the entity state enables it to test the confirmation dialog.
222
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
223
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
224
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
225
+ <% } else if (action.isCritical) { -%>
226
+ // Critical action (Common.IsActionCritical): press it, assert the confirmation dialog opens, then cancel so it is not executed.
227
+ When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
228
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
229
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
230
+ <% } else if (!action.custom && !action.menuActions) { -%>
231
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
232
+ <% } -%>
233
+ <% } -%>
234
+ <% } -%>
235
+ <% }); -%>
236
+ <% } -%>
237
+ <% if (section.isTable && section.navigationProperty) { -%>
238
+ <% if (section.createButton?.visible) { -%>
239
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckCreate({ visible: true });
240
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressCreate();
241
+ <% } -%>
242
+ <% if (section.deleteButton?.visible) { -%>
243
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckDelete({ visible: true });
244
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressDelete();
245
+ <% } -%>
246
+ <% section.contactCardColumns.forEach(function(column) { -%>
247
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iClickLink(0, "<%- column.property %>");
248
+ Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
249
+ <% }) -%>
250
+ <% } -%>
251
+ <% if (section?.subSections?.length > 0) { -%>
252
+ <% section.subSections.forEach(function(subSection) { -%>
253
+ <% if (section.subSections.length > 1) { -%>
254
+ When.onThe<%- name%>Generated.iGoToSection({ section: "<%- section.id %>", subSection: "<%- subSection.id %>" });
255
+ Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" });
256
+ <% } -%>
257
+ <% if (subSection.fields && subSection.fields.length > 0) { -%>
258
+ <% subSection.fields.forEach(function(field) { -%>
259
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
260
+ <% }) -%>
261
+ <% } -%>
262
+ <% subSection.contactCardFields.forEach(function(field) { -%>
263
+ When.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iClickLink({ property: "<%- field.property %>" });
264
+ Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
265
+ <% }) -%>
266
+ <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
267
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(subSection.tableColumns) %>);
268
+ <% } -%>
269
+ <% if (subSection.navigationProperty) { -%>
270
+ <% subSection.contactCardColumns.forEach(function(column) { -%>
271
+ When.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iClickLink(0, "<%- column.property %>");
272
+ Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
273
+ <% }) -%>
274
+ <% } -%>
275
+ <% }) -%>
276
+ <% } else { -%>
277
+ <% if (section.fields && section.fields.length > 0) { -%>
278
+ <% section.fields.forEach(function(field) { -%>
279
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
280
+ <% }) -%>
281
+ <% } -%>
282
+ <% section.contactCardFields.forEach(function(field) { -%>
283
+ When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iClickLink({ property: "<%- field.property %>" });
284
+ Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
285
+ <% }) -%>
286
+ <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
287
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(section.tableColumns) %>);
288
+ <% } -%>
289
+ <% } -%>
290
+ });
291
+
292
+ <% }) -%>
293
+ <% } -%>
294
+ opaTest("Teardown", function (Given, When, Then) {
295
+ // Cleanup
296
+ Given.iTearDownMyApp();
297
+ });
298
+ }
299
+
300
+ runner.run([journey]);
301
+ });