@sap-ux/ui5-test-writer 1.13.4 → 1.14.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.
- package/dist/types.d.ts +4 -0
- package/dist/utils/actionUtils.d.ts +9 -1
- package/dist/utils/actionUtils.js +20 -2
- package/package.json +1 -1
- package/templates/v4/latest/integration/ListReportJourney.js +27 -5
- package/templates/v4/latest/integration/ListReportJourney.ts +31 -6
- package/templates/v4/latest/integration/ObjectPageJourney.js +2 -0
- package/templates/v4/latest/integration/ObjectPageJourney.ts +2 -0
package/dist/types.d.ts
CHANGED
|
@@ -308,6 +308,10 @@ export interface ActionButtonState {
|
|
|
308
308
|
* The writer emits a follow-up marker comment so the developer can fix the assertion.
|
|
309
309
|
*/
|
|
310
310
|
labelUnresolved?: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Names of the action's non-binding parameters.
|
|
313
|
+
*/
|
|
314
|
+
parameterDialogFields?: string[];
|
|
311
315
|
}
|
|
312
316
|
export interface MenuActionState {
|
|
313
317
|
label: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConvertedMetadata } from '@sap-ux/vocabularies-types';
|
|
1
|
+
import type { Action, ConvertedMetadata } from '@sap-ux/vocabularies-types';
|
|
2
2
|
import type { ActionButtonState, ButtonState, ButtonVisibilityResult, MenuActionState } from '../types.js';
|
|
3
3
|
import { type AggregationItem } from './modelUtils.js';
|
|
4
4
|
import type { I18nLabelResolver } from './i18nUtils.js';
|
|
@@ -14,6 +14,14 @@ import type { Logger } from '@sap-ux/logger';
|
|
|
14
14
|
* @returns The set of critical action method names (empty if none)
|
|
15
15
|
*/
|
|
16
16
|
export declare function collectCriticalActionNames(metadata?: ConvertedMetadata): Set<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Collects the names of an action's non-binding parameters. For a bound action the first parameter is the binding
|
|
19
|
+
* parameter and is skipped.
|
|
20
|
+
*
|
|
21
|
+
* @param action The converted action definition
|
|
22
|
+
* @returns The non-binding parameter names, or undefined if there are none
|
|
23
|
+
*/
|
|
24
|
+
export declare function collectActionParameterNames(action?: Action): string[] | undefined;
|
|
17
25
|
type OperationAvailableWithPaths = OperationAvailable & {
|
|
18
26
|
$Path?: string;
|
|
19
27
|
path?: string;
|
|
@@ -22,6 +22,22 @@ export function collectCriticalActionNames(metadata) {
|
|
|
22
22
|
}
|
|
23
23
|
return names;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Collects the names of an action's non-binding parameters. For a bound action the first parameter is the binding
|
|
27
|
+
* parameter and is skipped.
|
|
28
|
+
*
|
|
29
|
+
* @param action The converted action definition
|
|
30
|
+
* @returns The non-binding parameter names, or undefined if there are none
|
|
31
|
+
*/
|
|
32
|
+
export function collectActionParameterNames(action) {
|
|
33
|
+
const parameters = action?.parameters;
|
|
34
|
+
if (!parameters?.length) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const startIndex = action?.isBound === true ? 1 : 0;
|
|
38
|
+
const names = parameters.slice(startIndex).map((parameter) => parameter.name);
|
|
39
|
+
return names.length > 0 ? names : undefined;
|
|
40
|
+
}
|
|
25
41
|
/**
|
|
26
42
|
* Extracts the action method name from a fully qualified action string.
|
|
27
43
|
*
|
|
@@ -138,7 +154,8 @@ export function buildActionButtonState(item, metadata, criticalActions) {
|
|
|
138
154
|
enabled,
|
|
139
155
|
dynamicPath,
|
|
140
156
|
invocationGrouping: item.InvocationGrouping ? extractEnumMemberValue(item.InvocationGrouping) : undefined,
|
|
141
|
-
isCritical: criticalActions?.has(actionMethod) ?? false
|
|
157
|
+
isCritical: criticalActions?.has(actionMethod) ?? false,
|
|
158
|
+
parameterDialogFields: collectActionParameterNames(actionTarget)
|
|
142
159
|
};
|
|
143
160
|
}
|
|
144
161
|
/**
|
|
@@ -176,7 +193,8 @@ export function buildActionStateFromSpecModelKey(aggregationKey, label, converte
|
|
|
176
193
|
visible: true,
|
|
177
194
|
enabled,
|
|
178
195
|
dynamicPath,
|
|
179
|
-
isCritical: criticalActions?.has(actionMethod) ?? false
|
|
196
|
+
isCritical: criticalActions?.has(actionMethod) ?? false,
|
|
197
|
+
parameterDialogFields: collectActionParameterNames(actionDefinition)
|
|
180
198
|
};
|
|
181
199
|
}
|
|
182
200
|
/**
|
package/package.json
CHANGED
|
@@ -127,6 +127,11 @@ sap.ui.define([
|
|
|
127
127
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
|
|
128
128
|
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
|
|
129
129
|
<%_ } _%>
|
|
130
|
+
<%_ const toolBarHasDialogAction = (toolBarActions || []).some(function(action) { return action.visible && !action.menuActions && !action.custom && action.enabled !== 'dynamic' && (action.isCritical || (action.parameterDialogFields && action.parameterDialogFields.length > 0)); }); _%>
|
|
131
|
+
<%_ if (!hideFilterBar && toolBarHasDialogAction) { _%>
|
|
132
|
+
// Populate the table so the actions below have a row to select.
|
|
133
|
+
When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
134
|
+
<%_ } _%>
|
|
130
135
|
<%_ toolBarActions.forEach(function(item) { _%>
|
|
131
136
|
<%_ if (item.visible) { _%>
|
|
132
137
|
<%_ if (item.menuActions) { _%>
|
|
@@ -153,26 +158,43 @@ sap.ui.define([
|
|
|
153
158
|
<%_ } else { _%>
|
|
154
159
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
|
|
155
160
|
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
|
|
156
|
-
<%_
|
|
157
|
-
|
|
161
|
+
<%_ const hasParamDialog = item.parameterDialogFields && item.parameterDialogFields.length > 0; _%>
|
|
162
|
+
<%_ if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
|
|
163
|
+
// "<%- 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' %>.
|
|
158
164
|
<%_ if (!hideFilterBar) { _%>
|
|
159
165
|
// When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
160
166
|
<%_ } _%>
|
|
161
167
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
162
168
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
|
|
169
|
+
<%_ if (hasParamDialog) { _%>
|
|
170
|
+
<%_ item.parameterDialogFields.forEach(function(parameter) { _%>
|
|
171
|
+
// Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
|
|
172
|
+
<%_ }); _%>
|
|
173
|
+
// When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
|
|
174
|
+
<%_ } else { _%>
|
|
163
175
|
// Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
|
|
164
176
|
// When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
|
|
165
|
-
<%_ } else if (item.isCritical) { _%>
|
|
166
|
-
<%_ if (!hideFilterBar) { _%>
|
|
167
|
-
When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
168
177
|
<%_ } _%>
|
|
178
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
179
|
+
<%_ } else if (item.isCritical || hasParamDialog) { _%>
|
|
169
180
|
<%_ if (item.enabled !== true) { _%>
|
|
170
181
|
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
171
182
|
<%_ } _%>
|
|
172
183
|
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
|
|
184
|
+
<%_ if (hasParamDialog) { _%>
|
|
185
|
+
<%_ item.parameterDialogFields.forEach(function(parameter) { _%>
|
|
186
|
+
Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
|
|
187
|
+
<%_ }); _%>
|
|
188
|
+
When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
|
|
189
|
+
<%_ } else { _%>
|
|
173
190
|
Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
|
|
174
191
|
When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
|
|
175
192
|
<%_ } _%>
|
|
193
|
+
<%_ if (item.enabled !== true) { _%>
|
|
194
|
+
// Deselect the row so the following actions start with an empty selection.
|
|
195
|
+
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
196
|
+
<%_ } _%>
|
|
197
|
+
<%_ } _%>
|
|
176
198
|
<%_ } _%>
|
|
177
199
|
<%_ } _%>
|
|
178
200
|
<%_ }); -%>
|
|
@@ -21,6 +21,10 @@ import type { Given, When, Then } from "./types/OpaJourneyTypes.gen";
|
|
|
21
21
|
const usesFilterFieldIdentifier =
|
|
22
22
|
!hideFilterBar && filterBarItems && filterBarItems.some(function(item) { return item.custom; });
|
|
23
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
|
+
});
|
|
24
28
|
-%>
|
|
25
29
|
<% if (usesFilterFieldIdentifier) { -%>
|
|
26
30
|
import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
|
|
@@ -125,7 +129,7 @@ function journey() {
|
|
|
125
129
|
});
|
|
126
130
|
<%_ } else { -%>
|
|
127
131
|
<%_ if ((toolBarActions && toolBarActions.length > 0 ) || (tableColumns && Object.keys(tableColumns).length > 0)) { -%>
|
|
128
|
-
opaTest("Check table columns and actions", function (_Given: Given, <% if (toolBarHasMenu ||
|
|
132
|
+
opaTest("Check table columns and actions", function (_Given: Given, <% if (toolBarHasMenu || toolBarHasDialogAction) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
|
|
129
133
|
<%_ if (toolBarActions && toolBarActions.length > 0) { -%>
|
|
130
134
|
<%_ if (createButton.visible && !isALP) { _%>
|
|
131
135
|
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
|
|
@@ -135,6 +139,10 @@ function journey() {
|
|
|
135
139
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
|
|
136
140
|
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
|
|
137
141
|
<%_ } _%>
|
|
142
|
+
<%_ if (!hideFilterBar && toolBarHasDialogAction) { _%>
|
|
143
|
+
// Populate the table so the actions below have a row to select.
|
|
144
|
+
When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
145
|
+
<%_ } _%>
|
|
138
146
|
<%_ toolBarActions.forEach(function(item) { _%>
|
|
139
147
|
<%_ if (item.visible) { _%>
|
|
140
148
|
<%_ if (item.menuActions) { _%>
|
|
@@ -161,26 +169,43 @@ function journey() {
|
|
|
161
169
|
<%_ } else { _%>
|
|
162
170
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
|
|
163
171
|
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
|
|
164
|
-
<%_
|
|
165
|
-
|
|
172
|
+
<%_ const hasParamDialog = item.parameterDialogFields && item.parameterDialogFields.length > 0; _%>
|
|
173
|
+
<%_ if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
|
|
174
|
+
// "<%- 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
175
|
<%_ if (!hideFilterBar) { _%>
|
|
167
176
|
// When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
168
177
|
<%_ } _%>
|
|
169
178
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
170
179
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
|
|
180
|
+
<%_ if (hasParamDialog) { _%>
|
|
181
|
+
<%_ item.parameterDialogFields.forEach(function(parameter) { _%>
|
|
182
|
+
// Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
|
|
183
|
+
<%_ }); _%>
|
|
184
|
+
// When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
|
|
185
|
+
<%_ } else { _%>
|
|
171
186
|
// Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
|
|
172
187
|
// When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
|
|
173
|
-
<%_ } else if (item.isCritical) { _%>
|
|
174
|
-
<%_ if (!hideFilterBar) { _%>
|
|
175
|
-
When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
176
188
|
<%_ } _%>
|
|
189
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
190
|
+
<%_ } else if (item.isCritical || hasParamDialog) { _%>
|
|
177
191
|
<%_ if (item.enabled !== true) { _%>
|
|
178
192
|
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
179
193
|
<%_ } _%>
|
|
180
194
|
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
|
|
195
|
+
<%_ if (hasParamDialog) { _%>
|
|
196
|
+
<%_ item.parameterDialogFields.forEach(function(parameter) { _%>
|
|
197
|
+
Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
|
|
198
|
+
<%_ }); _%>
|
|
199
|
+
When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
|
|
200
|
+
<%_ } else { _%>
|
|
181
201
|
Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
|
|
182
202
|
When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
|
|
183
203
|
<%_ } _%>
|
|
204
|
+
<%_ if (item.enabled !== true) { _%>
|
|
205
|
+
// Deselect the row so the following actions start with an empty selection.
|
|
206
|
+
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
207
|
+
<%_ } _%>
|
|
208
|
+
<%_ } _%>
|
|
184
209
|
<%_ } _%>
|
|
185
210
|
<%_ } _%>
|
|
186
211
|
<%_ }); -%>
|
|
@@ -183,6 +183,8 @@ sap.ui.define([
|
|
|
183
183
|
When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
|
|
184
184
|
Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
|
|
185
185
|
When.onThe<%- name%>Generated.onMessageDialog().iCancel();
|
|
186
|
+
// Deselect the row so the following actions start with an empty selection.
|
|
187
|
+
When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
|
|
186
188
|
<% } else if (!action.custom && !action.menuActions) { -%>
|
|
187
189
|
// When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
|
|
188
190
|
<% } -%>
|
|
@@ -211,6 +211,8 @@ function journey() {
|
|
|
211
211
|
When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
|
|
212
212
|
Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
|
|
213
213
|
When.onThe<%- name%>Generated.onMessageDialog().iCancel();
|
|
214
|
+
// Deselect the row so the following actions start with an empty selection.
|
|
215
|
+
When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
|
|
214
216
|
<% } else if (!action.custom && !action.menuActions) { -%>
|
|
215
217
|
// When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
|
|
216
218
|
<% } -%>
|