@sap-ux/ui5-test-writer 1.6.1 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/fiori-elements-opa-writer.js +12 -4
  2. package/dist/types.d.ts +2 -2
  3. package/package.json +4 -4
  4. package/templates/v4/1.148/integration/ListReportJourney.js +129 -0
  5. package/templates/v4/1.148/integration/ListReportJourney.ts +133 -0
  6. package/templates/v4/1.148/integration/ObjectPageJourney.js +163 -0
  7. package/templates/v4/1.148/integration/ObjectPageJourney.ts +181 -0
  8. package/templates/v4/1.148/integration/pages/ObjectPage.js +42 -0
  9. package/templates/v4/1.148/integration/pages/ObjectPage.ts +35 -0
  10. package/templates/v4/1.84/integration/ObjectPageJourney.js +0 -6
  11. package/templates/v4/1.84/integration/ObjectPageJourney.ts +1 -7
  12. package/templates/v4/latest/integration/FPMJourney.js +49 -0
  13. package/templates/v4/latest/integration/FirstJourney.js +35 -0
  14. package/templates/v4/latest/integration/FirstJourney.ts +32 -0
  15. package/templates/v4/latest/integration/opaTests.qunit.html +27 -0
  16. package/templates/v4/latest/integration/opaTests.qunit.js +33 -0
  17. package/templates/v4/latest/integration/pages/FPM.js +30 -0
  18. package/templates/v4/latest/integration/pages/JourneyRunner.js +17 -0
  19. package/templates/v4/latest/integration/pages/JourneyRunner.ts +28 -0
  20. package/templates/v4/latest/integration/pages/ListReport.js +35 -0
  21. package/templates/v4/latest/integration/pages/ListReport.ts +25 -0
  22. package/templates/v4/latest/integration/types/OpaJourneyTypes.d.ts +56 -0
  23. /package/templates/v4/{1.150 → 1.148}/integration/FPMJourney.js +0 -0
  24. /package/templates/v4/{1.150 → 1.148}/integration/FirstJourney.js +0 -0
  25. /package/templates/v4/{1.150 → 1.148}/integration/FirstJourney.ts +0 -0
  26. /package/templates/v4/{1.150 → 1.148}/integration/opaTests.qunit.html +0 -0
  27. /package/templates/v4/{1.150 → 1.148}/integration/opaTests.qunit.js +0 -0
  28. /package/templates/v4/{1.150 → 1.148}/integration/pages/FPM.js +0 -0
  29. /package/templates/v4/{1.150 → 1.148}/integration/pages/JourneyRunner.js +0 -0
  30. /package/templates/v4/{1.150 → 1.148}/integration/pages/JourneyRunner.ts +0 -0
  31. /package/templates/v4/{1.150 → 1.148}/integration/pages/ListReport.js +0 -0
  32. /package/templates/v4/{1.150 → 1.148}/integration/pages/ListReport.ts +0 -0
  33. /package/templates/v4/{1.150 → 1.148}/integration/types/OpaJourneyTypes.d.ts +0 -0
  34. /package/templates/v4/{1.150 → latest}/integration/ListReportJourney.js +0 -0
  35. /package/templates/v4/{1.150 → latest}/integration/ListReportJourney.ts +0 -0
  36. /package/templates/v4/{1.150 → latest}/integration/ObjectPageJourney.js +0 -0
  37. /package/templates/v4/{1.150 → latest}/integration/ObjectPageJourney.ts +0 -0
  38. /package/templates/v4/{1.150 → latest}/integration/pages/ObjectPage.js +0 -0
  39. /package/templates/v4/{1.150 → latest}/integration/pages/ObjectPage.ts +0 -0
@@ -15,12 +15,20 @@ import { getPackageScripts } from '@sap-ux/fiori-generator-shared';
15
15
  import { readHashFromFlpSandbox } from './utils/flpSandboxUtils.js';
16
16
  import { compareUI5VersionGte } from '@sap-ux/ui5-application-writer';
17
17
  const __dirname = dirname(fileURLToPath(import.meta.url));
18
- const UI5_VERSION_1_150 = '1.150.0';
18
+ const V4_TEMPLATE_LATEST = 'latest';
19
19
  const V4_TEMPLATE_1_84 = '1.84';
20
- const V4_TEMPLATE_1_150 = '1.150';
20
+ const V4_TEMPLATE_BUCKETS = [
21
+ { minVersion: '1.149.0', template: V4_TEMPLATE_LATEST },
22
+ { minVersion: '1.148.0', template: '1.148' }
23
+ ];
21
24
  function getTemplateUi5Version(ui5Version) {
22
- if (!ui5Version || compareUI5VersionGte(ui5Version, UI5_VERSION_1_150)) {
23
- return V4_TEMPLATE_1_150;
25
+ if (!ui5Version) {
26
+ return V4_TEMPLATE_LATEST;
27
+ }
28
+ for (const bucket of V4_TEMPLATE_BUCKETS) {
29
+ if (compareUI5VersionGte(ui5Version, bucket.minVersion)) {
30
+ return bucket.template;
31
+ }
24
32
  }
25
33
  return V4_TEMPLATE_1_84;
26
34
  }
package/dist/types.d.ts CHANGED
@@ -19,7 +19,7 @@ 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'). */
22
+ /** Minimum UI5 version of the target app — selects template bucket ('1.84' / '1.148' / 'latest'). */
23
23
  ui5Version?: string;
24
24
  };
25
25
  export declare const SupportedPageTypes: {
@@ -254,7 +254,7 @@ export type WriteContext = {
254
254
  hasPreexistingTests?: boolean;
255
255
  incompatibleTestSetup?: boolean;
256
256
  dotFileExtension: DotFileExtension;
257
- /** Resolved template bucket folder name: '1.84' or '1.150'. */
257
+ /** Resolved template bucket folder name: '1.84', '1.148' or 'latest'. */
258
258
  templateUi5Version: string;
259
259
  /**
260
260
  * When true, ux-specification-derived journeys (ListReport, ObjectPage, FPM) are generated.
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.6.1",
4
+ "version": "1.7.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -27,12 +27,12 @@
27
27
  "mem-fs-editor": "9.4.0",
28
28
  "@sap/ux-specification": "1.144.5",
29
29
  "@sap-ux/edmx-parser": "0.10.0",
30
- "@sap-ux/annotation-converter": "0.10.21",
30
+ "@sap-ux/annotation-converter": "0.10.22",
31
31
  "@sap-ux/ui5-application-writer": "2.1.3",
32
32
  "@sap-ux/logger": "1.0.3",
33
33
  "@sap-ux/fiori-generator-shared": "1.2.6",
34
34
  "@sap-ux/project-access": "2.1.10",
35
- "@sap-ux/preview-middleware": "1.2.0"
35
+ "@sap-ux/preview-middleware": "1.2.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@jest/globals": "30.4.1",
@@ -42,7 +42,7 @@
42
42
  "@types/mem-fs-editor": "7.0.1",
43
43
  "rimraf": "6.1.3",
44
44
  "fs-extra": "11.3.6",
45
- "@sap-ux/vocabularies-types": "0.15.0",
45
+ "@sap-ux/vocabularies-types": "0.16.0",
46
46
  "@sap-ux/jest-file-matchers": "1.0.2"
47
47
  },
48
48
  "engines": {
@@ -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,163 @@
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 > 1) { -%>
86
+ opaTest("Check the number of sections of the Object Page", function (_Given, _When, Then) {
87
+ Then.onThe<%- name%>Generated.iCheckNumberOfSections(<%- bodySections.length %>);
88
+ });
89
+
90
+ <% } -%>
91
+ <% if (bodySections?.length > 0) { -%>
92
+ <% bodySections.forEach(function(section) { -%>
93
+ opaTest("Check the <%- section.id %> section of the Object Page", function (_Given, <% if (bodySections.length > 1) { %>When<% } else { %>_When<% } %>, Then) {
94
+ <% if (bodySections.length > 1) { -%>
95
+ When.onThe<%- name%>Generated.iPressSectionIconTabFilterButton("<%- section.id %>");
96
+ <% } -%>
97
+ Then.onThe<%- name%>Generated.iCheckSection({ section: "<%- section.id %>" });
98
+ <% if (section.actions && section.actions.length > 0) { -%>
99
+ <% section.actions.forEach(function(action) { -%>
100
+ <% if (action.visible) { -%>
101
+ <% if (section.isTable && section.navigationProperty) { -%>
102
+ <% if (action.enabled === 'dynamic') { -%>
103
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
104
+ <% } else { -%>
105
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
106
+ <% } -%>
107
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
108
+ <% } else { -%>
109
+ <% if (action.enabled === 'dynamic') { -%>
110
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
111
+ <% } else { -%>
112
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
113
+ <% } -%>
114
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
115
+ <% } -%>
116
+ <% } -%>
117
+ <% }); -%>
118
+ <% } -%>
119
+ <% if (section.isTable && section.navigationProperty) { -%>
120
+ <% if (section.createButton?.visible) { -%>
121
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckCreate({ visible: true });
122
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressCreate();
123
+ <% } -%>
124
+ <% if (section.deleteButton?.visible) { -%>
125
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckDelete({ visible: true });
126
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressDelete();
127
+ <% } -%>
128
+ <% } -%>
129
+ <% if (section?.subSections?.length > 0) { -%>
130
+ <% section.subSections.forEach(function(subSection) { -%>
131
+ //When.onThe<%- name%>Generated.iGoToSection({ section: "<%- section.id %>", subSection: "<%- subSection.id %>" });
132
+ Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" });
133
+ <% if (subSection.fields && subSection.fields.length > 0) { -%>
134
+ <% subSection.fields.forEach(function(field) { -%>
135
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
136
+ <% }) -%>
137
+ <% } -%>
138
+ <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
139
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(subSection.tableColumns) %>);
140
+ <% } -%>
141
+ <% }) -%>
142
+ <% } else { -%>
143
+ <% if (section.fields && section.fields.length > 0) { -%>
144
+ <% section.fields.forEach(function(field) { -%>
145
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
146
+ <% }) -%>
147
+ <% } -%>
148
+ <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
149
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(section.tableColumns) %>);
150
+ <% } -%>
151
+ <% } -%>
152
+ });
153
+
154
+ <% }) -%>
155
+ <% } -%>
156
+ opaTest("Teardown", function (Given, When, Then) {
157
+ // Cleanup
158
+ Given.iTearDownMyApp();
159
+ });
160
+ }
161
+
162
+ runner.run([journey]);
163
+ });