@sap-ux/ui5-test-writer 1.2.35 → 1.3.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.
Files changed (37) hide show
  1. package/dist/fiori-elements-opa-writer.js +13 -1
  2. package/dist/types.d.ts +4 -0
  3. package/package.json +1 -1
  4. package/templates/v4/1.84/integration/FPMJourney.js +49 -0
  5. package/templates/v4/1.84/integration/FirstJourney.js +35 -0
  6. package/templates/v4/1.84/integration/FirstJourney.ts +32 -0
  7. package/templates/v4/1.84/integration/ListReportJourney.js +129 -0
  8. package/templates/v4/1.84/integration/ListReportJourney.ts +133 -0
  9. package/templates/v4/1.84/integration/ObjectPageJourney.js +160 -0
  10. package/templates/v4/1.84/integration/ObjectPageJourney.ts +178 -0
  11. package/templates/v4/1.84/integration/opaTests.qunit.html +27 -0
  12. package/templates/v4/1.84/integration/opaTests.qunit.js +33 -0
  13. package/templates/v4/1.84/integration/pages/FPM.js +30 -0
  14. package/templates/v4/1.84/integration/pages/JourneyRunner.js +17 -0
  15. package/templates/v4/1.84/integration/pages/JourneyRunner.ts +28 -0
  16. package/templates/v4/1.84/integration/pages/ListReport.js +35 -0
  17. package/templates/v4/1.84/integration/pages/ListReport.ts +25 -0
  18. package/templates/v4/1.84/integration/pages/ObjectPage.js +42 -0
  19. package/templates/v4/1.84/integration/pages/ObjectPage.ts +35 -0
  20. package/templates/v4/1.84/integration/types/OpaJourneyTypes.d.ts +56 -0
  21. /package/templates/v4/{integration → 1.150/integration}/FPMJourney.js +0 -0
  22. /package/templates/v4/{integration → 1.150/integration}/FirstJourney.js +0 -0
  23. /package/templates/v4/{integration → 1.150/integration}/FirstJourney.ts +0 -0
  24. /package/templates/v4/{integration → 1.150/integration}/ListReportJourney.js +0 -0
  25. /package/templates/v4/{integration → 1.150/integration}/ListReportJourney.ts +0 -0
  26. /package/templates/v4/{integration → 1.150/integration}/ObjectPageJourney.js +0 -0
  27. /package/templates/v4/{integration → 1.150/integration}/ObjectPageJourney.ts +0 -0
  28. /package/templates/v4/{integration → 1.150/integration}/opaTests.qunit.html +0 -0
  29. /package/templates/v4/{integration → 1.150/integration}/opaTests.qunit.js +0 -0
  30. /package/templates/v4/{integration → 1.150/integration}/pages/FPM.js +0 -0
  31. /package/templates/v4/{integration → 1.150/integration}/pages/JourneyRunner.js +0 -0
  32. /package/templates/v4/{integration → 1.150/integration}/pages/JourneyRunner.ts +0 -0
  33. /package/templates/v4/{integration → 1.150/integration}/pages/ListReport.js +0 -0
  34. /package/templates/v4/{integration → 1.150/integration}/pages/ListReport.ts +0 -0
  35. /package/templates/v4/{integration → 1.150/integration}/pages/ObjectPage.js +0 -0
  36. /package/templates/v4/{integration → 1.150/integration}/pages/ObjectPage.ts +0 -0
  37. /package/templates/v4/{integration → 1.150/integration}/types/OpaJourneyTypes.d.ts +0 -0
@@ -13,7 +13,17 @@ import { hasVirtualOPA5, addVirtualTestConfig } from './utils/virtualOpaUtils.js
13
13
  import { addJourneysToOpaJourneyTypes } from './utils/opaJourneyTypesUtils.js';
14
14
  import { getPackageScripts } from '@sap-ux/fiori-generator-shared';
15
15
  import { readHashFromFlpSandbox } from './utils/flpSandboxUtils.js';
16
+ import { compareUI5VersionGte } from '@sap-ux/ui5-application-writer';
16
17
  const __dirname = dirname(fileURLToPath(import.meta.url));
