@sap-ux/ui5-test-writer 1.15.3 → 1.15.5

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 (27) hide show
  1. package/dist/fiori-elements-opa-writer.d.ts +3 -3
  2. package/dist/fiori-elements-opa-writer.js +6 -5
  3. package/package.json +2 -2
  4. package/templates/v4/1.148/integration/FirstJourney.js +5 -5
  5. package/templates/v4/1.152/integration/FPMJourney.js +43 -0
  6. package/templates/v4/1.152/integration/FPMJourney.ts +40 -0
  7. package/templates/v4/1.152/integration/FirstJourney.js +37 -0
  8. package/templates/v4/1.152/integration/FirstJourney.ts +34 -0
  9. package/templates/v4/1.152/integration/ListReportJourney.js +261 -0
  10. package/templates/v4/1.152/integration/ListReportJourney.ts +271 -0
  11. package/templates/v4/1.152/integration/ObjectPageJourney.js +301 -0
  12. package/templates/v4/1.152/integration/ObjectPageJourney.ts +328 -0
  13. package/templates/v4/1.152/integration/opaTests.qunit.html +28 -0
  14. package/templates/v4/1.152/integration/opaTests.qunit.js +33 -0
  15. package/templates/v4/1.152/integration/pages/FPM.js +30 -0
  16. package/templates/v4/1.152/integration/pages/FPM.ts +25 -0
  17. package/templates/v4/1.152/integration/pages/JourneyRunner.js +17 -0
  18. package/templates/v4/1.152/integration/pages/JourneyRunner.ts +36 -0
  19. package/templates/v4/1.152/integration/pages/ListReport.js +35 -0
  20. package/templates/v4/1.152/integration/pages/ListReport.ts +25 -0
  21. package/templates/v4/1.152/integration/pages/ObjectPage.js +35 -0
  22. package/templates/v4/1.152/integration/pages/ObjectPage.ts +25 -0
  23. package/templates/v4/1.152/integration/types/OpaJourneyTypes.d.ts +79 -0
  24. package/templates/v4/1.84/integration/FirstJourney.js +5 -5
  25. package/templates/v4/latest/integration/FirstJourney.js +5 -5
  26. package/templates/v4/latest/integration/ListReportJourney.js +6 -6
  27. package/templates/v4/latest/integration/ListReportJourney.ts +6 -6
