@sap-ux/ui5-test-writer 1.1.13 → 1.2.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 (29) hide show
  1. package/dist/fiori-elements-opa-writer.js +360 -143
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/translations/ui5-test-writer.i18n.json +10 -0
  5. package/dist/types.d.ts +10 -0
  6. package/dist/utils/fileWritingUtils.d.ts +55 -0
  7. package/dist/utils/fileWritingUtils.js +103 -0
  8. package/dist/utils/journeyRunnerUtils.d.ts +64 -0
  9. package/dist/utils/journeyRunnerUtils.js +251 -0
  10. package/dist/utils/opaJourneyTypesUtils.d.ts +27 -0
  11. package/dist/utils/opaJourneyTypesUtils.js +167 -0
  12. package/dist/utils/opaQUnitUtils.d.ts +6 -92
  13. package/dist/utils/opaQUnitUtils.js +20 -374
  14. package/dist/utils/virtualOpaUtils.d.ts +21 -0
  15. package/dist/utils/virtualOpaUtils.js +51 -0
  16. package/package.json +2 -1
  17. package/templates/v4/integration/FPMJourney.js +3 -3
  18. package/templates/v4/integration/FirstJourney.ts +5 -5
  19. package/templates/v4/integration/ListReportJourney.js +25 -25
  20. package/templates/v4/integration/ListReportJourney.ts +25 -25
  21. package/templates/v4/integration/ObjectPageJourney.js +37 -37
  22. package/templates/v4/integration/ObjectPageJourney.ts +38 -38
  23. package/templates/v4/integration/opaTests.qunit.js +5 -2
  24. package/templates/v4/integration/pages/FPM.js +17 -0
  25. package/templates/v4/integration/pages/JourneyRunner.js +6 -6
  26. package/templates/v4/integration/pages/JourneyRunner.ts +21 -12
  27. package/templates/v4/integration/pages/ListReport.js +17 -0
  28. package/templates/v4/integration/pages/ObjectPage.js +17 -0
  29. package/templates/v4/integration/types/OpaJourneyTypes.d.ts +5 -5
@@ -5,22 +5,31 @@ import ListReport from "sap/fe/test/ListReport";
5
5
  <% if (pages.some((p) => p.template === 'ObjectPage')) { -%>
6
6
  import ObjectPage from "sap/fe/test/ObjectPage";
7
7
  <% } -%>
8
- <%- pages.map((page) => 'import Custom' + page.targetKey + ' from "./' + page.targetKey + '";').join('\n') %>
8
+ <%- pages.map((page) => 'import Custom' + page.targetKey + 'Generated from "./' + page.targetKey + '.gen";').join('\n') %>
9
9
 
10
10
  const runner = new JourneyRunner({
11
11
  launchUrl: sap.ui.require.toUrl("<%- appPath %>") + "/<%- htmlTarget %>",
12
12
  pages: {
13
- <%- pages.map((page) =>
14
- ' onThe' + page.targetKey + ': 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 + '\n' +
22
- ' )'
23
- ).join(',\n') %>
13
+ <%- pages.map((page) => {
14
+ const innerProps = [
15
+ ' appId: "' + page.appID + '"',
16
+ ' componentId: "' + page.componentID + '"'
17
+ ];
18
+ if (page.entitySet) {
19
+ innerProps.push(' entitySet: "' + page.entitySet + '"');
20
+ }
21
+ if (page.contextPath) {
22
+ innerProps.push(' contextPath: "' + page.contextPath + '"');
23
+ }
24
+ return (
25
+ ' onThe' + page.targetKey + 'Generated: new ' + page.template + '(\n' +
26
+ ' {\n' +
27
+ innerProps.join(',\n') + '\n' +
28
+ ' },\n' +
29
+ ' Custom' + page.targetKey + 'Generated\n' +
30
+ ' )'
31
+ );
32
+ }).join(',\n') %>
24
33
  },
25
34
  async: true
26
35
  });
@@ -1,3 +1,20 @@
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
+
1
18
  sap.ui.define(['sap/fe/test/ListReport'], function(ListReport) {
2
19
  'use strict';
3
20
 
@@ -1,3 +1,20 @@
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
+
1
18
  sap.ui.define(['sap/fe/test/ObjectPage', 'sap/ui/test/actions/Press'], function(ObjectPage, Press) {
2
19
  'use strict';
3
20
 
@@ -11,7 +11,7 @@ import type { actions as TemplatePageActions, assertions as TemplatePageAssertio
11
11
  import type Shell from "sap/fe/test/Shell";
12
12
  import type BaseArrangements from "sap/fe/test/BaseArrangements";
13
13
  <% pages.filter((p) => p.template === 'ListReport' || p.template === 'ObjectPage').forEach(function(page) { -%>
14
- import type { actions as <%- page.targetKey %>CustomActions, assertions as <%- page.targetKey %>CustomAssertions } from "../pages/<%- page.targetKey %>";
14
+ import type { actions as <%- page.targetKey %>GeneratedCustomActions, assertions as <%- page.targetKey %>GeneratedCustomAssertions } from "../pages/<%- page.targetKey %>.gen";
15
15
  <% }); -%>
16
16
 
17
17
  export type Given = Opa5 & BaseArrangements & {
@@ -23,9 +23,9 @@ export type Given = Opa5 & BaseArrangements & {
23
23
  export type When = Opa5 & BaseArrangements & {
24
24
  <% pages.forEach(function(page) { -%>
25
25
  <% if (page.template === 'ListReport') { -%>
26
- onThe<%- page.targetKey %>: Opa5 & ListReportActions & TemplatePageActions & typeof <%- page.targetKey %>CustomActions;
26
+ onThe<%- page.targetKey %>Generated: Opa5 & ListReportActions & TemplatePageActions & typeof <%- page.targetKey %>GeneratedCustomActions;
27
27
  <% } else if (page.template === 'ObjectPage') { -%>
28
- onThe<%- page.targetKey %>: Opa5 & ObjectPageActions & TemplatePageActions & typeof <%- page.targetKey %>CustomActions;
28
+ onThe<%- page.targetKey %>Generated: Opa5 & ObjectPageActions & TemplatePageActions & typeof <%- page.targetKey %>GeneratedCustomActions;
29
29
  <% } -%>
30
30
  <% }); -%>
31
31
  onTheShell: Shell;
@@ -34,9 +34,9 @@ export type When = Opa5 & BaseArrangements & {
34
34
  export type Then = Opa5 & BaseArrangements & {
35
35
  <% pages.forEach(function(page) { -%>
36
36
  <% if (page.template === 'ListReport') { -%>
37
- onThe<%- page.targetKey %>: Opa5 & ListReportAssertions & TemplatePageAssertions & typeof <%- page.targetKey %>CustomAssertions;
37
+ onThe<%- page.targetKey %>Generated: Opa5 & ListReportAssertions & TemplatePageAssertions & typeof <%- page.targetKey %>GeneratedCustomAssertions;
38
38
  <% } else if (page.template === 'ObjectPage') { -%>
39
- onThe<%- page.targetKey %>: Opa5 & ObjectPageAssertions & TemplatePageAssertions & typeof <%- page.targetKey %>CustomAssertions;
39
+ onThe<%- page.targetKey %>Generated: Opa5 & ObjectPageAssertions & TemplatePageAssertions & typeof <%- page.targetKey %>GeneratedCustomAssertions;
40
40
  <% } -%>
41
41
  <% }); -%>
42
42
  onTheShell: Shell;