@sap-ux/ui5-test-writer 1.19.16 → 1.19.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/fiori-elements-opa-writer.d.ts +2 -2
  2. package/dist/fiori-elements-opa-writer.js +6 -4
  3. package/dist/types.d.ts +2 -2
  4. package/package.json +4 -4
  5. package/templates/v4/1.120/integration/FPMJourney.js +43 -0
  6. package/templates/v4/1.120/integration/FPMJourney.ts +40 -0
  7. package/templates/v4/1.120/integration/FirstJourney.js +37 -0
  8. package/templates/v4/1.120/integration/FirstJourney.ts +34 -0
  9. package/templates/v4/1.120/integration/ListReportJourney.js +138 -0
  10. package/templates/v4/1.120/integration/ListReportJourney.ts +142 -0
  11. package/templates/v4/1.120/integration/ObjectPageJourney.js +171 -0
  12. package/templates/v4/1.120/integration/ObjectPageJourney.ts +189 -0
  13. package/templates/v4/1.120/integration/opaTests.qunit.html +28 -0
  14. package/templates/v4/1.120/integration/opaTests.qunit.js +33 -0
  15. package/templates/v4/1.120/integration/pages/FPM.js +30 -0
  16. package/templates/v4/1.120/integration/pages/FPM.ts +25 -0
  17. package/templates/v4/1.120/integration/pages/JourneyRunner.js +18 -0
  18. package/templates/v4/1.120/integration/pages/JourneyRunner.ts +37 -0
  19. package/templates/v4/1.120/integration/pages/ListReport.js +35 -0
  20. package/templates/v4/1.120/integration/pages/ListReport.ts +25 -0
  21. package/templates/v4/1.120/integration/pages/ObjectPage.js +42 -0
  22. package/templates/v4/1.120/integration/pages/ObjectPage.ts +35 -0
  23. package/templates/v4/1.120/integration/types/OpaJourneyTypes.d.ts +79 -0
  24. package/templates/v4/1.148/integration/types/OpaJourneyTypes.d.ts +7 -2
  25. package/templates/v4/1.152/integration/FirstJourney.ts +2 -2
  26. package/templates/v4/1.152/integration/ListReportJourney.ts +5 -8
  27. package/templates/v4/1.152/integration/ObjectPageJourney.ts +42 -47
  28. package/templates/v4/1.152/integration/pages/JourneyRunner.ts +1 -2
  29. package/templates/v4/1.152/integration/types/OpaJourneyTypes.d.ts +7 -2
  30. package/templates/v4/1.84/integration/ListReportJourney.js +2 -18
  31. package/templates/v4/1.84/integration/ListReportJourney.ts +0 -18
  32. package/templates/v4/1.84/integration/ObjectPageJourney.js +14 -14
  33. package/templates/v4/1.84/integration/ObjectPageJourney.ts +13 -13
  34. package/templates/v4/1.84/integration/types/OpaJourneyTypes.d.ts +7 -2
  35. package/templates/v4/latest/integration/FirstJourney.ts +2 -2
  36. package/templates/v4/latest/integration/ListReportJourney.ts +5 -8
  37. package/templates/v4/latest/integration/ObjectPageJourney.ts +42 -47
  38. package/templates/v4/latest/integration/pages/JourneyRunner.ts +1 -2
  39. package/templates/v4/latest/integration/types/OpaJourneyTypes.d.ts +7 -2
@@ -107,19 +107,24 @@ function journey() {
107
107
  });
108
108
  <% } -%>
109
109
 
110
- <% if (bodySections?.length > 1) { -%>
111
- opaTest("Check the number of sections of the Object Page", function (_Given: Given, _When: When, Then: Then) {
112
- Then.onThe<%- name%>Generated.iCheckNumberOfSections(<%- bodySections.length %>);
113
- });
114
-
115
- <% } -%>
116
110
  <% if (bodySections?.length > 0) { -%>
117
111
  <% bodySections.forEach(function(section) { -%>
112
+ <%
113
+ // Below 1.120 the section/column level assertions are unavailable, so a table section with
114
+ // no actions, create/delete buttons, sub-sections or form fields would leave an opaTest body
115
+ // with only a When call. OPA5 rejects a test that runs zero assertions, so skip emitting the
116
+ // block entirely in that case.
117
+ const _hasVisibleAction = (section.actions || []).some(function(a) { return a.visible; });
118
+ const _hasTableButton = section.isTable && section.navigationProperty && (section.createButton?.visible || section.deleteButton?.visible);
119
+ const _hasSubSectionAssertion = (section.subSections?.length > 1) || (section.subSections || []).some(function(s) { return s.fields && s.fields.length > 0; });
120
+ const _hasFormFields = !(section.subSections?.length > 0) && section.fields && section.fields.length > 0;
121
+ const _hasSectionAssertion = _hasVisibleAction || _hasTableButton || _hasSubSectionAssertion || _hasFormFields;
122
+ -%>
123
+ <% if (_hasSectionAssertion) { -%>
118
124
  opaTest("Check the <%- section.id %> section of the Object Page", function (_Given: Given, <% if (bodySections.length > 1) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
119
125
  <% if (bodySections.length > 1) { -%>
120
126
  When.onThe<%- name%>Generated.iPressSectionIconTabFilterButton("<%- section.id %>");
121
127
  <% } -%>
122
- Then.onThe<%- name%>Generated.iCheckSection({ section: "<%- section.id %>" }, {});
123
128
  <% if (section.actions && section.actions.length > 0) { -%>
124
129
  <% section.actions.forEach(function(action) { -%>
125
130
  <% if (action.visible) { -%>
@@ -169,9 +174,6 @@ function journey() {
169
174
  <% } -%>
170
175
  <% }) -%>
171
176
  <% } -%>
172
- <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
173
- Then.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(subSection.tableColumns) %>);
174
- <% } -%>
175
177
  <% }) -%>
176
178
  <% } else { -%>
177
179
  <% if (section.fields && section.fields.length > 0) { -%>
@@ -186,12 +188,10 @@ function journey() {
186
188
  <% } -%>
187
189
  <% }) -%>
188
190
  <% } -%>
189
- <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
190
- Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(section.tableColumns) %>);
191
- <% } -%>
192
191
  <% } -%>
193
192
  });
194
193
 
194
+ <% } -%>
195
195
  <% }) -%>
196
196
  <% } -%>
