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

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 +1 -1
  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,79 @@
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
+ * ║ Do not edit this file directly. Any changes will be lost. ║ *
10
+ * ║ ║ *
11
+ * ╚═══════════════════════════════════════════════════════════════════════╝ *
12
+ ******************************************************************************/
13
+
14
+ import type Opa5 from "sap/ui/test/Opa5";
15
+ <% if (pages.some(p => p.template === 'ListReport')) { -%>
16
+ import type { actions as ListReportActions, assertions as ListReportAssertions } from "sap/fe/test/ListReport";
17
+ <% } -%>
18
+ <% if (pages.some(p => p.template === 'ObjectPage')) { -%>
19
+ import type { actions as ObjectPageActions, assertions as ObjectPageAssertions } from "sap/fe/test/ObjectPage";
20
+ <% } -%>
21
+ <% if (pages.some(p => p.template === 'ListReport' || p.template === 'ObjectPage' || p.template === 'FPM')) { -%>
22
+ import type { actions as TemplatePageActions, assertions as TemplatePageAssertions } from "sap/fe/test/TemplatePage";
23
+ <% } -%>
24
+ import type Shell from "sap/fe/test/Shell";
25
+ import type BaseArrangements from "sap/fe/test/BaseArrangements";
26
+ <% pages.filter((p) => p.template === 'ListReport' || p.template === 'ObjectPage' || p.template === 'FPM').forEach(function(page) { -%>
27
+ import type { actions as <%- page.targetKey %>GeneratedCustomActions, assertions as <%- page.targetKey %>GeneratedCustomAssertions } from "../pages/<%- page.targetKey %>.gen";
28
+ <% }); -%>
29
+
30
+ /**
31
+ * Enables OPA5 fluent `.and` chaining on page objects and their sub-objects.
32
+ *
33
+ * @example
34
+ * Then.onTheObjectPageGenerated.iCheckSection({ section: "A" }).and.iCheckSection({ section: "B" });
35
+ * When.onTheListReportGenerated.onFilterBar().iExecuteSearch().and.iClearFilterBar();
36
+ */
37
+ type WithAnd<T> = {
38
+ [K in keyof T | 'and']: K extends 'and'
39
+ ? WithAnd<T>
40
+ : 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>)
43
+ : T[K]
44
+ : never;
45
+ };
46
+
47
+ export type Given = Opa5 & BaseArrangements & {
48
+ iTearDownMyApp: () => Given;
49
+ iStartMyApp: (sAppHash?: string, mInUrlParameters?: object) => Given;
50
+ iResetMockData: (oAppInfo?: { AppId?: string; ServiceUri?: string }) => Given;
51
+ iResetTestData: () => Given;
52
+ and: Given;
53
+ };
54
+
55
+ export type When = Opa5 & BaseArrangements & {
56
+ <% pages.forEach(function(page) { -%>
57
+ <% if (page.template === 'ListReport') { -%>
58
+ onThe<%- page.targetKey %>Generated: WithAnd<Opa5 & ListReportActions & TemplatePageActions & typeof <%- page.targetKey %>GeneratedCustomActions>;
59
+ <% } else if (page.template === 'ObjectPage') { -%>
60
+ onThe<%- page.targetKey %>Generated: WithAnd<Opa5 & ObjectPageActions & TemplatePageActions & typeof <%- page.targetKey %>GeneratedCustomActions>;
61
+ <% } else if (page.template === 'FPM') { -%>
62
+ onThe<%- page.targetKey %>Generated: WithAnd<Opa5 & TemplatePageActions & typeof <%- page.targetKey %>GeneratedCustomActions>;
63
+ <% } -%>
64
+ <% }); -%>
65
+ onTheShell: Shell;
66
+ };
67
+
68
+ export type Then = Opa5 & BaseArrangements & {
69
+ <% pages.forEach(function(page) { -%>
70
+ <% if (page.template === 'ListReport') { -%>
71
+ onThe<%- page.targetKey %>Generated: WithAnd<Opa5 & ListReportAssertions & TemplatePageAssertions & typeof <%- page.targetKey %>GeneratedCustomAssertions>;
72
+ <% } else if (page.template === 'ObjectPage') { -%>
73
+ onThe<%- page.targetKey %>Generated: WithAnd<Opa5 & ObjectPageAssertions & TemplatePageAssertions & typeof <%- page.targetKey %>GeneratedCustomAssertions>;
74
+ <% } else if (page.template === 'FPM') { -%>
75
+ onThe<%- page.targetKey %>Generated: WithAnd<Opa5 & TemplatePageAssertions & typeof <%- page.targetKey %>GeneratedCustomAssertions>;
76
+ <% } -%>
77
+ <% }); -%>
78
+ onTheShell: Shell;
79
+ };
@@ -11,19 +11,19 @@ sap.ui.define([
11
11
  Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
12
12
  Given.iResetTestData();
13
13
  Given.iStartMyApp();
14
- <% if (startLR) { %>Then.onThe<%- startLR %>.iSeeThisPage();<%} %>
14
+ <% if (startLR) { %>Then.onThe<%- startLR %>Generated.iSeeThisPage();<%} %>
15
15
  });
16
16
 