18
+ const UI5_VERSION_1_150 = '1.150.0';
19
+ const V4_TEMPLATE_1_84 = '1.84';
20
+ const V4_TEMPLATE_1_150 = '1.150';
21
+ function getTemplateUi5Version(ui5Version) {
22
+ if (!ui5Version || compareUI5VersionGte(ui5Version, UI5_VERSION_1_150)) {
23
+ return V4_TEMPLATE_1_150;
24
+ }
25
+ return V4_TEMPLATE_1_84;
26
+ }
17
27
  /**
18
28
  * Generate OPA test files for a Fiori elements for OData V4 application.
19
29
  * Note: this can potentially overwrite existing files in the webapp/test folder.
@@ -39,7 +49,8 @@ export async function generateOPAFiles(basePath, options, metadata, fs, log, sta
39
49
  const enableTypeScript = !hasFPMPage && (options.enableTypeScript ?? (standalone && existsSync(join(basePath, FileName.Tsconfig))));
40
50
  const dotFileExtension = enableTypeScript ? DotFileExtension.TS : DotFileExtension.JS;
41
51
  const rootCommonTemplateDirPath = join(__dirname, '../templates/common');
42
- const rootV4TemplateDirPath = join(__dirname, `../templates/${applicationType}`); // Only v4 is supported for the time being
52
+ const templateUi5Version = getTemplateUi5Version(options.ui5Version);
53
+ const rootV4TemplateDirPath = join(__dirname, `../templates/${applicationType}`, templateUi5Version);
43
54
  const testOutDirPath = join(await getWebappPath(basePath), 'test');
44
55
  // Access ux-specification to get feature data for OPA test generation
45
56
  const appFeatures = await getAppFeatures(basePath, editor, log, metadata, manifest);
@@ -75,6 +86,7 @@ export async function generateOPAFiles(basePath, options, metadata, fs, log, sta
75
86
  log,
76
87
  journeyParams,
77
88
  dotFileExtension,
89
+ templateUi5Version,
78
90
  generateUxSpecJourneys,
79
91
  modifiedFiles: []
80
92
  };
package/dist/types.d.ts CHANGED
@@ -19,6 +19,8 @@ export type OPAGenerationOptions = {
19
19
  useVirtualPreviewEndpoints?: boolean;
20
20
  /** If true, generate TypeScript files instead of JavaScript. */
21
21
  enableTypeScript?: boolean;
22
+ /** Minimum UI5 version of the target app — selects template bucket ('1.84' / '1.150'). */
23
+ ui5Version?: string;
22
24
  };
