@sap-ux/ui5-test-writer 1.10.7 → 1.12.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.
@@ -55,6 +55,11 @@ sap.ui.define([
55
55
  <% headerActions.forEach(function(action) { -%>
56
56
  <% if (action.visible) { -%>
57
57
  <% if (action.menuActions) { -%>
58
+ <% if (action.splitButton) { -%>
59
+ // <%- 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:
60
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>);
61
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
62
+ <% } else { -%>
58
63
  Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>);
59
64
  When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
60
65
  <% action.menuActions.forEach(function(menuAction) { -%>
@@ -63,17 +68,28 @@ sap.ui.define([
63
68
  // When.onThe<%- name%>Generated.onHeader().iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
64
69
  <% } -%>
65
70
  <% }); -%>
71
+ <% } -%>
66
72
  <% } else if (action.custom) { -%>
67
73
  <% if (action.labelUnresolved) { -%>
68
74
  // TODO: label is an unresolved i18n key; replace with the rendered action text
69
75
  <% } -%>
70
76
  Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
71
- // When.onThe<%- name%>Generated.onHeader().iPressAction(<%- JSON.stringify(action.label) %>);
77
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
72
78
  <% } else if (action.enabled === 'dynamic') { -%>
73
79
  Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
74
- // When.onThe<%- name%>Generated.onHeader().iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
75
80
  <% } else { -%>
76
81
  Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
82
+ <% } -%>
83
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
84
+ // "<%- 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.
85
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
86
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
87
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
88
+ <% } else if (action.isCritical) { -%>
89
+ When.onThe<%- name%>Generated.onHeader().iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
90
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
91
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
92
+ <% } else if (!action.custom && !action.menuActions) { -%>
77
93
  // When.onThe<%- name%>Generated.onHeader().iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
78
94
  <% } -%>
79
95
  <% } -%>
@@ -120,7 +136,7 @@ sap.ui.define([
120
136
  <% } -%>
121
137
  <% if (bodySections?.length > 0) { -%>
122
138
  <% bodySections.forEach(function(section) { -%>
123
- 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 && section.actions.some(function(a) { return a.visible && a.menuActions; }))) { %>When<% } else { %>_When<% } %>, Then) {
139
+ 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) {
124
140
  <% if (bodySections.length > 1) { -%>
125
141
  When.onThe<%- name%>Generated.iGoToSection({ section: "<%- section.id %>" });
126
142
  <% } -%>
@@ -130,6 +146,11 @@ sap.ui.define([
130
146
  <% if (action.visible) { -%>
131
147
  <% if (section.isTable && section.navigationProperty) { -%>
132
148
  <% if (action.menuActions) { -%>
149
+ <% if (action.splitButton) { -%>
150
+ // <%- 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:
151
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
152
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
153
+ <% } else { -%>
133
154
  Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
134
155
  When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
135
156
  <% action.menuActions.forEach(function(menuAction) { -%>
@@ -138,21 +159,40 @@ sap.ui.define([
138
159
  // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
139
160
  <% } -%>
140
161
  <% }); -%>
162
+ <% } -%>
141
163
  <% } else if (action.custom) { -%>
142
164
  <% if (action.labelUnresolved) { -%>
143
165
  // TODO: label is an unresolved i18n key; replace with the rendered action text
144
166
  <% } -%>
145
167
  Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
146
- // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction(<%- JSON.stringify(action.label) %>);
168
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
147
169
  <% } else if (action.enabled === 'dynamic') { -%>
148
170
  Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
149
- // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
150
171
  <% } else { -%>
151
172
  Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
173
+ <% } -%>
174
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
175
+ // "<%- 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.
176
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
177
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
178
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
179
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
180
+ <% } else if (action.isCritical) { -%>
181
+ // Critical action (Common.IsActionCritical): select a row, press it, assert the confirmation dialog opens, then cancel so it is not executed.
182
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
183
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
184
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
185
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
186
+ <% } else if (!action.custom && !action.menuActions) { -%>
152
187
  // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
153
188
  <% } -%>
154
189
  <% } else { -%>
155
190
  <% if (action.menuActions) { -%>
191
+ <% if (action.splitButton) { -%>
192
+ // <%- 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:
193
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
194
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
195
+ <% } else { -%>
156
196
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
157
197
  When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
158
198
  <% action.menuActions.forEach(function(menuAction) { -%>
@@ -161,17 +201,29 @@ sap.ui.define([
161
201
  // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
162
202
  <% } -%>
163
203
  <% }); -%>
204
+ <% } -%>
164
205
  <% } else if (action.custom) { -%>
165
206
  <% if (action.labelUnresolved) { -%>
166
207
  // TODO: label is an unresolved i18n key; replace with the rendered action text
167
208
  <% } -%>
168
209
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
169
- // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iPressAction(<%- JSON.stringify(action.label) %>);
210
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
170
211
  <% } else if (action.enabled === 'dynamic') { -%>
171
212
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
172
- // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
173
213
  <% } else { -%>
174
214
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
215
+ <% } -%>
216
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
217
+ // "<%- 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.
218
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
219
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
220
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
221
+ <% } else if (action.isCritical) { -%>
222
+ // Critical action (Common.IsActionCritical): press it, assert the confirmation dialog opens, then cancel so it is not executed.
223
+ When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
224
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
225
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
226
+ <% } else if (!action.custom && !action.menuActions) { -%>
175
227
  // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
176
228
  <% } -%>
177
229
  <% } -%>
@@ -36,9 +36,10 @@ const usesWhenInBody = (bodySections || []).length > 1 || (bodySections || []).s
36
36
  || (section.contactCardFields && section.contactCardFields.length > 0)
37
37
  || (section.contactCardColumns && section.contactCardColumns.length > 0)
38
38
  || (section.subSections || []).some(function(sub) { return (sub.contactCardFields && sub.contactCardFields.length > 0) || (sub.contactCardColumns && sub.contactCardColumns.length > 0); })
39
- || (section.actions || []).some(function(action) { return action.visible && action.menuActions; });
39
+ || (section.actions || []).some(function(action) { return action.visible && action.menuActions && !action.splitButton; })
40
+ || (section.actions || []).some(function(action) { return action.visible && ((action.isCritical && action.enabled !== 'dynamic') || action.menuActions); });
40
41
  });
41
- const headerHasMenu = (headerActions || []).some(function(action) { return action.visible && action.menuActions; });
42
+ const headerHasMenu = (headerActions || []).some(function(action) { return action.visible && action.menuActions && !action.splitButton; });
42
43
  -%>
43
44
  <% if (usesFieldIdentifier) { -%>
44
45
  import type { FieldIdentifier } from "sap/fe/test/api/BaseAPI";
@@ -73,7 +74,7 @@ function journey() {
73
74
  });
74
75
 
75
76
  <% if (headerActions?.length > 0) { -%>
76
- opaTest("Check header actions of the Object Page", function (_Given: Given, <% if (headerHasMenu) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
77
+ opaTest("Check header actions of the Object Page", function (_Given: Given, <% if (headerHasMenu || headerActions.some(function(action) { return action.visible && action.isCritical && action.enabled !== 'dynamic'; })) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
77
78
  <% if (editButton?.visible) { -%>
78
79
  // Ensure the opened entity is not in Draft state before uncommenting
79
80
  // Then.onThe<%- name%>Generated.onHeader().iCheckEdit({ visible: true });
@@ -82,6 +83,11 @@ function journey() {
82
83
  <% headerActions.forEach(function(action) { -%>
83
84
  <% if (action.visible) { -%>
84
85
  <% if (action.menuActions) { -%>
86
+ <% if (action.splitButton) { -%>
87
+ // <%- 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:
88
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>);
89
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
90
+ <% } else { -%>
85
91
  Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>);
86
92
  When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
87
93
  <% action.menuActions.forEach(function(menuAction) { -%>
@@ -90,17 +96,28 @@ function journey() {
90
96
  // When.onThe<%- name%>Generated.onHeader().iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
91
97
  <% } -%>
92
98
  <% }); -%>
99
+ <% } -%>
93
100
  <% } else if (action.custom) { -%>
94
101
  <% if (action.labelUnresolved) { -%>
95
102
  // TODO: label is an unresolved i18n key; replace with the rendered action text
96
103
  <% } -%>
97
104
  Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
98
- // When.onThe<%- name%>Generated.onHeader().iPressAction(<%- JSON.stringify(action.label) %>);
105
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
99
106
  <% } else if (action.enabled === 'dynamic') { -%>
100
107
  Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
101
- // When.onThe<%- name%>Generated.onHeader().iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
102
108
  <% } else { -%>
103
109
  Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
110
+ <% } -%>
111
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
112
+ // "<%- 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.
113
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
114
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
115
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
116
+ <% } else if (action.isCritical) { -%>
117
+ When.onThe<%- name%>Generated.onHeader().iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
118
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
119
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
120
+ <% } else if (!action.custom && !action.menuActions) { -%>
104
121
  // When.onThe<%- name%>Generated.onHeader().iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
105
122
  <% } -%>
106
123
  <% } -%>
@@ -157,6 +174,11 @@ function journey() {
157
174
  <% if (action.visible) { -%>
158
175
  <% if (section.isTable && section.navigationProperty) { -%>
159
176
  <% if (action.menuActions) { -%>
177
+ <% if (action.splitButton) { -%>
178
+ // <%- 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:
179
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
180
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
181
+ <% } else { -%>
160
182
  Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
161
183
  When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
162
184
  <% action.menuActions.forEach(function(menuAction) { -%>
@@ -165,21 +187,40 @@ function journey() {
165
187
  // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
166
188
  <% } -%>
167
189
  <% }); -%>
190
+ <% } -%>
168
191
  <% } else if (action.custom) { -%>
169
192
  <% if (action.labelUnresolved) { -%>
170
193
  // TODO: label is an unresolved i18n key; replace with the rendered action text
171
194
  <% } -%>
172
195
  Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
173
- // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction(<%- JSON.stringify(action.label) %>);
196
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
174
197
  <% } else if (action.enabled === 'dynamic') { -%>
175
198
  Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
176
- // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
177
199
  <% } else { -%>
178
200
  Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
201
+ <% } -%>
202
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
203
+ // "<%- 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.
204
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
205
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
206
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
207
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
208
+ <% } else if (action.isCritical) { -%>
209
+ // Critical action (Common.IsActionCritical): select a row, press it, assert the confirmation dialog opens, then cancel so it is not executed.
210
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
211
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
212
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
213
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
214
+ <% } else if (!action.custom && !action.menuActions) { -%>
179
215
  // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
180
216
  <% } -%>
181
217
  <% } else { -%>
182
218
  <% if (action.menuActions) { -%>
219
+ <% if (action.splitButton) { -%>
220
+ // <%- 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:
221
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction(<%- JSON.stringify(action.label) %>);
222
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteAction(<%- JSON.stringify(action.label) %>);
223
+ <% } else { -%>
183
224
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction(<%- JSON.stringify(action.label) %>);
184
225
  When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteAction(<%- JSON.stringify(action.label) %>);
185
226
  <% action.menuActions.forEach(function(menuAction) { -%>
@@ -188,17 +229,29 @@ function journey() {
188
229
  // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
189
230
  <% } -%>
190
231
  <% }); -%>
232
+ <% } -%>
191
233
  <% } else if (action.custom) { -%>
192
234
  <% if (action.labelUnresolved) { -%>
193
235
  // TODO: label is an unresolved i18n key; replace with the rendered action text
194
236
  <% } -%>
195
237
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
196
- // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iPressAction(<%- JSON.stringify(action.label) %>);
238
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteAction(<%- JSON.stringify(action.label) %>);
197
239
  <% } else if (action.enabled === 'dynamic') { -%>
198
240
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
199
- // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
200
241
  <% } else { -%>
201
242
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
243
+ <% } -%>
244
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
245
+ // "<%- 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.
246
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
247
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
248
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
249
+ <% } else if (action.isCritical) { -%>
250
+ // Critical action (Common.IsActionCritical): press it, assert the confirmation dialog opens, then cancel so it is not executed.
251
+ When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
252
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
253
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
254
+ <% } else if (!action.custom && !action.menuActions) { -%>
202
255
  // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
203
256
  <% } -%>
204
257
  <% } -%>