17
17
  <% if (startLR) { %>
18
18
  opaTest("Navigate to ObjectPage", function (Given, When, Then) {
19
19
  // Note: this test will fail if the ListReport page doesn't show any data
20
20
  <% if (!hideFilterBar) { %>
21
- When.onThe<%- startLR%>.onFilterBar().iExecuteSearch();
21
+ When.onThe<%- startLR %>Generated.onFilterBar().iExecuteSearch();
22
22
  <%} %>
23
- Then.onThe<%- startLR%>.onTable().iCheckRows();
23
+ Then.onThe<%- startLR %>Generated.onTable().iCheckRows();
24
24
  <% if (navigatedOP) { %>
25
- When.onThe<%- startLR%>.onTable().iPressRow(0);
26
- Then.onThe<%- navigatedOP%>.iSeeThisPage();
25
+ When.onThe<%- startLR %>Generated.onTable().iPressRow(0);
26
+ Then.onThe<%- navigatedOP %>Generated.iSeeThisPage();
27
27
  <%} %>
28
28
  });
29
29
  <%} %>
@@ -11,19 +11,19 @@ sap.ui.define([
11
11
  Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
12
12
  Given.iResetTestData();
13
13
  Given.iStartMyApp();
14
- <% if (startLR) { %>Then.onThe<%- startLR %>.iSeeThisPage();<%} %>
14
+ <% if (startLR) { %>Then.onThe<%- startLR %>Generated.iSeeThisPage();<%} %>
15
15
  });
16
16
 
17
17
  <% if (startLR) { %>
18
18
  opaTest("Navigate to ObjectPage", function (Given, When, Then) {
19
19
  // Note: this test will fail if the ListReport page doesn't show any data
20
20
  <% if (!hideFilterBar) { %>
21
- When.onThe<%- startLR%>.onFilterBar().iExecuteSearch();
21
+ When.onThe<%- startLR %>Generated.onFilterBar().iExecuteSearch();
22
22
  <%} %>
23
- Then.onThe<%- startLR%>.onTable().iCheckRows();
23
+ Then.onThe<%- startLR %>Generated.onTable().iCheckRows();
24
24
  <% if (navigatedOP) { %>
25
- When.onThe<%- startLR%>.onTable().iPressRow(0);
26
- Then.onThe<%- navigatedOP%>.iSeeThisPage();
25
+ When.onThe<%- startLR %>Generated.onTable().iPressRow(0);
26
+ Then.onThe<%- navigatedOP %>Generated.iSeeThisPage();
27
27
  <%} %>
28
28
  });
29
29
  <%} %>
@@ -97,8 +97,8 @@ sap.ui.define([
97
97
  // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction("<%- item.label %>");
98
98
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction("<%- item.label %>", { visible: true });
99
99
  <%_ } else { _%>
100
- // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction("<%- item.label %>");
101
- Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
100
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
101
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: <%- item.enabled === true %> });
102
102
  <%_ } _%>
103
103
  <%_ } _%>
104
104
  <%_ }); _%>
@@ -158,8 +158,8 @@ sap.ui.define([
158
158
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
159
159
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { visible: true });
160
160
  <%_ } else { _%>
161
- // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
162
- Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
161
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
162
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: <%- item.enabled === true %> });
163
163
  <%_ const hasParamDialog = item.parameterDialogFields && item.parameterDialogFields.length > 0; _%>
164
164
  <%_ if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
165
165
  // "<%- 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' %>.
@@ -167,7 +167,7 @@ sap.ui.define([
167
167
  // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
168
168
  <%_ } _%>
169
169
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
170
- // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
170
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
171
171
  <%_ if (hasParamDialog) { _%>
172
172
  <%_ item.parameterDialogFields.forEach(function(parameter) { _%>
173
173
  // Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
@@ -182,7 +182,7 @@ sap.ui.define([
182
182
  <%_ if (item.enabled !== true) { _%>
183
183
  When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
184
184
  <%_ } _%>
185
- When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
185
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
186
186
  <%_ if (hasParamDialog) { _%>
187
187
  <%_ item.parameterDialogFields.forEach(function(parameter) { _%>
188
188
  Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
@@ -109,8 +109,8 @@ function journey() {
109
109
  // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction("<%- item.label %>");
110
110
  Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction("<%- item.label %>", { visible: true });
111
111
  <%_ } else { _%>
112
- // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction("<%- item.label %>");
113
- Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
112
+ // When.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iPressAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
113
+ Then.onThe<%- startLR%>Generated.onTable("<%- tab.key %>").iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: <%- item.enabled === true %> });
114
114
  <%_ } _%>
115
115
  <%_ } _%>
116
116
  <%_ }); _%>
@@ -169,8 +169,8 @@ function journey() {
169
169
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
170
170
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { visible: true });
171
171
  <%_ } else { _%>
172
- // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
173
- Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
172
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
173
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> }, { enabled: <%- item.enabled === true %> });
174
174
  <%_ const hasParamDialog = item.parameterDialogFields && item.parameterDialogFields.length > 0; _%>
175
175
  <%_ if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
176
176
  // "<%- 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' %>.
@@ -178,7 +178,7 @@ function journey() {
178
178
  // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
179
179
  <%_ } _%>
180
180
  // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
181
- // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
181
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
182
182
  <%_ if (hasParamDialog) { _%>
183
183
  <%_ item.parameterDialogFields.forEach(function(parameter) { _%>
184
184
  // Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
@@ -193,7 +193,7 @@ function journey() {
193
193
  <%_ if (item.enabled !== true) { _%>
194
194
  When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
195
195
  <%_ } _%>
196
- When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
196
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction({ service: "<%- item.service %>", action: "<%- item.action %>", unbound: <%- item.unbound === true %> });
197
197
  <%_ if (hasParamDialog) { _%>
198
198
  <%_ item.parameterDialogFields.forEach(function(parameter) { _%>
199
199
  Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });