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