@sap-ux/ui5-test-writer 1.16.3 → 1.17.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.
@@ -77,34 +77,134 @@ sap.ui.define([
77
77
  // });
78
78
 
79
79
  <%_ if (tabs && tabs.length > 0) { -%>
80
- opaTest("Check table columns and actions per tab", function (Given, When, Then) {
81
- <%_ tabs.forEach(function(tab) { _%>
80
+ <%_ tabs.forEach(function(tab) { -%>
81
+ /// View "<%- tab.key %>" ///
82
+ <%_ if (tab.createButton.visible && !isALP) { -%>
83
+ opaTest(<%- JSON.stringify("Check the create button in view " + tab.key) %>, function (Given, When, Then) {
82
84
  When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
83
- <%_ if (tab.createButton.visible && !isALP) { _%>
84
85
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckCreate({ visible: true });
85
- // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressCreate();
86
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteCreate();
87
+ });
88
+
89
+ <%_ } -%>
90
+ <%_ if (tab.deleteButton.visible) { -%>
91
+ opaTest(<%- JSON.stringify("Check the delete button in view " + tab.key) %>, function (Given, When, Then) {
92
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
93
+ <%_ const deleteIsSelectionGated = tab.deleteButton.enabled === true; _%>
94
+ <%_ if (deleteIsSelectionGated) { _%>
95
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckDelete({ visible: true, enabled: false });
96
+ <%_ if (!hideFilterBar) { _%>
97
+ // Populate the table and select a row so Delete becomes enabled.
98
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
86
99
  <%_ } _%>
87
- <%_ if (tab.deleteButton.visible) { _%>
88
- // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressDelete();
100
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
101
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckDelete({ visible: true, enabled: true });
102
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteDelete();
103
+ // Deselect the row so the following actions start with an empty selection.
104
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
105
+ <%_ } else { _%>
89
106
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckDelete({ visible: true });
107
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteDelete();
90
108
  <%_ } _%>
91
- <%_ tab.toolBarActions.forEach(function(item) { _%>
92
- <%_ if (item.visible) { _%>
93
- <%_ if (item.custom) { _%>
109
+ });
110
+
111
+ <%_ } -%>
112
+ <%_ tab.toolBarActions.forEach(function(item) { -%>
113
+ <%_ if (item.visible) { -%>
114
+ opaTest(<%- JSON.stringify("Check the " + item.label + " action in view " + tab.key) %>, function (Given, When, Then) {
115
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
116
+ <%_ if (item.menuActions) { _%>
117
+ <%_ if (item.splitButton) { _%>
118
+ // "<%- 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:
119
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction("<%- item.label %>");
120
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction("<%- item.label %>");
121
+ <%_ } else { _%>
122
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction("<%- item.label %>");
123
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction("<%- item.label %>");
124
+ <%_ item.menuActions.forEach(function(menuAction) { _%>
125
+ <%_ if (menuAction.visible) { _%>
126
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckMenuAction("<%- menuAction.label %>");
127
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteMenuAction("<%- menuAction.label %>");
128
+ <%_ } _%>
129
+ <%_ }); _%>
130
+ <%_ } _%>
131
+ <%_ } else if (item.custom) { _%>
94
132
  <%_ if (item.labelUnresolved) { _%>
95
133
  // TODO: label is an unresolved i18n key; replace with the rendered action text
96
134
  <%_ } _%>
97
- // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction("<%- item.label %>");
98
135
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction("<%- item.label %>", { visible: true });
136
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction("<%- item.label %>");
99
137
  <%_ } else { _%>
100
- // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
138
+ <%_ const hasParamDialog = item.parameterDialogFields && item.parameterDialogFields.length > 0; _%>
101
139
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: <%- item.enabled === true %> });
140
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
141
+ <%_ if (item.selectionEnables && !item.isCritical && !hasParamDialog) { _%>
142
+ <%_ if (!hideFilterBar) { _%>
143
+ // Populate the table and select a row so the action becomes enabled.
144
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
102
145
  <%_ } _%>
146
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
147
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: true });
148
+ // Deselect the row so the following actions start with an empty selection.
149
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
150
+ <%_ } else if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
151
+ // "<%- 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' %>.
152
+ <%_ if (!hideFilterBar) { _%>
153
+ // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
103
154
  <%_ } _%>
155
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
156
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
157
+ <%_ if (hasParamDialog) { _%>
158
+ <%_ item.parameterDialogFields.forEach(function(parameter) { _%>
159
+ // Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
104
160
  <%_ }); _%>
105
- <%_ if (Object.keys(tab.tableColumns).length > 0) { _%>
106
- Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckColumns(undefined, <%- JSON.stringify(tab.tableColumns) %>);
161
+ // When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
162
+ <%_ } else { _%>
163
+ // Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
164
+ // When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
165
+ <%_ } _%>
166
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
167
+ <%_ } else if (item.isCritical || hasParamDialog) { _%>
168
+ <%_ if (!hideFilterBar) { _%>
169
+ // Populate the table so the action below has a row to select.
170
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
171
+ <%_ } _%>
172
+ <%_ if (item.enabled !== true) { _%>
173
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
174
+ <%_ } _%>
175
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
176
+ <%_ if (hasParamDialog) { _%>
177
+ <%_ item.parameterDialogFields.forEach(function(parameter) { _%>
178
+ Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
179
+ <%_ }); _%>
180
+ When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
181
+ <%_ } else { _%>
182
+ Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
183
+ When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
107
184
  <%_ } _%>
185
+ <%_ if (item.enabled !== true) { _%>
186
+ // Deselect the row so the following actions start with an empty selection.
187
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
188
+ <%_ } _%>
189
+ <%_ } _%>
190
+ <%_ } _%>
191
+ });
192
+
193
+ <%_ } -%>
194
+ <%_ }); -%>
195
+ <%_ if (Object.keys(tab.tableColumns).length > 0) { -%>
196
+ opaTest(<%- JSON.stringify("Check table columns in view " + tab.key) %>, function (Given, When, Then) {
197
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
198
+ Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckColumns(undefined, <%- JSON.stringify(tab.tableColumns) %>);
199
+ });
200
+
201
+ <%_ } -%>
202
+ opaTest(<%- JSON.stringify("Check table rows in view " + tab.key) %>, function (Given, When, Then) {
203
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
204
+ <%_ if (!hideFilterBar) { -%>
205
+ // Populate the table so the row check has data.
206
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
207
+ <%_ } -%>
108
208
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckRows();
109
209
  <%_ if (tab.contactCardColumns.length > 0) { _%>
110
210
  // Reveal popin details so low-priority (e.g. contact-card) columns become clickable
@@ -115,27 +215,42 @@ sap.ui.define([
115
215
  When.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iClickLink(0, "<%- column.property %>");
116
216
  Then.onThe<%- startLR %>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
117
217
  <%_ }); _%>
118
- <%_ }); -%>
119
218
  });
219
+
220
+ <%_ }); -%>
120
221
  <%_ } else { -%>
121
- <%_ if ((toolBarActions && toolBarActions.length > 0 ) || (tableColumns && Object.keys(tableColumns).length > 0)) { -%>
122
- opaTest("Check table columns and actions", function (Given, When, Then) {
123
- <%_ if (toolBarActions && toolBarActions.length > 0) { -%>
124
- <%_ if (createButton.visible && !isALP) { _%>
222
+ <%_ if (createButton.visible && !isALP) { -%>
223
+ opaTest("Check the create button", function (Given, When, Then) {
125
224
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
126
225
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressCreate();
226
+ });
227
+
228
+ <%_ } -%>
229
+ <%_ if (deleteButton.visible) { -%>
230
+ opaTest("Check the delete button", function (Given, When, Then) {
231
+ <%_ /* deleteButton.enabled = Capabilities Deletable (not current UI state); when deletable, Delete is selection-gated: disabled with no selection, enabled once a row is selected. */ -%>
232
+ <%_ const deleteIsSelectionGated = deleteButton.enabled === true; _%>
233
+ <%_ if (deleteIsSelectionGated) { _%>
234
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true, enabled: false });
235
+ <%_ if (!hideFilterBar) { _%>
236
+ // Populate the table and select a row so Delete becomes enabled.
237
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
127
238
  <%_ } _%>
128
- <%_ if (deleteButton.visible) { _%>
129
- // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
239
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
240
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true, enabled: true });
241
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteDelete();
242
+ // Deselect the row so the following actions start with an empty selection.
243
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
244
+ <%_ } else { _%>
130
245
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
246
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteDelete();
131
247
  <%_ } _%>
132
- <%_ const toolBarHasDialogAction = (toolBarActions || []).some(function(action) { return action.visible && !action.menuActions && !action.custom && action.enabled !== 'dynamic' && (action.isCritical || (action.parameterDialogFields && action.parameterDialogFields.length > 0)); }); _%>
133
- <%_ if (!hideFilterBar && toolBarHasDialogAction) { _%>
134
- // Populate the table so the actions below have a row to select.
135
- When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
136
- <%_ } _%>
137
- <%_ toolBarActions.forEach(function(item) { _%>
138
- <%_ if (item.visible) { _%>
248
+ });
249
+
250
+ <%_ } -%>
251
+ <%_ (toolBarActions || []).forEach(function(item) { -%>
252
+ <%_ if (item.visible) { -%>
253
+ opaTest(<%- JSON.stringify("Check the " + item.label + " action") %>, function (Given, When, Then) {
139
254
  <%_ if (item.menuActions) { _%>
140
255
  <%_ if (item.splitButton) { _%>
141
256
  // "<%- 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:
@@ -161,7 +276,16 @@ sap.ui.define([
161
276
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
162
277
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: <%- item.enabled === true %> });
163
278
  <%_ const hasParamDialog = item.parameterDialogFields && item.parameterDialogFields.length > 0; _%>
164
- <%_ if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
279
+ <%_ if (item.selectionEnables && !item.isCritical && !hasParamDialog) { _%>
280
+ <%_ if (!hideFilterBar) { _%>
281
+ // Populate the table and select a row so the action becomes enabled.
282
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
283
+ <%_ } _%>
284
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
285
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: true });
286
+ // Deselect the row so the following actions start with an empty selection.
287
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
288
+ <%_ } else if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
165
289
  // "<%- 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' %>.
166
290
  <%_ if (!hideFilterBar) { _%>
167
291
  // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
@@ -179,6 +303,10 @@ sap.ui.define([
179
303
  <%_ } _%>
180
304
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
181
305
  <%_ } else if (item.isCritical || hasParamDialog) { _%>
306
+ <%_ if (!hideFilterBar) { _%>
307
+ // Populate the table so the action below has a row to select.
308
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
309
+ <%_ } _%>
182
310
  <%_ if (item.enabled !== true) { _%>
183
311
  When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
184
312
  <%_ } _%>
@@ -198,13 +326,15 @@ sap.ui.define([
198
326
  <%_ } _%>
199
327
  <%_ } _%>
200
328
  <%_ } _%>
201
- <%_ } _%>
202
- <%_ }); -%>
203
- <%_ } -%>
204
- <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
329
+ });
330
+
331
+ <%_ } -%>
332
+ <%_ }); -%>
333
+ <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
334
+ opaTest("Check table columns", function (Given, When, Then) {
205
335
  Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
206
- <%_ } -%>
207
336
  });
337
+
208
338
  <%_ } -%>
209
339
  <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
210
340
  opaTest("Check text annotation for columns", function (Given, When, Then) {
@@ -213,6 +343,7 @@ sap.ui.define([
213
343
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- column.textProperty %>" }, coreLibrary.SortOrder.Ascending, true);
214
344
  <%_ }); -%>
215
345
  });
346
+
216
347
  <%_ } -%>
217
348
  <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0 && columnPersonalizationSupported !== false) { -%>
218
349
  opaTest("Check columns in adaptation dialog", function (Given, When, Then) {
@@ -223,8 +354,8 @@ sap.ui.define([
223
354
  <%_ }); -%>
224
355
  When.onThe<%- startLR%>Generated.onTable(defaultTableId).iConfirmColumnAdaptation();
225
356
  });
226
- <%_ } -%>
227
357
 
358
+ <%_ } -%>
228
359
  <%_ if (contactCardColumns.length > 0) { -%>
229
360
  opaTest("Check contact card links", function (Given, When, Then) {
230
361
  // Reveal popin details so low-priority (e.g. contact-card) columns become clickable
@@ -20,11 +20,6 @@ import type { Given, When, Then } from "./types/OpaJourneyTypes.gen";
20
20
  <%_
21
21
  const usesFilterFieldIdentifier =
22
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
23
  -%>
29
24
  <% if (usesFilterFieldIdentifier) { -%>
30
25
  import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
@@ -89,34 +84,134 @@ function journey() {
89
84
  // });
90
85
 
91
86
  <%_ 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) { _%>
87
+ <%_ tabs.forEach(function(tab) { -%>
88
+ /// View "<%- tab.key %>" ///
89
+ <%_ if (tab.createButton.visible && !isALP) { -%>
90
+ opaTest(<%- JSON.stringify("Check the create button in view " + tab.key) %>, function (_Given: Given, When: When, Then: Then) {
94
91
  When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
95
- <%_ if (tab.createButton.visible && !isALP) { _%>
96
92
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckCreate({ visible: true });
97
- // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressCreate();
93
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteCreate();
94
+ });
95
+
96
+ <%_ } -%>
97
+ <%_ if (tab.deleteButton.visible) { -%>
98
+ opaTest(<%- JSON.stringify("Check the delete button in view " + tab.key) %>, function (_Given: Given, When: When, Then: Then) {
99
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
100
+ <%_ const deleteIsSelectionGated = tab.deleteButton.enabled === true; _%>
101
+ <%_ if (deleteIsSelectionGated) { _%>
102
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckDelete({ visible: true, enabled: false });
103
+ <%_ if (!hideFilterBar) { _%>
104
+ // Populate the table and select a row so Delete becomes enabled.
105
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
98
106
  <%_ } _%>
99
- <%_ if (tab.deleteButton.visible) { _%>
100
- // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressDelete();
107
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
108
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckDelete({ visible: true, enabled: true });
109
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteDelete();
110
+ // Deselect the row so the following actions start with an empty selection.
111
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
112
+ <%_ } else { _%>
101
113
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckDelete({ visible: true });
114
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteDelete();
102
115
  <%_ } _%>
103
- <%_ tab.toolBarActions.forEach(function(item) { _%>
104
- <%_ if (item.visible) { _%>
105
- <%_ if (item.custom) { _%>
116
+ });
117
+
118
+ <%_ } -%>
119
+ <%_ tab.toolBarActions.forEach(function(item) { -%>
120
+ <%_ if (item.visible) { -%>
121
+ opaTest(<%- JSON.stringify("Check the " + item.label + " action in view " + tab.key) %>, function (_Given: Given, When: When, Then: Then) {
122
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
123
+ <%_ if (item.menuActions) { _%>
124
+ <%_ if (item.splitButton) { _%>
125
+ // "<%- 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:
126
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction("<%- item.label %>");
127
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction("<%- item.label %>");
128
+ <%_ } else { _%>
129
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction("<%- item.label %>");
130
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction("<%- item.label %>");
131
+ <%_ item.menuActions.forEach(function(menuAction) { _%>
132
+ <%_ if (menuAction.visible) { _%>
133
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckMenuAction("<%- menuAction.label %>");
134
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteMenuAction("<%- menuAction.label %>");
135
+ <%_ } _%>
136
+ <%_ }); _%>
137
+ <%_ } _%>
138
+ <%_ } else if (item.custom) { _%>
106
139
  <%_ if (item.labelUnresolved) { _%>
107
140
  // TODO: label is an unresolved i18n key; replace with the rendered action text
108
141
  <%_ } _%>
109
- // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction("<%- item.label %>");
110
142
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction("<%- item.label %>", { visible: true });
143
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction("<%- item.label %>");
111
144
  <%_ } else { _%>
112
- // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
145
+ <%_ const hasParamDialog = item.parameterDialogFields && item.parameterDialogFields.length > 0; _%>
113
146
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: <%- item.enabled === true %> });
147
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
148
+ <%_ if (item.selectionEnables && !item.isCritical && !hasParamDialog) { _%>
149
+ <%_ if (!hideFilterBar) { _%>
150
+ // Populate the table and select a row so the action becomes enabled.
151
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
152
+ <%_ } _%>
153
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
154
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: true });
155
+ // Deselect the row so the following actions start with an empty selection.
156
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
157
+ <%_ } else if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
158
+ // "<%- 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' %>.
159
+ <%_ if (!hideFilterBar) { _%>
160
+ // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
114
161
  <%_ } _%>
162
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
163
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
164
+ <%_ if (hasParamDialog) { _%>
165
+ <%_ item.parameterDialogFields.forEach(function(parameter) { _%>
166
+ // Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
167
+ <%_ }); _%>
168
+ // When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
169
+ <%_ } else { _%>
170
+ // Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
171
+ // When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
115
172
  <%_ } _%>
173
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
174
+ <%_ } else if (item.isCritical || hasParamDialog) { _%>
175
+ <%_ if (!hideFilterBar) { _%>
176
+ // Populate the table so the action below has a row to select.
177
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
178
+ <%_ } _%>
179
+ <%_ if (item.enabled !== true) { _%>
180
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
181
+ <%_ } _%>
182
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
183
+ <%_ if (hasParamDialog) { _%>
184
+ <%_ item.parameterDialogFields.forEach(function(parameter) { _%>
185
+ Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
116
186
  <%_ }); _%>
117
- <%_ if (Object.keys(tab.tableColumns).length > 0) { _%>
118
- Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckColumns(undefined, <%- JSON.stringify(tab.tableColumns) %>);
187
+ When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
188
+ <%_ } else { _%>
189
+ Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
190
+ When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
119
191
  <%_ } _%>
192
+ <%_ if (item.enabled !== true) { _%>
193
+ // Deselect the row so the following actions start with an empty selection.
194
+ When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iSelectRows(0);
195
+ <%_ } _%>
196
+ <%_ } _%>
197
+ <%_ } _%>
198
+ });
199
+
200
+ <%_ } -%>
201
+ <%_ }); -%>
202
+ <%_ if (Object.keys(tab.tableColumns).length > 0) { -%>
203
+ opaTest(<%- JSON.stringify("Check table columns in view " + tab.key) %>, function (_Given: Given, When: When, Then: Then) {
204
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
205
+ Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckColumns(undefined, <%- JSON.stringify(tab.tableColumns) %>);
206
+ });
207
+
208
+ <%_ } -%>
209
+ opaTest(<%- JSON.stringify("Check table rows in view " + tab.key) %>, function (_Given: Given, When: When, Then: Then) {
210
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
211
+ <%_ if (!hideFilterBar) { -%>
212
+ // Populate the table so the row check has data.
213
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
214
+ <%_ } -%>
120
215
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckRows();
121
216
  <%_ if (tab.contactCardColumns.length > 0) { _%>
122
217
  // Reveal popin details so low-priority (e.g. contact-card) columns become clickable; no-op on grid/analytical tables.
@@ -127,26 +222,44 @@ function journey() {
127
222
  When.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iClickLink(0, "<%- column.property %>");
128
223
  Then.onThe<%- startLR %>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
129
224
  <%_ }); _%>
130
- <%_ }); -%>
131
225
  });
226
+
227
+ <%_ }); -%>
132
228
  <%_ } 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) { _%>
229
+ <%_ if (createButton.visible && !isALP) { -%>
230
+ opaTest("Check the create button", function (_Given: Given, _When: When, Then: Then) {
137
231
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
138
232
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressCreate();
233
+ });
234
+
235
+ <%_ } -%>
236
+ <%_ if (deleteButton.visible) { -%>
237
+ <%_ /* deleteButton.enabled = Capabilities Deletable (not current UI state); when deletable, Delete is selection-gated: disabled with no selection, enabled once a row is selected. */ -%>
238
+ <%_ const deleteIsSelectionGated = deleteButton.enabled === true; -%>
239
+ opaTest("Check the delete button", function (_Given: Given, <% if (deleteIsSelectionGated) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
240
+ <%_ if (deleteIsSelectionGated) { _%>
241
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true, enabled: false });
242
+ <%_ if (!hideFilterBar) { _%>
243
+ // Populate the table and select a row so Delete becomes enabled.
244
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
139
245
  <%_ } _%>
140
- <%_ if (deleteButton.visible) { _%>
141
- // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
246
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
247
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true, enabled: true });
248
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteDelete();
249
+ // Deselect the row so the following actions start with an empty selection.
250
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
251
+ <%_ } else { _%>
142
252
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
253
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteDelete();
143
254
  <%_ } _%>
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) { _%>
255
+ });
256
+
257
+ <%_ } -%>
258
+ <%_ (toolBarActions || []).forEach(function(item) { -%>
259
+ <%_ if (item.visible) { -%>
260
+ <%_ const hasParamDialog = item.parameterDialogFields && item.parameterDialogFields.length > 0; _%>
261
+ <%_ const usesWhen = (item.menuActions && !item.splitButton) || (!item.menuActions && !item.custom && ((item.selectionEnables && !item.isCritical && !hasParamDialog) || ((item.isCritical || hasParamDialog) && item.enabled !== 'dynamic'))); _%>
262
+ opaTest(<%- JSON.stringify("Check the " + item.label + " action") %>, function (_Given: Given, <% if (usesWhen) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
150
263
  <%_ if (item.menuActions) { _%>
151
264
  <%_ if (item.splitButton) { _%>
152
265
  // "<%- 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:
@@ -171,8 +284,16 @@ function journey() {
171
284
  <%_ } else { _%>
172
285
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
173
286
  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') { _%>
287
+ <%_ if (item.selectionEnables && !item.isCritical && !hasParamDialog) { _%>
288
+ <%_ if (!hideFilterBar) { _%>
289
+ // Populate the table and select a row so the action becomes enabled.
290
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
291
+ <%_ } _%>
292
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
293
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: true });
294
+ // Deselect the row so the following actions start with an empty selection.
295
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
296
+ <%_ } else if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
176
297
  // "<%- 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
298
  <%_ if (!hideFilterBar) { _%>
178
299
  // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
@@ -190,6 +311,10 @@ function journey() {
190
311
  <%_ } _%>
191
312
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
192
313
  <%_ } else if (item.isCritical || hasParamDialog) { _%>
314
+ <%_ if (!hideFilterBar) { _%>
315
+ // Populate the table so the action below has a row to select.
316
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
317
+ <%_ } _%>
193
318
  <%_ if (item.enabled !== true) { _%>
194
319
  When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
195
320
  <%_ } _%>
@@ -209,13 +334,15 @@ function journey() {
209
334
  <%_ } _%>
210
335
  <%_ } _%>
211
336
  <%_ } _%>
212
- <%_ } _%>
213
- <%_ }); -%>
214
- <%_ } -%>
215
- <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
337
+ });
338
+
339
+ <%_ } -%>
340
+ <%_ }); -%>
341
+ <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
342
+ opaTest("Check table columns", function (_Given: Given, _When: When, Then: Then) {
216
343
  Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
217
- <%_ } -%>
218
344
  });
345
+
219
346
  <%_ } -%>