197
197
  opaTest("Teardown", function (Given: Given) {
@@ -34,12 +34,17 @@ import type { actions as <%- page.targetKey %>GeneratedCustomActions, assertions
34
34
  * Then.onTheObjectPageGenerated.iCheckSection({ section: "A" }).and.iCheckSection({ section: "B" });
35
35
  * When.onTheListReportGenerated.onFilterBar().iExecuteSearch().and.iClearFilterBar();
36
36
  */
37
+ type WrapReturn<R, T> = R extends Opa5 | object ? (keyof R extends never ? WithAnd<T> : [R] extends [Opa5] ? WithAnd<T> : WithAnd<R>) : WithAnd<T>;
38
+ // `infer A` on an overloaded function keeps only the last overload; the 2-overload branch preserves both.
39
+ // A 3rd overload would be dropped SILENTLY (no error) — add a 3-overload branch if @sapui5/types grows one.
37
40
  type WithAnd<T> = {
38
41
  [K in keyof T | 'and']: K extends 'and'
39
42
  ? WithAnd<T>
40
43
  : K extends keyof T
41
- ? T[K] extends (...args: infer A) => infer R
42
- ? (...args: A) => (R extends Opa5 | object ? (keyof R extends never ? WithAnd<T> : [R] extends [Opa5] ? WithAnd<T> : WithAnd<R>) : WithAnd<T>)
44
+ ? T[K] extends { (...args: infer A1): infer R1; (...args: infer A2): infer R2 }
45
+ ? { (...args: A1): WrapReturn<R1, T>; (...args: A2): WrapReturn<R2, T> }
46
+ : T[K] extends (...args: infer A) => infer R
47
+ ? (...args: A) => WrapReturn<R, T>
43
48
  : T[K]
44
49
  : never;
45
50
  };
@@ -18,9 +18,9 @@ function journey() {
18
18
  <% if (!hideFilterBar) { %>
19
19
  When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
20
20
  <%} %>
21
- Then.onThe<%- startLR%>Generated.onTable("").iCheckRows();
21
+ Then.onThe<%- startLR%>Generated.onTable().iCheckRows();
22
22
  <% if (navigatedOP) { %>
23
- When.onThe<%- startLR%>Generated.onTable("").iPressRow(0);
23
+ When.onThe<%- startLR%>Generated.onTable().iPressRow(0);
24
24
  Then.onThe<%- navigatedOP%>Generated.iSeeThisPage();
25
25
  <%} %>
26
26
  });
@@ -17,12 +17,9 @@
17
17
 
18
18
  import opaTest from "sap/ui/test/opaQunit";
19
19
  import type { Given, When, Then } from "./types/OpaJourneyTypes.gen";
20
- <%_
21
- const usesFilterFieldIdentifier =
22
- !hideFilterBar && filterBarItems && filterBarItems.some(function(item) { return item.custom; });
23
- -%>
24
- <% if (usesFilterFieldIdentifier) { -%>
25
- import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
20
+ <%_ const usesDialogIdentifier = (tabs && tabs.some(function(tab) { return tab.contactCardColumns && tab.contactCardColumns.length > 0; })) || (contactCardColumns && contactCardColumns.length > 0); -%>
21
+ <% if (usesDialogIdentifier) { -%>
22
+ import type { DialogIdentifier } from "sap/fe/test/api/BaseAPI";
26
23
  <% } -%>
27
24
  import runner from "./pages/JourneyRunner";
28
25
  <%_ const needsSortOrder = startLR && ((textAnnotationColumns && textAnnotationColumns.length > 0) || (defaultSortOrder && defaultSortOrder.length > 0) || (tabs && tabs.some(function(tab) { return (tab.textAnnotationColumns && tab.textAnnotationColumns.length > 0) || (tab.defaultSortOrder && tab.defaultSortOrder.length > 0); }))); -%>
@@ -48,7 +45,7 @@ function journey() {
48
45
  opaTest("Check filter bar", function (_Given: Given, _When: When, Then: Then) {
49
46
  <%_ filterBarItems.forEach(function(item) { _%>
50
47
  <%_ if (item.custom) { _%>
51
- Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- item.description %>" as unknown as FilterFieldIdentifier);
48
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- item.description %>");
52
49
  <%_ } else { _%>
53
50
  Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- item.property %>" });
54
51
  <%_ } _%>
@@ -262,7 +259,7 @@ function journey() {
262
259
  <%_ tab.contactCardColumns.forEach(function(column) { _%>
263
260
  // May fail if the mock data has no row at index 0 or that row does not render the contact link; adjust the row selector if needed.
264
261
  When.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iClickLink(0, "<%- column.property %>");
265
- Then.onThe<%- startLR %>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
262
+ Then.onThe<%- startLR %>Generated.onDialog({} as unknown as DialogIdentifier).iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
266
263
  <%_ }); _%>
267
264
  });
268
265
 
@@ -18,19 +18,20 @@
18
18
  import opaTest from "sap/ui/test/opaQunit";
19
19
  import type { Given, When, Then } from "./types/OpaJourneyTypes.gen";
20
20
  <%_
21
- const usesFieldIdentifier = (headerSections || []).some(function(section) {
22
- return section.form && section.fields && section.fields.length > 0;
23
- });
24
- const usesFormIdentifier = (bodySections || []).some(function(section) {
25
- const subSectionsHaveForm = (section.subSections || []).some(function(sub) {
26
- return sub.fields && sub.fields.some(function(field) { return !field.checkBoxGroup; });
27
- });
28
- const sectionHasFormFields = !(section.subSections && section.subSections.length > 0) && section.fields && section.fields.some(function(field) { return !field.checkBoxGroup; });
29
- const hasFormAction = (section.actions || []).some(function(action) {
30
- return action.visible && !(section.isTable && section.navigationProperty);
21
+ const usesDialogIdentifier = (headerSections || []).some(function(s) { return (s.contactCardFields && s.contactCardFields.length > 0); })
22
+ || (bodySections || []).some(function(s) {
23
+ return (s.contactCardFields && s.contactCardFields.length > 0)
24
+ || (s.contactCardColumns && s.contactCardColumns.length > 0)
25
+ || (s.subSections || []).some(function(sub) {
26
+ return (sub.contactCardFields && sub.contactCardFields.length > 0)
27
+ || (sub.contactCardColumns && sub.contactCardColumns.length > 0);
28
+ });
31
29
  });
32
- return subSectionsHaveForm || sectionHasFormFields || hasFormAction;
33
- });
30
+ -%>
31
+ <% if (usesDialogIdentifier) { -%>
32
+ import type { DialogIdentifier } from "sap/fe/test/api/BaseAPI";
33
+ <% } -%>
34
+ <%_
34
35
  const usesWhenInBody = (bodySections || []).length > 1 || (bodySections || []).some(function(section) {
35
36
  return (section.subSections && section.subSections.length > 1)
36
37
  || (section.contactCardFields && section.contactCardFields.length > 0)
@@ -41,12 +42,6 @@ const usesWhenInBody = (bodySections || []).length > 1 || (bodySections || []).s
41
42
  });
42
43
  const headerHasMenu = (headerActions || []).some(function(action) { return action.visible && action.menuActions && !action.splitButton; });
43
44
  -%>
44
- <% if (usesFieldIdentifier) { -%>
45
- import type { FieldIdentifier } from "sap/fe/test/api/BaseAPI";
46
- <% } -%>
47
- <% if (usesFormIdentifier) { -%>
48
- import type { FormIdentifier } from "sap/fe/test/api/FormAPI";
49
- <% } -%>
50
45
  import runner from "./pages/JourneyRunner";
51
46
 
52
47
  function journey() {
@@ -137,7 +132,7 @@ function journey() {
137
132
  opaTest("Check header facets of the Object Page", function (_Given: Given, <% if (headerSections.some(function(section) { return section.contactCardFields?.length > 0; })) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
138
133
  <% headerSections.forEach(function(section) { -%>
139
134
  <% if (section.microChart) { -%>
140
- Then.onThe<%- name%>Generated.onHeader().iCheckMicroChart("<%- section.title %>", "");
135
+ Then.onThe<%- name%>Generated.onHeader().iCheckMicroChart("<%- section.title %>");
141
136
  <% } else { -%>
142
137
  Then.onThe<%- name%>Generated.onHeader().iCheckHeaderFacet({ facetId: "<%- section.facetId %>"<% if (section.custom) { %>, custom: true<% } %> });
143
138
  <% if (section.form) { -%>
@@ -146,11 +141,11 @@ function journey() {
146
141
  fieldGroup: "<%- field.fieldGroupQualifier %>",
147
142
  field: "<%- field.field %>",
148
143
  targetAnnotation: "<%- field.targetAnnotation %>"
149
- } as unknown as FieldIdentifier);
144
+ });
150
145
  <% }) -%>
151
146
  <% section.contactCardFields.forEach(function(field) { -%>
152
- When.onThe<%- name%>Generated.onHeader().iClickLink({ property: "<%- field.property %>" } as unknown as FieldIdentifier);
153
- Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
147
+ When.onThe<%- name%>Generated.onHeader().iClickLink({ property: "<%- field.property %>" });
148
+ Then.onThe<%- name%>Generated.onDialog({} as unknown as DialogIdentifier).iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
154
149
  <% }) -%>
155
150
  <% } -%>
156
151
  <% } -%>
@@ -170,7 +165,7 @@ function journey() {
170
165
  <% if (bodySections.length > 1) { -%>
171
166
  When.onThe<%- name%>Generated.iGoToSection({ section: "<%- section.id %>" });
172
167
  <% } -%>
173
- Then.onThe<%- name%>Generated.iCheckSection({ section: "<%- section.id %>" }, {});
168
+ Then.onThe<%- name%>Generated.iCheckSection({ section: "<%- section.id %>" });
174
169
  <% if (section.actions && section.actions.length > 0) { -%>
175
170
  <% section.actions.forEach(function(action) { -%>
176
171
  <% if (action.visible) { -%>
@@ -222,15 +217,15 @@ function journey() {
222
217
  <% if (action.menuActions) { -%>
223
218
  <% if (action.splitButton) { -%>
224
219
  // <%- 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:
225
- Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction(<%- JSON.stringify(action.label) %>);
226
- // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteAction(<%- JSON.stringify(action.label) %>);
220
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
221
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
227
222
  <% } else { -%>
228
- Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction(<%- JSON.stringify(action.label) %>);
229
- When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteAction(<%- JSON.stringify(action.label) %>);
223
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
224
+ When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
230
225
  <% action.menuActions.forEach(function(menuAction) { -%>
231
226
  <% if (menuAction.visible) { -%>
232
- Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckMenuAction(<%- JSON.stringify(menuAction.label) %>);
233
- // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
227
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckMenuAction(<%- JSON.stringify(menuAction.label) %>);
228
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
234
229
  <% } -%>
235
230
  <% }); -%>
236
231
  <% } -%>
@@ -238,25 +233,25 @@ function journey() {
238
233
  <% if (action.labelUnresolved) { -%>
239
234
  // TODO: label is an unresolved i18n key; replace with the rendered action text
240
235
  <% } -%>
241
- Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
242
- // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteAction(<%- JSON.stringify(action.label) %>);
236
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
237
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
243
238
  <% } else if (action.enabled === 'dynamic') { -%>
244
- 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 } */);
239
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
245
240
  <% } else { -%>
246
- 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 %> });
241
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
247
242
  <% } -%>
248
243
  <% if (action.isCritical && action.enabled === 'dynamic') { -%>
249
244
  // "<%- 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.
250
- // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
245
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
251
246
  // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
252
247
  // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
253
248
  <% } else if (action.isCritical) { -%>
254
249
  // Critical action (Common.IsActionCritical): press it, assert the confirmation dialog opens, then cancel so it is not executed.
255
- When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
250
+ When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
256
251
  Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
257
252
  When.onThe<%- name%>Generated.onMessageDialog().iCancel();
258
253
  <% } else if (!action.custom && !action.menuActions) { -%>
259
- // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
254
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
260
255
  <% } -%>
261
256
  <% } -%>
262
257
  <% } -%>
@@ -273,14 +268,14 @@ function journey() {
273
268
  <% } -%>
274
269
  <% section.contactCardColumns.forEach(function(column) { -%>
275
270
  When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iClickLink(0, "<%- column.property %>");
276
- Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
271
+ Then.onThe<%- name%>Generated.onDialog({} as unknown as DialogIdentifier).iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
277
272
  <% }) -%>
278
273
  <% } -%>
279
274
  <% if (section?.subSections?.length > 0) { -%>
280
275
  <% section.subSections.forEach(function(subSection) { -%>
281
276
  <% if (section.subSections.length > 1) { -%>
282
277
  When.onThe<%- name%>Generated.iGoToSection({ section: "<%- section.id %>", subSection: "<%- subSection.id %>" });
283
- Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" }, {});
278
+ Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" });
284
279
  <% } -%>
285
280
  <% if (subSection.fields && subSection.fields.length > 0) { -%>
286
281
  <% subSection.fields.forEach(function(field, fieldIndex) { -%>
@@ -288,15 +283,15 @@ function journey() {
288
283
  <% if (fieldIndex === 0 || !subSection.fields[fieldIndex - 1].checkBoxGroup) { -%>
289
284
  // Checkbox-group members cannot be addressed by sap.fe.test.api
290
285
  <% } -%>
291
- // Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
286
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
292
287
  <% } else { -%>
293
- Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
288
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
294
289
  <% } -%>
295
290
  <% }) -%>
296
291
  <% } -%>
297
292
  <% subSection.contactCardFields.forEach(function(field) { -%>
298
- When.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" } as unknown as FormIdentifier).iClickLink({ property: "<%- field.property %>" });
299
- Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
293
+ When.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iClickLink({ property: "<%- field.property %>" });
294
+ Then.onThe<%- name%>Generated.onDialog({} as unknown as DialogIdentifier).iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
300
295
  <% }) -%>
301
296
  <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
302
297
  Then.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(subSection.tableColumns) %>);
@@ -304,7 +299,7 @@ function journey() {
304
299
  <% if (subSection.navigationProperty) { -%>
305
300
  <% subSection.contactCardColumns.forEach(function(column) { -%>
306
301
  When.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iClickLink(0, "<%- column.property %>");
307
- Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
302
+ Then.onThe<%- name%>Generated.onDialog({} as unknown as DialogIdentifier).iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
308
303
  <% }) -%>
309
304
  <% } -%>
310
305
  <% }) -%>
@@ -315,15 +310,15 @@ function journey() {
315
310
  <% if (fieldIndex === 0 || !section.fields[fieldIndex - 1].checkBoxGroup) { -%>
316
311
  // Checkbox-group members cannot be addressed by sap.fe.test.api
317
312
  <% } -%>
318
- // Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
313
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
319
314
  <% } else { -%>
320
- Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
315
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
321
316
  <% } -%>
322
317
  <% }) -%>
323
318
  <% } -%>
324
319
  <% section.contactCardFields.forEach(function(field) { -%>
325
- When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iClickLink({ property: "<%- field.property %>" });
326
- Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
320
+ When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iClickLink({ property: "<%- field.property %>" });
321
+ Then.onThe<%- name%>Generated.onDialog({} as unknown as DialogIdentifier).iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
327
322
  <% }) -%>
328
323
  <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
329
324
  Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(section.tableColumns) %>);
@@ -23,8 +23,7 @@ const runner = new JourneyRunner({
23
23
  ' {\n' +
24
24
  ' appId: "' + page.appID + '",\n' +
25
25
  ' componentId: "' + page.componentID + '",\n' +
26
- ' entitySet: "' + (page.entitySet || '') + '",\n' +
27
- ' contextPath: "' + (page.contextPath || '') + '"\n' +
26
+ ' ' + (page.contextPath ? 'contextPath: "' + page.contextPath : 'entitySet: "' + (page.entitySet || '')) + '"\n' +
28
27
  ' },\n' +
29
28
  ' Custom' + page.targetKey + 'Generated\n' +
30
29
  ' )'
@@ -34,12 +34,17 @@ import type { actions as <%- page.targetKey %>GeneratedCustomActions, assertions
34
34
  * Then.onTheObjectPageGenerated.iCheckSection({ section: "A" }).and.iCheckSection({ section: "B" });
35
35
  * When.onTheListReportGenerated.onFilterBar().iExecuteSearch().and.iClearFilterBar();
36
36
  */
37
+ type WrapReturn<R, T> = R extends Opa5 | object ? (keyof R extends never ? WithAnd<T> : [R] extends [Opa5] ? WithAnd<T> : WithAnd<R>) : WithAnd<T>;
38
+ // `infer A` on an overloaded function keeps only the last overload; the 2-overload branch preserves both.
39
+ // A 3rd overload would be dropped SILENTLY (no error) — add a 3-overload branch if @sapui5/types grows one.
37
40
  type WithAnd<T> = {
38
41
  [K in keyof T | 'and']: K extends 'and'
39
42
  ? WithAnd<T>
40
43
  : K extends keyof T
41
- ? T[K] extends (...args: infer A) => infer R
42
- ? (...args: A) => (R extends Opa5 | object ? (keyof R extends never ? WithAnd<T> : [R] extends [Opa5] ? WithAnd<T> : WithAnd<R>) : WithAnd<T>)
44
+ ? T[K] extends { (...args: infer A1): infer R1; (...args: infer A2): infer R2 }
45
+ ? { (...args: A1): WrapReturn<R1, T>; (...args: A2): WrapReturn<R2, T> }
46
+ : T[K] extends (...args: infer A) => infer R
47
+ ? (...args: A) => WrapReturn<R, T>
43
48
  : T[K]
44
49
  : never;
45
50
  };