@@ -0,0 +1,328 @@
1
+ /******************************************************************************
2
+ * ╔═══════════════════════════════════════════════════════════════════════╗ *
3
+ * ║ ║ *
4
+ * ║ WARNING: AUTO-GENERATED FILE ║ *
5
+ * ║ ║ *
6
+ * ║ This file is automatically generated by SAP Fiori tools and is ║ *
7
+ * ║ overwritten when you run the OPA test generator again. ║ *
8
+ * ║ ║ *
9
+ * ║ To add your own custom tests: ║ *
10
+ * ║ - Create a new journey test file in this directory. ║ *
11
+ * ║ - Follow the same pattern as this file. ║ *
12
+ * ║ - Add the new file to the opaTests.qunit.js config file. ║ *
13
+ * ║ - Custom journey files are not overwritten. ║ *
14
+ * ║ ║ *
15
+ * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
+ ******************************************************************************/
17
+
18
+ import opaTest from "sap/ui/test/opaQunit";
19
+ import type { Given, When, Then } from "./types/OpaJourneyTypes.gen";
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.length > 0;
27
+ });
28
+ const sectionHasFormFields = !(section.subSections && section.subSections.length > 0) && section.fields && section.fields.length > 0;
29
+ const hasFormAction = (section.actions || []).some(function(action) {
30
+ return action.visible && !(section.isTable && section.navigationProperty);
31
+ });
32
+ return subSectionsHaveForm || sectionHasFormFields || hasFormAction;
33
+ });
34
+ const usesWhenInBody = (bodySections || []).length > 1 || (bodySections || []).some(function(section) {
35
+ return (section.subSections && section.subSections.length > 1)
36
+ || (section.contactCardFields && section.contactCardFields.length > 0)
37
+ || (section.contactCardColumns && section.contactCardColumns.length > 0)
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 && !action.splitButton; })
40
+ || (section.actions || []).some(function(action) { return action.visible && ((action.isCritical && action.enabled !== 'dynamic') || action.menuActions); });
41
+ });
42
+ const headerHasMenu = (headerActions || []).some(function(action) { return action.visible && action.menuActions && !action.splitButton; });
43
+ -%>
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
+ import runner from "./pages/JourneyRunner";
51
+
52
+ function journey() {
53
+ QUnit.module("<%- name%>ObjectPage journey");
54
+
55
+ opaTest("Navigate to <%- name%>ObjectPage", function (Given: Given, When: When, Then: Then) {
56
+ Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
57
+ Given.iResetTestData();
58
+ Given.iStartMyApp();
59
+ <% if(navigationParents.parentLRName) { -%>
60
+ <% const parentTableId = navigationParents.parentLRViewKey ? '"' + navigationParents.parentLRViewKey + '"' : '""'; -%>
61
+ <% if (!hideFilterBar) { -%>
62
+ When.onThe<%- navigationParents.parentLRName%>Generated.onFilterBar().iExecuteSearch();
63
+ <% } -%>
64
+ <% if (navigationParents.parentLRViewKey && !navigationParents.parentLRViewIsDefault) { -%>
65
+ When.onThe<%- navigationParents.parentLRName%>Generated.iGoToView({ key: "<%- navigationParents.parentLRViewKey %>" });
66
+ <% } -%>
67
+ Then.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- parentTableId %>).iCheckRows();
68
+ When.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- parentTableId %>).iPressRow(0);
69
+ <% } -%>
70
+ <% navigationParents.parentOPs.forEach(function(parent) { %>
71
+ Then.onThe<%- parent.name %>Generated.iSeeThisPage();
72
+ Then.onThe<%- parent.name %>Generated.onTable({ property: "<%- parent.navigationProperty %>" }).iCheckRows();
73
+ When.onThe<%- parent.name %>Generated.onTable({ property: "<%- parent.navigationProperty %>" }).iPressRow(0);
74
+ <% }); %>
75
+ Then.onThe<%- name%>Generated.iSeeThisPage();
76
+ });
77
+
78
+ <% if (headerActions?.length > 0) { -%>
79
+ 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) {
80
+ <% if (editButton?.visible) { -%>
81
+ // Ensure the opened entity is not in Draft state before uncommenting
82
+ // Then.onThe<%- name%>Generated.onHeader().iCheckEdit({ visible: true });
83
+ // When.onThe<%- name%>Generated.onHeader().iExecuteEdit();
84
+ <% } -%>
85
+ <% headerActions.forEach(function(action) { -%>
86
+ <% if (action.visible) { -%>
87
+ <% if (action.menuActions) { -%>
88
+ <% if (action.splitButton) { -%>
89
+ // <%- 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:
90
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>);
91
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
92
+ <% } else { -%>
93
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>);
94
+ When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
95
+ <% action.menuActions.forEach(function(menuAction) { -%>
96
+ <% if (menuAction.visible) { -%>
97
+ Then.onThe<%- name%>Generated.onHeader().iCheckMenuAction(<%- JSON.stringify(menuAction.label) %>);
98
+ // When.onThe<%- name%>Generated.onHeader().iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
99
+ <% } -%>
100
+ <% }); -%>
101
+ <% } -%>
102
+ <% } else if (action.custom) { -%>
103
+ <% if (action.labelUnresolved) { -%>
104
+ // TODO: label is an unresolved i18n key; replace with the rendered action text
105
+ <% } -%>
106
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
107
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction(<%- JSON.stringify(action.label) %>);
108
+ <% } else if (action.enabled === 'dynamic') { -%>
109
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
110
+ <% } else { -%>
111
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
112
+ <% } -%>
113
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
114
+ // "<%- 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.
115
+ // When.onThe<%- name%>Generated.onHeader().iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
116
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
117
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
118
+ <% } else if (action.isCritical) { -%>
119
+ When.onThe<%- name%>Generated.onHeader().iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
120
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
121
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
122
+ <% } else if (!action.custom && !action.menuActions) { -%>
123
+ // When.onThe<%- name%>Generated.onHeader().iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
124
+ <% } -%>
125
+ <% } -%>
126
+ <% }); -%>
127
+ });
128
+ <% } -%>
129
+
130
+ <% if (headerTitle) { -%>
131
+ opaTest("Check header title of the Object Page", function (_Given: Given, _When: When, Then: Then) {
132
+ Then.onThe<%- name%>Generated.onHeader().iCheckTitlePath(<%- JSON.stringify(headerTitle) %>);
133
+ });
134
+
135
+ <% } -%>
136
+ <% if (headerSections?.length > 0) { -%>
137
+ 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
+ <% headerSections.forEach(function(section) { -%>
139
+ <% if (section.microChart) { -%>
140
+ Then.onThe<%- name%>Generated.onHeader().iCheckMicroChart("<%- section.title %>", "");
141
+ <% } else { -%>
142
+ Then.onThe<%- name%>Generated.onHeader().iCheckHeaderFacet({ facetId: "<%- section.facetId %>"<% if (section.custom) { %>, custom: true<% } %> });
143
+ <% if (section.form) { -%>
144
+ <% section.fields.forEach(function(field) { -%>
145
+ Then.onThe<%- name%>Generated.onHeader().iCheckFieldInFieldGroup({
146
+ fieldGroup: "<%- field.fieldGroupQualifier %>",
147
+ field: "<%- field.field %>",
148
+ targetAnnotation: "<%- field.targetAnnotation %>"
149
+ } as unknown as FieldIdentifier);
150
+ <% }) -%>
151
+ <% 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" });
154
+ <% }) -%>
155
+ <% } -%>
156
+ <% } -%>
157
+ <% }) -%>
158
+ });
159
+ <% } -%>
160
+
161
+ <% if (bodySections?.length > 1) { -%>
162
+ opaTest("Check the number of sections of the Object Page", function (_Given: Given, _When: When, Then: Then) {
163
+ Then.onThe<%- name%>Generated.iCheckNumberOfSections(<%- bodySections.length %>);
164
+ });
165
+
166
+ <% } -%>
167
+ <% if (bodySections?.length > 0) { -%>
168
+ <% bodySections.forEach(function(section) { -%>
169
+ opaTest("Check the <%- section.id %> section of the Object Page", function (_Given: Given, <% if (usesWhenInBody) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
170
+ <% if (bodySections.length > 1) { -%>
171
+ When.onThe<%- name%>Generated.iGoToSection({ section: "<%- section.id %>" });
172
+ <% } -%>
173
+ Then.onThe<%- name%>Generated.iCheckSection({ section: "<%- section.id %>" }, {});
174
+ <% if (section.actions && section.actions.length > 0) { -%>
175
+ <% section.actions.forEach(function(action) { -%>
176
+ <% if (action.visible) { -%>
177
+ <% if (section.isTable && section.navigationProperty) { -%>
178
+ <% if (action.menuActions) { -%>
179
+ <% if (action.splitButton) { -%>
180
+ // <%- 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:
181
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
182
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
183
+ <% } else { -%>
184
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>);
185
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
186
+ <% action.menuActions.forEach(function(menuAction) { -%>
187
+ <% if (menuAction.visible) { -%>
188
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckMenuAction(<%- JSON.stringify(menuAction.label) %>);
189
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteMenuAction(<%- JSON.stringify(menuAction.label) %>);
190
+ <% } -%>
191
+ <% }); -%>
192
+ <% } -%>
193
+ <% } else if (action.custom) { -%>
194
+ <% if (action.labelUnresolved) { -%>
195
+ // TODO: label is an unresolved i18n key; replace with the rendered action text
196
+ <% } -%>
197
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction(<%- JSON.stringify(action.label) %>, { visible: true });
198
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction(<%- JSON.stringify(action.label) %>);
199
+ <% } else if (action.enabled === 'dynamic') { -%>
200
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
201
+ <% } else { -%>
202
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
203
+ <% } -%>
204
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
205
+ // "<%- 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.
206
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
207
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
208
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
209
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
210
+ <% } else if (action.isCritical) { -%>
211
+ // Critical action (Common.IsActionCritical): select a row, press it, assert the confirmation dialog opens, then cancel so it is not executed.
212
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
213
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
214
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
215
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
216
+ // Deselect the row so the following actions start with an empty selection.
217
+ When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
218
+ <% } else if (!action.custom && !action.menuActions) { -%>
219
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
220
+ <% } -%>
221
+ <% } else { -%>
222
+ <% if (action.menuActions) { -%>
223
+ <% if (action.splitButton) { -%>
224
+ // <%- 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) %>);
227
+ <% } 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) %>);
230
+ <% action.menuActions.forEach(function(menuAction) { -%>
231
+ <% 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) %>);
234
+ <% } -%>
235
+ <% }); -%>
236
+ <% } -%>
237
+ <% } else if (action.custom) { -%>
238
+ <% if (action.labelUnresolved) { -%>
239
+ // TODO: label is an unresolved i18n key; replace with the rendered action text
240
+ <% } -%>
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) %>);
243
+ <% } 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 } */);
245
+ <% } 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 %> });
247
+ <% } -%>
248
+ <% if (action.isCritical && action.enabled === 'dynamic') { -%>
249
+ // "<%- 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 %> });
251
+ // Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
252
+ // When.onThe<%- name%>Generated.onMessageDialog().iCancel();
253
+ <% } else if (action.isCritical) { -%>
254
+ // 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 %> });
256
+ Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
257
+ When.onThe<%- name%>Generated.onMessageDialog().iCancel();
258
+ <% } 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 %> });
260
+ <% } -%>
261
+ <% } -%>
262
+ <% } -%>
263
+ <% }); -%>
264
+ <% } -%>
265
+ <% if (section.isTable && section.navigationProperty) { -%>
266
+ <% if (section.createButton?.visible) { -%>
267
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckCreate({ visible: true });
268
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressCreate();
269
+ <% } -%>
270
+ <% if (section.deleteButton?.visible) { -%>
271
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckDelete({ visible: true });
272
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressDelete();
273
+ <% } -%>
274
+ <% section.contactCardColumns.forEach(function(column) { -%>
275
+ 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" });
277
+ <% }) -%>
278
+ <% } -%>
279
+ <% if (section?.subSections?.length > 0) { -%>
280
+ <% section.subSections.forEach(function(subSection) { -%>
281
+ <% if (section.subSections.length > 1) { -%>
282
+ When.onThe<%- name%>Generated.iGoToSection({ section: "<%- section.id %>", subSection: "<%- subSection.id %>" });
283
+ Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" }, {});
284
+ <% } -%>
285
+ <% if (subSection.fields && subSection.fields.length > 0) { -%>
286
+ <% subSection.fields.forEach(function(field) { -%>
287
+ 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
+ <% }) -%>
289
+ <% } -%>
290
+ <% subSection.contactCardFields.forEach(function(field) { -%>
291
+ When.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" } as unknown as FormIdentifier).iClickLink({ property: "<%- field.property %>" });
292
+ Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
293
+ <% }) -%>
294
+ <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
295
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(subSection.tableColumns) %>);
296
+ <% } -%>
297
+ <% if (subSection.navigationProperty) { -%>
298
+ <% subSection.contactCardColumns.forEach(function(column) { -%>
299
+ When.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iClickLink(0, "<%- column.property %>");
300
+ Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
301
+ <% }) -%>
302
+ <% } -%>
303
+ <% }) -%>
304
+ <% } else { -%>
305
+ <% if (section.fields && section.fields.length > 0) { -%>
306
+ <% section.fields.forEach(function(field) { -%>
307
+ 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 %>"<% } %> });
308
+ <% }) -%>
309
+ <% } -%>
310
+ <% section.contactCardFields.forEach(function(field) { -%>
311
+ When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iClickLink({ property: "<%- field.property %>" });
312
+ Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
313
+ <% }) -%>
314
+ <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
315
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(section.tableColumns) %>);
316
+ <% } -%>
317
+ <% } -%>
318
+ });
319
+
320
+ <% }) -%>
321
+ <% } -%>
322
+ opaTest("Teardown", function (Given: Given) {
323
+ // Cleanup
324
+ Given.iTearDownMyApp();
325
+ });
326
+ }
327
+
328
+ runner.run([journey]);
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Integration tests</title>
5
+ <meta charset="utf-8">
6
+
7
+ <script id="sap-ui-bootstrap"
8
+ src="../../resources/sap-ui-core.js"
9
+ data-sap-ui-theme='sap_fiori_3'
10
+ data-sap-ui-resourceroots='{
11
+ "<%- appID %>": "../../",
12
+ "<%- appID %>.test": "../"
13
+ }'
14
+ data-sap-ui-animation="false"
15
+ data-sap-ui-compatVersion="edge"
16
+ data-sap-ui-async="true">
17
+ </script>
18
+
19
+ <link rel="stylesheet" type="text/css" href="../../resources/sap/ui/thirdparty/qunit-2.css">
20
+
21
+ <script src="opaTests.qunit.js"></script>
22
+
23
+ </head>
24
+ <body>
25
+ <div id="qunit"></div>
26
+ <div id="qunit-fixture"></div>
27
+ </body>
28
+ </html>
@@ -0,0 +1,33 @@
1
+ sap.ui.loader.config({
2
+ shim: {
3
+ "sap/ui/qunit/qunit-junit": {
4
+ deps: ["sap/ui/thirdparty/qunit-2"]
5
+ },
6
+ "sap/ui/qunit/qunit-coverage": {
7
+ deps: ["sap/ui/thirdparty/qunit-2"]
8
+ },
9
+ "sap/ui/thirdparty/sinon-qunit": {
10
+ deps: ["sap/ui/thirdparty/qunit-2", "sap/ui/thirdparty/sinon"]
11
+ },
12
+ "sap/ui/qunit/sinon-qunit-bridge": {
13
+ deps: ["sap/ui/thirdparty/qunit-2", "sap/ui/thirdparty/sinon-4"]
14
+ }
15
+ }
16
+ });
17
+
18
+ window.QUnit = Object.assign({}, window.QUnit, { config: { autostart: false } });
19
+
20
+ sap.ui.require(
21
+ [
22
+ "sap/ui/thirdparty/qunit-2",
23
+ "sap/ui/qunit/qunit-junit",
24
+ "sap/ui/qunit/qunit-coverage",
25
+ <%_ if (generatedJourneys && generatedJourneys.length > 0) { -%><%_ generatedJourneys.forEach(function(page) { -%>
26
+ "<%- appPath %>/test/integration/<%- page %>Journey.gen",
27
+ <%_ }); -%><%_ } else { -%>
28
+ "<%- appPath %>/test/integration/<%- opaJourneyFileName %>",
29
+ <%_ } -%>
30
+ ], function (QUnit) {
31
+ "use strict";
32
+ QUnit.start();
33
+ });
@@ -0,0 +1,30 @@
1
+ /******************************************************************************
2
+ * ╔═══════════════════════════════════════════════════════════════════════╗ *
3
+ * ║ ║ *
4
+ * ║ WARNING: AUTO-GENERATED FILE ║ *
5
+ * ║ ║ *
6
+ * ║ This file is automatically generated by SAP Fiori tools and is ║ *
7
+ * ║ overwritten when you run the OPA test generator again. ║ *
8
+ * ║ ║ *
9
+ * ║ To add your own custom pages: ║ *
10
+ * ║ - Create a new page file in this directory. ║ *
11
+ * ║ - Follow the same pattern as this file. ║ *
12
+ * ║ - Add the new file to the JourneyRunner. ║ *
13
+ * ║ - Custom page files are not overwritten. ║ *
14
+ * ║ ║ *
15
+ * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
+ ******************************************************************************/
17
+
18
+ sap.ui.define(['sap/fe/test/TemplatePage'], function(TemplatePage) {
19
+ 'use strict';
20
+
21
+ const CustomPageDefinitions = {
22
+ actions: {},
23
+ assertions: {}
24
+ };
25
+
26
+ return new TemplatePage(
27
+ '<%- appID %>::<%- componentID %>',
28
+ CustomPageDefinitions
29
+ );
30
+ });
@@ -0,0 +1,25 @@
1
+ /******************************************************************************
2
+ * ╔═══════════════════════════════════════════════════════════════════════╗ *
3
+ * ║ ║ *
4
+ * ║ WARNING: AUTO-GENERATED FILE ║ *
5
+ * ║ ║ *
6
+ * ║ This file is automatically generated by SAP Fiori tools and is ║ *
7
+ * ║ overwritten when you run the OPA test generator again. ║ *
8
+ * ║ ║ *
9
+ * ║ To add your own custom pages: ║ *
10
+ * ║ - Create a new page file in this directory. ║ *
11
+ * ║ - Follow the same pattern as this file. ║ *
12
+ * ║ - Add the new file to the JourneyRunner. ║ *
13
+ * ║ - Custom page files are not overwritten. ║ *
14
+ * ║ ║ *
15
+ * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
+ ******************************************************************************/
17
+
18
+ export const actions = {};
19
+
20
+ export const assertions = {};
21
+
22
+ export default class FPM {
23
+ actions = actions;
24
+ assertions = assertions;
25
+ }
@@ -0,0 +1,17 @@
1
+ sap.ui.define([
2
+ "sap/fe/test/JourneyRunner"<% if (pages.length > 0) { %>,
3
+ <%- pages.map((page) => {return "\t\"" + page.appPath + '/test/integration/pages/' + page.fileName + "\"";}).join(',\n')%>
4
+ <% } %>], function (JourneyRunner<% if (pages.length > 0) { %>, <%- pages.map(function(page) {return page.targetKey + "Generated";}).join(', ') %><% } %>) {
5
+ 'use strict';
6
+
7
+ const runner = new JourneyRunner({
8
+ launchUrl: sap.ui.require.toUrl('<%- appPath %>') + '/<%- htmlTarget %>',
9
+ pages: {<% if (pages.length > 0) { %>
10
+ <%- pages.map((page) => {return '\t\t\tonThe' + page.targetKey + 'Generated: ' + page.targetKey + "Generated"}).join(',\n')%>
11
+ <% } %>},
12
+ async: true
13
+ });
14
+
15
+ return runner;
16
+ });
17
+
@@ -0,0 +1,36 @@
1
+ import JourneyRunner from "sap/fe/test/JourneyRunner";
2
+ <% if (pages.some((p) => p.template === 'ListReport')) { -%>
3
+ import ListReport from "sap/fe/test/ListReport";
4
+ <% } -%>
5
+ <% if (pages.some((p) => p.template === 'ObjectPage')) { -%>
6
+ import ObjectPage from "sap/fe/test/ObjectPage";
7
+ <% } -%>
8
+ <% if (pages.some((p) => p.template === 'FPM')) { -%>
9
+ import TemplatePage from "sap/fe/test/TemplatePage";
10
+ <% } -%>
11
+ <%- pages.map((page) => 'import Custom' + page.targetKey + 'Generated from "./' + page.targetKey + '.gen";').join('\n') %>
12
+
13
+ const runner = new JourneyRunner({
14
+ launchUrl: sap.ui.require.toUrl("<%- appPath %>") + "/<%- htmlTarget %>",
15
+ pages: {
16
+ <%- pages.map((page) =>
17
+ page.template === 'FPM'
18
+ ? ' onThe' + page.targetKey + 'Generated: new (TemplatePage as unknown as new (id: string, defs: object) => object)(\n' +
19
+ ' "' + page.appID + '::' + page.componentID + '",\n' +
20
+ ' Custom' + page.targetKey + 'Generated\n' +
21
+ ' )'
22
+ : ' onThe' + page.targetKey + 'Generated: new ' + page.template + '(\n' +
23
+ ' {\n' +
24
+ ' appId: "' + page.appID + '",\n' +
25
+ ' componentId: "' + page.componentID + '",\n' +
26
+ ' entitySet: "' + (page.entitySet || '') + '",\n' +
27
+ ' contextPath: "' + (page.contextPath || '') + '"\n' +
28
+ ' },\n' +
29
+ ' Custom' + page.targetKey + 'Generated\n' +
30
+ ' )'
31
+ ).join(',\n') %>
32
+ },
33
+ async: true
34
+ });
35
+
36
+ export default runner;
@@ -0,0 +1,35 @@
1
+ /******************************************************************************
2
+ * ╔═══════════════════════════════════════════════════════════════════════╗ *
3
+ * ║ ║ *
4
+ * ║ WARNING: AUTO-GENERATED FILE ║ *
5
+ * ║ ║ *
6
+ * ║ This file is automatically generated by SAP Fiori tools and is ║ *
7
+ * ║ overwritten when you run the OPA test generator again. ║ *
8
+ * ║ ║ *
9
+ * ║ To add your own custom pages: ║ *
10
+ * ║ - Create a new page file in this directory. ║ *
11
+ * ║ - Follow the same pattern as this file. ║ *
12
+ * ║ - Add the new file to the JourneyRunner. ║ *
13
+ * ║ - Custom page files are not overwritten. ║ *
14
+ * ║ ║ *
15
+ * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
+ ******************************************************************************/
17
+
18
+ sap.ui.define(['sap/fe/test/ListReport'], function(ListReport) {
19
+ 'use strict';
20
+
21
+ const CustomPageDefinitions = {
22
+ actions: {},
23
+ assertions: {}
24
+ };
25
+
26
+ return new ListReport(
27
+ {
28
+ appId: '<%- appID %>',
29
+ componentId: '<%- componentID %>',<% if (locals.contextPath) { %>
30
+ contextPath: '<%- contextPath %>'<% } else if (locals.entitySet) { %>
31
+ entitySet: '<%- entitySet %>'<% } %>
32
+ },
33
+ CustomPageDefinitions
34
+ );
35
+ });
@@ -0,0 +1,25 @@
1
+ /******************************************************************************
2
+ * ╔═══════════════════════════════════════════════════════════════════════╗ *
3
+ * ║ ║ *
4
+ * ║ WARNING: AUTO-GENERATED FILE ║ *
5
+ * ║ ║ *
6
+ * ║ This file is automatically generated by SAP Fiori tools and is ║ *
7
+ * ║ overwritten when you run the OPA test generator again. ║ *
8
+ * ║ ║ *
9
+ * ║ To add your own custom pages: ║ *
10
+ * ║ - Create a new page file in this directory. ║ *
11
+ * ║ - Follow the same pattern as this file. ║ *
12
+ * ║ - Add the new file to the JourneyRunner. ║ *
13
+ * ║ - Custom page files are not overwritten. ║ *
14
+ * ║ ║ *
15
+ * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
+ ******************************************************************************/
17
+
18
+ export const actions = {};
19
+
20
+ export const assertions = {};
21
+
22
+ export default class ListReport {
23
+ actions = actions;
24
+ assertions = assertions;
25
+ }
@@ -0,0 +1,35 @@
1
+ /******************************************************************************
2
+ * ╔═══════════════════════════════════════════════════════════════════════╗ *
3
+ * ║ ║ *
4
+ * ║ WARNING: AUTO-GENERATED FILE ║ *
5
+ * ║ ║ *
6
+ * ║ This file is automatically generated by SAP Fiori tools and is ║ *
7
+ * ║ overwritten when you run the OPA test generator again. ║ *
8
+ * ║ ║ *
9
+ * ║ To add your own custom pages: ║ *
10
+ * ║ - Create a new page file in this directory. ║ *
11
+ * ║ - Follow the same pattern as this file. ║ *
12
+ * ║ - Add the new file to the JourneyRunner. ║ *
13
+ * ║ - Custom page files are not overwritten. ║ *
14
+ * ║ ║ *
15
+ * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
+ ******************************************************************************/
17
+
18
+ sap.ui.define(['sap/fe/test/ObjectPage'], function(ObjectPage) {
19
+ 'use strict';
20
+
21
+ const CustomPageDefinitions = {
22
+ actions: {},
23
+ assertions: {}
24
+ };
25
+
26
+ return new ObjectPage(
27
+ {
28
+ appId: '<%- appID %>',
29
+ componentId: '<%- componentID %>',<% if (locals.contextPath) { %>
30
+ contextPath: '<%- contextPath %>'<% } else if (locals.entitySet) { %>
31
+ entitySet: '<%- entitySet %>'<% } %>
32
+ },
33
+ CustomPageDefinitions
34
+ );
35
+ });
@@ -0,0 +1,25 @@
1
+ /******************************************************************************
2
+ * ╔═══════════════════════════════════════════════════════════════════════╗ *
3
+ * ║ ║ *
4
+ * ║ WARNING: AUTO-GENERATED FILE ║ *
5
+ * ║ ║ *
6
+ * ║ This file is automatically generated by SAP Fiori tools and is ║ *
7
+ * ║ overwritten when you run the OPA test generator again. ║ *
8
+ * ║ ║ *
9
+ * ║ To add your own custom pages: ║ *
10
+ * ║ - Create a new page file in this directory. ║ *
11
+ * ║ - Follow the same pattern as this file. ║ *
12
+ * ║ - Add the new file to the JourneyRunner. ║ *
13
+ * ║ - Custom page files are not overwritten. ║ *
14
+ * ║ ║ *
15
+ * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
+ ******************************************************************************/
17
+
18
+ export const actions = {};
19
+
20
+ export const assertions = {};
21
+
22
+ export default class ObjectPage {
23
+ actions = actions;
24
+ assertions = assertions;
25
+ }