220
347
  <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
221
348
  opaTest("Check text annotation for columns", function (_Given: Given, When: When, Then: Then) {
@@ -224,6 +351,7 @@ function journey() {
224
351
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- column.textProperty %>" }, SortOrder.Ascending, true);
225
352
  <%_ }); -%>
226
353
  });
354
+
227
355
  <%_ } -%>
228
356
  <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0 && columnPersonalizationSupported !== false) { -%>
229
357
  opaTest("Check columns in adaptation dialog", function (_Given: Given, When: When, Then: Then) {
@@ -234,8 +362,8 @@ function journey() {
234
362
  <%_ }); -%>
235
363
  When.onThe<%- startLR%>Generated.onTable(defaultTableId).iConfirmColumnAdaptation();
236
364
  });
237
- <%_ } -%>
238
365
 
366
+ <%_ } -%>
239
367
  <%_ if (contactCardColumns.length > 0) { -%>
240
368
  opaTest("Check contact card links", function (_Given: Given, When: When, Then: Then) {
241
369
  // Reveal popin details so low-priority (e.g. contact-card) columns become clickable; no-op on grid/analytical tables.
@@ -75,30 +75,35 @@ sap.ui.define([
75
75
  // Then.onThe<%- startLR%>Generated.onFilterBar().iCheckSearchField(undefined);
76
76
  // });
77
77
 
78
- <%_ if ((toolBarActions && toolBarActions.length > 0 ) || (tableColumns && Object.keys(tableColumns).length > 0)) { -%>
79
- opaTest("Check table columns and actions", function (Given, When, Then) {
80
- <%_ if (toolBarActions && toolBarActions.length > 0) { -%>
81
- <%_ if (createButton.visible && !isALP) { _%>
78
+ <%_ if (createButton.visible && !isALP) { -%>
79
+ opaTest("Check the create button", function (Given, When, Then) {
82
80
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
83
81
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressCreate();
84
- <%_ } _%>
85
- <%_ if (deleteButton.visible) { _%>
82
+ });
83
+
84
+ <%_ } -%>
85
+ <%_ if (deleteButton.visible) { -%>
86
+ opaTest("Check the delete button", function (Given, When, Then) {
86
87
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
87
88
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
88
- <%_ } _%>
89
- <%_ toolBarActions.forEach(function(item) { _%>
90
- <%_ if (item.visible) { _%>
89
+ });
90
+
91
+ <%_ } -%>
92
+ <%_ (toolBarActions || []).forEach(function(item) { -%>
93
+ <%_ if (item.visible) { -%>
94
+ opaTest(<%- JSON.stringify("Check the " + item.label + " action") %>, function (Given, When, Then) {
91
95
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
92
96
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
93
- <%_ } _%>
94
- <%_ }); -%>
95
- <%_ } -%>
96
- <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
97
- Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
98
- <%_ } -%>
99
97
  });
98
+
100
99
  <%_ } -%>
100
+ <%_ }); -%>
101
+ <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
102
+ opaTest("Check table columns", function (Given, When, Then) {
103
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
104
+ });
101
105
 
106
+ <%_ } -%>
102
107
  <%_ if (startLR) { -%>
103
108
  opaTest("Navigate to ObjectPage", function (Given, When, Then) {
104
109
  // Note: this test will fail if the ListReport page doesn't show any data