23
25
  export declare const SupportedPageTypes: {
24
26
  [id: string]: string;
@@ -243,6 +245,8 @@ export type WriteContext = {
243
245
  hasPreexistingTests?: boolean;
244
246
  incompatibleTestSetup?: boolean;
245
247
  dotFileExtension: DotFileExtension;
248
+ /** Resolved template bucket folder name: '1.84' or '1.150'. */
249
+ templateUi5Version: string;
246
250
  /**
247
251
  * When true, ux-specification-derived journeys (ListReport, ObjectPage, FPM) are generated.
248
252
  * When false (e.g. ObjectPage-only or Analytical List Page projects), only the generic
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/ui5-test-writer",
3
3
  "description": "SAP UI5 tests writer",
4
- "version": "1.2.35",
4
+ "version": "1.3.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -0,0 +1,49 @@
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
+ sap.ui.define([
19
+ "sap/ui/test/opaQunit",
20
+ "./pages/JourneyRunner"
21
+ ], function (opaTest, runner) {
22
+ "use strict";
23
+
24
+ function journey() {
25
+ QUnit.module("FPM journey");
26
+
27
+ opaTest("Start application", function (Given, When, Then) {
28
+ Given.iStartMyApp();
29
+ <%_ startPages.forEach(function(pageName) { %>
30
+ Then.onThe<%- pageName %>Generated.iSeeThisPage();
31
+ <%_ if (filterBarItems && filterBarItems.length > 0) { -%>
32
+ <%_ filterBarItems.forEach(function(item) { _%>
33
+ Then.onThe<%- pageName%>Generated.onFilterBar().iCheckFilterField({ property: "<%- item %>" });
34
+ <%_ }); -%>
35
+ <%_ } -%>
36
+ <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { _%>
37
+ Then.onThe<%- pageName %>Generated.onTable().iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
38
+ <%_ } %>
39
+ <%_ }); -%>
40
+ });
41
+
42
+ opaTest("Teardown", function (Given, When, Then) {
43
+ // Cleanup
44
+ Given.iTearDownMyApp();
45
+ });
46
+ }
47
+
48
+ runner.run([journey]);
49
+ });
@@ -0,0 +1,35 @@
1
+ sap.ui.define([
2
+ "sap/ui/test/opaQunit",
3
+ "./pages/JourneyRunner"
4
+ ], function (opaTest, runner) {
5
+ "use strict";
6
+
7
+ function journey() {
8
+ QUnit.module("First journey");
9
+
10
+ opaTest("Start application", function (Given, When, Then) {
11
+ Given.iStartMyApp();
12
+ <% if (startLR) { %>Then.onThe<%- startLR %>.iSeeThisPage();<%} %>
13
+ });
14
+
15
+ <% if (startLR) { %>
16
+ opaTest("Navigate to ObjectPage", function (Given, When, Then) {
17
+ // Note: this test will fail if the ListReport page doesn't show any data
18
+ <% if (!hideFilterBar) { %>
19
+ When.onThe<%- startLR%>.onFilterBar().iExecuteSearch();
20
+ <%} %>
21
+ Then.onThe<%- startLR%>.onTable().iCheckRows();
22
+ <% if (navigatedOP) { %>
23
+ When.onThe<%- startLR%>.onTable().iPressRow(0);
24
+ Then.onThe<%- navigatedOP%>.iSeeThisPage();
25
+ <%} %>
26
+ });
27
+ <%} %>
28
+ opaTest("Teardown", function (Given, When, Then) {
29
+ // Cleanup
30
+ Given.iTearDownMyApp();
31
+ });
32
+ }
33
+
34
+ runner.run([journey]);
35
+ });
@@ -0,0 +1,32 @@
1
+ import opaTest from "sap/ui/test/opaQunit";
2
+ import type { Given, When, Then } from "./types/OpaJourneyTypes.gen";
3
+ import runner from "./pages/JourneyRunner";
4
+
5
+ function journey() {
6
+ QUnit.module("First journey");
7
+
8
+ opaTest("Start application", function (Given: Given, _When: When<% if (startLR) { %>, Then: Then<% } else { %>, _Then: Then<% } %>) {
9
+ Given.iStartMyApp();
10
+ <% if (startLR) { %>Then.onThe<%- startLR %>Generated.iSeeThisPage();<%} %>
11
+ });
12
+
13
+ <% if (startLR) { %>
14
+ opaTest("Navigate to ObjectPage", function (_Given: Given, When: When, Then: Then) {
15
+ // Note: this test will fail if the ListReport page doesn't show any data
16
+ <% if (!hideFilterBar) { %>
17
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
18
+ <%} %>
19
+ Then.onThe<%- startLR%>Generated.onTable("").iCheckRows();
20
+ <% if (navigatedOP) { %>
21
+ When.onThe<%- startLR%>Generated.onTable("").iPressRow(0);
22
+ Then.onThe<%- navigatedOP%>Generated.iSeeThisPage();
23
+ <%} %>
24
+ });
25
+ <%} %>
26
+ opaTest("Teardown", function (Given: Given) {
27
+ // Cleanup
28
+ Given.iTearDownMyApp();
29
+ });
30
+ }
31
+
32
+ runner.run([journey]);
@@ -0,0 +1,129 @@
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
+ sap.ui.define([
19
+ "sap/ui/test/opaQunit",
20
+ "./pages/JourneyRunner"
21
+ ], function (opaTest, runner) {
22
+ "use strict";
23
+
24
+ function journey() {
25
+ QUnit.module("<%- name%>ListReport journey");
26
+
27
+ const defaultTableId = <%- tableIdentifiers && tableIdentifiers.length > 0 ? '"' + tableIdentifiers[0] + '"' : '""' %>;
28
+
29
+ opaTest("Start application", function (Given, When, Then) {
30
+ Given.iStartMyApp();
31
+ <%_ startPages.forEach(function(pageName) { %>
32
+ Then.onThe<%- pageName %>Generated.iSeeThisPage();
33
+ <%_ }); -%>
34
+ });
35
+
36
+ <%_ if (!hideFilterBar && filterBarItems && filterBarItems.length > 0) { -%>
37
+ opaTest("Check filter bar", function (Given, When, Then) {
38
+ <%_ filterBarItems.forEach(function(item) { _%>
39
+ <%_ if (item.custom) { _%>
40
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- item.description %>");
41
+ <%_ } else { _%>
42
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- item.property %>" });
43
+ <%_ } _%>
44
+ <%_ }); -%>
45
+ });
46
+ <%_ } -%>
47
+ <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
48
+ opaTest("Add semantic key properties to filter bar", function (Given, When, Then) {
49
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
50
+ <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
51
+ When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
52
+ <%_ }); -%>
53
+ When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
54
+ <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
55
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
56
+ <%_ }); -%>
57
+ <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
58
+ // When.onThe<%- startLR%>Generated.onFilterBar().iChangeFilterField({ property: "<%- property %>" }, "<value to filter>", false);
59
+ <%_ }); -%>
60
+ // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
61
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
62
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
63
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<Action Name>", { enabled: true });
64
+ });
65
+ <%_ } -%>
66
+
67
+ // Note: this test will only work if the ListReport page has a search field and shows data that matches the search term. Please ensure that the test data and search term are set up accordingly.
68
+ // opaTest("Perform a global search and check the result", function (Given, When, Then) {
69
+ // When.onThe<%- startLR%>Generated.onFilterBar().iChangeSearchField("Search Term");
70
+ // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
71
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
72
+ // });
73
+
74
+ <%_ if ((toolBarActions && toolBarActions.length > 0 ) || (tableColumns && Object.keys(tableColumns).length > 0)) { -%>
75
+ opaTest("Check table columns and actions", function (Given, When, Then) {
76
+ <%_ if (toolBarActions && toolBarActions.length > 0) { -%>
77
+ <%_ if (createButton.visible && !isALP) { _%>
78
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
79
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressCreate();
80
+ <%_ } _%>
81
+ <%_ if (deleteButton.visible) { _%>
82
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
83
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
84
+ <%_ } _%>
85
+ <%_ toolBarActions.forEach(function(item) { _%>
86
+ <%_ if (item.visible) { _%>
87
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
88
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
89
+ <%_ } _%>
90
+ <%_ }); -%>
91
+ <%_ } -%>
92
+ <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
93
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
94
+ <%_ } -%>
95
+ });
96
+ <%_ } -%>
97
+
98
+ <%_ if (startLR) { -%>
99
+ opaTest("Navigate to ObjectPage", function (Given, When, Then) {
100
+ // Note: this test will fail if the ListReport page doesn't show any data
101
+ <%_ if (!hideFilterBar) { -%>
102
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
103
+ <%_ } -%>
104
+ <%_ if (tableIdentifiers && tableIdentifiers.length > 0) { -%>
105
+ <%_ tableIdentifiers.forEach(function(tabId) { _%>
106
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tabId %>" });
107
+ Then.onThe<%- startLR%>Generated.onTable("<%- tabId %>").iCheckRows();
108
+ <%_ }); -%>
109
+ <%_ } else { -%>
110
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
111
+ <%_ } -%>
112
+ <%_ if (navigatedOP) { -%>
113
+ <%_ if (tableIdentifiers && tableIdentifiers.length > 0) { _%>
114
+ When.onThe<%- startLR%>Generated.iGoToView({ key: defaultTableId });
115
+ <%_ } _%>
116
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressRow(0);
117
+ Then.onThe<%- navigatedOP%>Generated.iSeeThisPage();
118
+ <%_ } -%>
119
+ });
120
+ <%_ } -%>
121
+
122
+ opaTest("Teardown", function (Given, When, Then) {
123
+ // Cleanup
124
+ Given.iTearDownMyApp();
125
+ });
126
+ }
127
+
128
+ runner.run([journey]);
129
+ });
@@ -0,0 +1,133 @@
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 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";
26
+ <% } -%>
27
+ import runner from "./pages/JourneyRunner";
28
+
29
+ function journey() {
30
+ QUnit.module("<%- name%>ListReport journey");
31
+
32
+ const defaultTableId = <%- tableIdentifiers && tableIdentifiers.length > 0 ? '"' + tableIdentifiers[0] + '"' : '""' %>;
33
+
34
+ opaTest("Start application", function (Given: Given, _When: When, Then: Then) {
35
+ Given.iStartMyApp();
36
+ <%_ startPages.forEach(function(pageName) { %>
37
+ Then.onThe<%- pageName %>Generated.iSeeThisPage();
38
+ <%_ }); -%>
39
+ });
40
+
41
+ <%_ if (!hideFilterBar && filterBarItems && filterBarItems.length > 0) { -%>
42
+ opaTest("Check filter bar", function (_Given: Given, _When: When, Then: Then) {
43
+ <%_ filterBarItems.forEach(function(item) { _%>
44
+ <%_ if (item.custom) { _%>
45
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- item.description %>" as unknown as FilterFieldIdentifier);
46
+ <%_ } else { _%>
47
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- item.property %>" });
48
+ <%_ } _%>
49
+ <%_ }); -%>
50
+ });
51
+ <%_ } -%>
52
+ <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
53
+ opaTest("Add semantic key properties to filter bar", function (_Given: Given, When: When, Then: Then) {
54
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
55
+ <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
56
+ When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
57
+ <%_ }); -%>
58
+ When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
59
+ <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
60
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
61
+ <%_ }); -%>
62
+ <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
63
+ // When.onThe<%- startLR%>Generated.onFilterBar().iChangeFilterField({ property: "<%- property %>" }, "<value to filter>", false);
64
+ <%_ }); -%>
65
+ // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
66
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
67
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
68
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<Action Name>", { enabled: true });
69
+ });
70
+ <%_ } -%>
71
+
72
+ // Note: this test will only work if the ListReport page has a search field and shows data that matches the search term. Please ensure that the test data and search term are set up accordingly.
73
+ // opaTest("Perform a global search and check the result", function (Given: Given, When: When, Then: Then) {
74
+ // When.onThe<%- startLR%>Generated.onFilterBar().iChangeSearchField("Search Term");
75
+ // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
76
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
77
+ // });
78
+
79
+ <%_ if ((toolBarActions && toolBarActions.length > 0 ) || (tableColumns && Object.keys(tableColumns).length > 0)) { -%>
80
+ opaTest("Check table columns and actions", function (_Given: Given, _When: When, Then: Then) {
81
+ <%_ if (toolBarActions && toolBarActions.length > 0) { -%>
82
+ <%_ if (createButton.visible && !isALP) { _%>
83
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
84
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressCreate();
85
+ <%_ } _%>
86
+ <%_ if (deleteButton.visible) { _%>
87
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
88
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
89
+ <%_ } _%>
90
+ <%_ toolBarActions.forEach(function(item) { _%>
91
+ <%_ if (item.visible) { _%>
92
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
93
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
94
+ <%_ } _%>
95
+ <%_ }); -%>
96
+ <%_ } -%>
97
+ <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
98
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
99
+ <%_ } -%>
100
+ });
101
+ <%_ } -%>
102
+
103
+ <%_ if (startLR) { -%>
104
+ opaTest("Navigate to ObjectPage", function (_Given: Given, When: When, Then: Then) {
105
+ // Note: this test will fail if the ListReport page doesn't show any data
106
+ <%_ if (!hideFilterBar) { -%>
107
+ When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
108
+ <%_ } -%>
109
+ <%_ if (tableIdentifiers && tableIdentifiers.length > 0) { -%>
110
+ <%_ tableIdentifiers.forEach(function(tabId) { _%>
111
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tabId %>" });
112
+ Then.onThe<%- startLR%>Generated.onTable("<%- tabId %>").iCheckRows();
113
+ <%_ }); -%>
114
+ <%_ } else { -%>
115
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
116
+ <%_ } -%>
117
+ <%_ if (navigatedOP) { -%>
118
+ <%_ if (tableIdentifiers && tableIdentifiers.length > 0) { _%>
119
+ When.onThe<%- startLR%>Generated.iGoToView({ key: defaultTableId });
120
+ <%_ } _%>
121
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressRow(0);
122
+ Then.onThe<%- navigatedOP%>Generated.iSeeThisPage();
123
+ <%_ } -%>
124
+ });
125
+ <%_ } -%>
126
+
127
+ opaTest("Teardown", function (Given: Given) {
128
+ // Cleanup
129
+ Given.iTearDownMyApp();
130
+ });
131
+ }
132
+
133
+ runner.run([journey]);
@@ -0,0 +1,160 @@
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
+ sap.ui.define([
19
+ "sap/ui/test/opaQunit",
20
+ "./pages/JourneyRunner"
21
+ ], function (opaTest, runner) {
22
+ "use strict";
23
+
24
+ function journey() {
25
+ QUnit.module("<%- name%>ObjectPage journey");
26
+
27
+ opaTest("Navigate to <%- name%>ObjectPage", function (Given, When, Then) {
28
+ Given.iStartMyApp();
29
+ <% if(navigationParents.parentLRName) { -%>
30
+ <% if (!hideFilterBar) { -%>
31
+ When.onThe<%- navigationParents.parentLRName%>Generated.onFilterBar().iExecuteSearch();
32
+ <% } -%>
33
+ Then.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- navigationParents.parentLRTableIdentifier ? '"' + navigationParents.parentLRTableIdentifier + '"' : '' %>).iCheckRows();
34
+ When.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- navigationParents.parentLRTableIdentifier ? '"' + navigationParents.parentLRTableIdentifier + '"' : '' %>).iPressRow(0);
35
+ <% } -%>
36
+ <% navigationParents.parentOPs.forEach(function(parent) { %>
37
+ Then.onThe<%- parent.name %>Generated.iSeeThisPage();
38
+ Then.onThe<%- parent.name %>Generated.onTable({ property: "<%- parent.navigationProperty %>" }).iCheckRows();
39
+ When.onThe<%- parent.name %>Generated.onTable({ property: "<%- parent.navigationProperty %>" }).iPressRow(0);
40
+ <% }); %>
41
+ Then.onThe<%- name%>Generated.iSeeThisPage();
42
+ });
43
+
44
+ <% if (headerActions?.length > 0) { -%>
45
+ opaTest("Check header actions of the Object Page", function (Given, When, Then) {
46
+ <% if (editButton?.visible) { -%>
47
+ // Ensure the opened entity is not in Draft state before uncommenting
48
+ // Then.onThe<%- name%>Generated.onHeader().iCheckEdit({ visible: true });
49
+ // When.onThe<%- name%>Generated.onHeader().iPressEdit();
50
+ <% } -%>
51
+ <% headerActions.forEach(function(action) { -%>
52
+ <% if (action.visible) { -%>
53
+ <% if (action.enabled === 'dynamic') { -%>
54
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
55
+ <% } else { -%>
56
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
57
+ <% } -%>
58
+ // When.onThe<%- name%>Generated.onHeader().iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
59
+ <% } -%>
60
+ <% }); -%>
61
+ });
62
+ <% } -%>
63
+
64
+ <% if (headerSections?.length > 0) { -%>
65
+ opaTest("Check header facets of the Object Page", function (Given, When, Then) {
66
+ <% headerSections.forEach(function(section) { -%>
67
+ <% if (section.microChart) { -%>
68
+ Then.onThe<%- name%>Generated.onHeader().iCheckMicroChart("<%- section.title %>");
69
+ <% } else { -%>
70
+ Then.onThe<%- name%>Generated.onHeader().iCheckHeaderFacet({ facetId: "<%- section.facetId %>"<% if (section.custom) { %>, custom: true<% } %> });
71
+ <% if (section.form) { -%>
72
+ <% section.fields.forEach(function(field) { -%>
73
+ Then.onThe<%- name%>Generated.onHeader().iCheckFieldInFieldGroup({
74
+ fieldGroup: "<%- field.fieldGroupQualifier %>",
75
+ field: "<%- field.field %>",
76
+ targetAnnotation: "<%- field.targetAnnotation %>"
77
+ });
78
+ <% }) -%>
79
+ <% } -%>
80
+ <% } -%>
81
+ <% }) -%>
82
+ });
83
+ <% } -%>
84
+
85
+ <% if (bodySections?.length > 0) { -%>
86
+ opaTest("Check body sections of the Object Page", function (Given, When, Then) {
87
+ <% if (bodySections?.length > 1) { -%>
88
+ Then.onThe<%- name%>Generated.iCheckNumberOfSections(<%- bodySections.length %>);
89
+ <% } -%>
90
+ <% bodySections.forEach(function(section) { -%>
91
+ <% if (bodySections.length > 1) { -%>
92
+ When.onThe<%- name%>Generated.iPressSectionIconTabFilterButton("<%- section.id %>");
93
+ <% } -%>
94
+ Then.onThe<%- name%>Generated.iCheckSection({ section: "<%- section.id %>" });
95
+ <% if (section.actions && section.actions.length > 0) { -%>
96
+ <% section.actions.forEach(function(action) { -%>
97
+ <% if (action.visible) { -%>
98
+ <% if (section.isTable && section.navigationProperty) { -%>
99
+ <% if (action.enabled === 'dynamic') { -%>
100
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
101
+ <% } else { -%>
102
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
103
+ <% } -%>
104
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
105
+ <% } else { -%>
106
+ <% if (action.enabled === 'dynamic') { -%>
107
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
108
+ <% } else { -%>
109
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
110
+ <% } -%>
111
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
112
+ <% } -%>
113
+ <% } -%>
114
+ <% }); -%>
115
+ <% } -%>
116
+ <% if (section.isTable && section.navigationProperty) { -%>
117
+ <% if (section.createButton?.visible) { -%>
118
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckCreate({ visible: true });
119
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressCreate();
120
+ <% } -%>
121
+ <% if (section.deleteButton?.visible) { -%>
122
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckDelete({ visible: true });
123
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressDelete();
124
+ <% } -%>
125
+ <% } -%>
126
+ <% if (section?.subSections?.length > 0) { -%>
127
+ <% section.subSections.forEach(function(subSection) { -%>
128
+ //When.onThe<%- name%>Generated.iGoToSection({ section: "<%- section.id %>", subSection: "<%- subSection.id %>" });
129
+ Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" });
130
+ <% if (subSection.fields && subSection.fields.length > 0) { -%>
131
+ <% subSection.fields.forEach(function(field) { -%>
132
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
133
+ <% }) -%>
134
+ <% } -%>
135
+ <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
136
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(subSection.tableColumns) %>);
137
+ <% } -%>
138
+ <% }) -%>
139
+ <% } else { -%>
140
+ <% if (section.fields && section.fields.length > 0) { -%>
141
+ <% section.fields.forEach(function(field) { -%>
142
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
143
+ <% }) -%>
144
+ <% } -%>
145
+ <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
146
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(section.tableColumns) %>);
147
+ <% } -%>
148
+ <% } -%>
149
+ <% }) -%>
150
+ });
151
+ <% } -%>
152
+
153
+ opaTest("Teardown", function (Given, When, Then) {
154
+ // Cleanup
155
+ Given.iTearDownMyApp();
156
+ });
157
+ }
158
+
159
+ runner.run([journey]);
160
+ });
@@ -0,0 +1,178 @@
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
+ -%>
35
+ <% if (usesFieldIdentifier) { -%>
36
+ import type { FieldIdentifier } from "sap/fe/test/api/BaseAPI";
37
+ <% } -%>
38
+ <% if (usesFormIdentifier) { -%>
39
+ import type { FormIdentifier } from "sap/fe/test/api/FormAPI";
40
+ <% } -%>
41
+ import runner from "./pages/JourneyRunner";
42
+
43
+ function journey() {
44
+ QUnit.module("<%- name%>ObjectPage journey");
45
+
46
+ opaTest("Navigate to <%- name%>ObjectPage", function (Given: Given, When: When, Then: Then) {
47
+ Given.iStartMyApp();
48
+ <% if(navigationParents.parentLRName) { -%>
49
+ <% if (!hideFilterBar) { -%>
50
+ When.onThe<%- navigationParents.parentLRName%>Generated.onFilterBar().iExecuteSearch();
51
+ <% } -%>
52
+ Then.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- navigationParents.parentLRTableIdentifier ? '"' + navigationParents.parentLRTableIdentifier + '"' : '""' %>).iCheckRows();
53
+ When.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- navigationParents.parentLRTableIdentifier ? '"' + navigationParents.parentLRTableIdentifier + '"' : '""' %>).iPressRow(0);
54
+ <% } -%>
55
+ <% navigationParents.parentOPs.forEach(function(parent) { %>
56
+ Then.onThe<%- parent.name %>Generated.iSeeThisPage();
57
+ Then.onThe<%- parent.name %>Generated.onTable({ property: "<%- parent.navigationProperty %>" }).iCheckRows();
58
+ When.onThe<%- parent.name %>Generated.onTable({ property: "<%- parent.navigationProperty %>" }).iPressRow(0);
59
+ <% }); %>
60
+ Then.onThe<%- name%>Generated.iSeeThisPage();
61
+ });
62
+
63
+ <% if (headerActions?.length > 0) { -%>
64
+ opaTest("Check header actions of the Object Page", function (_Given: Given, _When: When, Then: Then) {
65
+ <% if (editButton?.visible) { -%>
66
+ // Ensure the opened entity is not in Draft state before uncommenting
67
+ // Then.onThe<%- name%>Generated.onHeader().iCheckEdit({ visible: true });
68
+ // When.onThe<%- name%>Generated.onHeader().iPressEdit();
69
+ <% } -%>
70
+ <% headerActions.forEach(function(action) { -%>
71
+ <% if (action.visible) { -%>
72
+ <% if (action.enabled === 'dynamic') { -%>
73
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
74
+ <% } else { -%>
75
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
76
+ <% } -%>
77
+ // When.onThe<%- name%>Generated.onHeader().iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
78
+ <% } -%>
79
+ <% }); -%>
80
+ });
81
+ <% } -%>
82
+
83
+ <% if (headerSections?.length > 0) { -%>
84
+ opaTest("Check header facets of the Object Page", function (_Given: Given, _When: When, Then: Then) {
85
+ <% headerSections.forEach(function(section) { -%>
86
+ <% if (section.microChart) { -%>
87
+ Then.onThe<%- name%>Generated.onHeader().iCheckMicroChart("<%- section.title %>", "");
88
+ <% } else { -%>
89
+ Then.onThe<%- name%>Generated.onHeader().iCheckHeaderFacet({ facetId: "<%- section.facetId %>"<% if (section.custom) { %>, custom: true<% } %> });
90
+ <% if (section.form) { -%>
91
+ <% section.fields.forEach(function(field) { -%>
92
+ Then.onThe<%- name%>Generated.onHeader().iCheckFieldInFieldGroup({
93
+ fieldGroup: "<%- field.fieldGroupQualifier %>",
94
+ field: "<%- field.field %>",
95
+ targetAnnotation: "<%- field.targetAnnotation %>"
96
+ } as unknown as FieldIdentifier);
97
+ <% }) -%>
98
+ <% } -%>
99
+ <% } -%>
100
+ <% }) -%>
101
+ });
102
+ <% } -%>
103
+
104
+ <% if (bodySections?.length > 0) { -%>
105
+ opaTest("Check body sections of the Object Page", function (_Given: Given, <% if (bodySections?.length > 1) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
106
+ <% if (bodySections?.length > 1) { -%>
107
+ Then.onThe<%- name%>Generated.iCheckNumberOfSections(<%- bodySections.length %>);
108
+ <% } -%>
109
+ <% bodySections.forEach(function(section) { -%>
110
+ <% if (bodySections.length > 1) { -%>
111
+ When.onThe<%- name%>Generated.iPressSectionIconTabFilterButton("<%- section.id %>");
112
+ <% } -%>
113
+ Then.onThe<%- name%>Generated.iCheckSection({ section: "<%- section.id %>" }, {});
114
+ <% if (section.actions && section.actions.length > 0) { -%>
115
+ <% section.actions.forEach(function(action) { -%>
116
+ <% if (action.visible) { -%>
117
+ <% if (section.isTable && section.navigationProperty) { -%>
118
+ <% if (action.enabled === 'dynamic') { -%>
119
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
120
+ <% } else { -%>
121
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
122
+ <% } -%>
123
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
124
+ <% } else { -%>
125
+ <% if (action.enabled === 'dynamic') { -%>
126
+ 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 } */);
127
+ <% } else { -%>
128
+ 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 %> });
129
+ <% } -%>
130
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
131
+ <% } -%>
132
+ <% } -%>
133
+ <% }); -%>
134
+ <% } -%>
135
+ <% if (section.isTable && section.navigationProperty) { -%>
136
+ <% if (section.createButton?.visible) { -%>
137
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckCreate({ visible: true });
138
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressCreate();
139
+ <% } -%>
140
+ <% if (section.deleteButton?.visible) { -%>
141
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckDelete({ visible: true });
142
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressDelete();
143
+ <% } -%>
144
+ <% } -%>
145
+ <% if (section?.subSections?.length > 0) { -%>
146
+ <% section.subSections.forEach(function(subSection) { -%>
147
+ //When.onThe<%- name%>Generated.iGoToSection({ section: "<%- section.id %>", subSection: "<%- subSection.id %>" });
148
+ Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" }, {});
149
+ <% if (subSection.fields && subSection.fields.length > 0) { -%>
150
+ <% subSection.fields.forEach(function(field) { -%>
151
+ 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 %>"<% } %> });
152
+ <% }) -%>
153
+ <% } -%>
154
+ <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
155
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(subSection.tableColumns) %>);
156
+ <% } -%>
157
+ <% }) -%>
158
+ <% } else { -%>
159
+ <% if (section.fields && section.fields.length > 0) { -%>
160
+ <% section.fields.forEach(function(field) { -%>
161
+ 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 %>"<% } %> });
162
+ <% }) -%>
163
+ <% } -%>
164
+ <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
165
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(section.tableColumns) %>);
166
+ <% } -%>
167
+ <% } -%>
168
+ <% }) -%>
169
+ });
170
+ <% } -%>
171
+
172
+ opaTest("Teardown", function (Given: Given) {
173
+ // Cleanup
174
+ Given.iTearDownMyApp();
175
+ });
176
+ }
177
+
178
+ runner.run([journey]);
@@ -0,0 +1,27 @@
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
+ }'
13
+ data-sap-ui-animation="false"
14
+ data-sap-ui-compatVersion="edge"
15
+ data-sap-ui-async="true">
16
+ </script>
17
+
18
+ <link rel="stylesheet" type="text/css" href="../../resources/sap/ui/thirdparty/qunit-2.css">
19
+
20
+ <script src="opaTests.qunit.js"></script>
21
+
22
+ </head>
23
+ <body>
24
+ <div id="qunit"></div>
25
+ <div id="qunit-fixture"></div>
26
+ </body>
27
+ </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,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,28 @@
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
+ <%- pages.map((page) => 'import Custom' + page.targetKey + 'Generated from "./' + page.targetKey + '.gen";').join('\n') %>
9
+
10
+ const runner = new JourneyRunner({
11
+ launchUrl: sap.ui.require.toUrl("<%- appPath %>") + "/<%- htmlTarget %>",
12
+ pages: {
13
+ <%- pages.map((page) =>
14
+ ' onThe' + page.targetKey + 'Generated: new ' + page.template + '(\n' +
15
+ ' {\n' +
16
+ ' appId: "' + page.appID + '",\n' +
17
+ ' componentId: "' + page.componentID + '",\n' +
18
+ ' entitySet: "' + (page.entitySet || '') + '",\n' +
19
+ ' contextPath: "' + (page.contextPath || '') + '"\n' +
20
+ ' },\n' +
21
+ ' Custom' + page.targetKey + 'Generated\n' +
22
+ ' )'
23
+ ).join(',\n') %>
24
+ },
25
+ async: true
26
+ });
27
+
28
+ 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,42 @@
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', 'sap/ui/test/actions/Press'], function(ObjectPage, Press) {
19
+ 'use strict';
20
+
21
+ const CustomPageDefinitions = {
22
+ actions: {
23
+ iPressSectionIconTabFilterButton: function (section) {
24
+ return this.waitFor({
25
+ id: new RegExp(`.*--fe::FacetSection::${section}-anchor$`),
26
+ actions: new Press()
27
+ });
28
+ }
29
+ },
30
+ assertions: {}
31
+ };
32
+
33
+ return new ObjectPage(
34
+ {
35
+ appId: '<%- appID %>',
36
+ componentId: '<%- componentID %>',<% if (locals.contextPath) { %>
37
+ contextPath: '<%- contextPath %>'<% } else if (locals.entitySet) { %>
38
+ entitySet: '<%- entitySet %>'<% } %>
39
+ },
40
+ CustomPageDefinitions
41
+ );
42
+ });
@@ -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
+ import type Opa5 from "sap/ui/test/Opa5";
19
+ import Press from "sap/ui/test/actions/Press";
20
+
21
+ export const actions = {
22
+ iPressSectionIconTabFilterButton(this: Opa5, section: string) {
23
+ return this.waitFor({
24
+ id: new RegExp(`.*--fe::FacetSection::${section}-anchor$`),
25
+ actions: new Press()
26
+ });
27
+ }
28
+ };
29
+
30
+ export const assertions = {};
31
+
32
+ export default class ObjectPage {
33
+ actions = actions;
34
+ assertions = assertions;
35
+ }
@@ -0,0 +1,56 @@
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')) { -%>
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').forEach(function(page) { -%>
27
+ import type { actions as <%- page.targetKey %>GeneratedCustomActions, assertions as <%- page.targetKey %>GeneratedCustomAssertions } from "../pages/<%- page.targetKey %>.gen";
28
+ <% }); -%>
29
+
30
+ export type Given = Opa5 & BaseArrangements & {
31
+ iTearDownMyApp: () => Given;
32
+ iStartMyApp: (sAppHash?: string, mInUrlParameters?: object) => Given;
33
+ and: Given;
34
+ };
35
+
36
+ export type When = Opa5 & BaseArrangements & {
37
+ <% pages.forEach(function(page) { -%>
38
+ <% if (page.template === 'ListReport') { -%>
39
+ onThe<%- page.targetKey %>Generated: Opa5 & ListReportActions & TemplatePageActions & typeof <%- page.targetKey %>GeneratedCustomActions;
40
+ <% } else if (page.template === 'ObjectPage') { -%>
41
+ onThe<%- page.targetKey %>Generated: Opa5 & ObjectPageActions & TemplatePageActions & typeof <%- page.targetKey %>GeneratedCustomActions;
42
+ <% } -%>
43
+ <% }); -%>
44
+ onTheShell: Shell;
45
+ };
46
+
47
+ export type Then = Opa5 & BaseArrangements & {
48
+ <% pages.forEach(function(page) { -%>
49
+ <% if (page.template === 'ListReport') { -%>
50
+ onThe<%- page.targetKey %>Generated: Opa5 & ListReportAssertions & TemplatePageAssertions & typeof <%- page.targetKey %>GeneratedCustomAssertions;
51
+ <% } else if (page.template === 'ObjectPage') { -%>
52
+ onThe<%- page.targetKey %>Generated: Opa5 & ObjectPageAssertions & TemplatePageAssertions & typeof <%- page.targetKey %>GeneratedCustomAssertions;
53
+ <% } -%>
54
+ <% }); -%>
55
+ onTheShell: Shell;
56
+ };