@sap-ux/ui5-test-writer 1.19.15 → 1.19.18
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.
- package/dist/fiori-elements-opa-writer.d.ts +2 -2
- package/dist/fiori-elements-opa-writer.js +6 -4
- package/dist/types.d.ts +2 -2
- package/package.json +4 -4
- package/templates/v4/1.120/integration/FPMJourney.js +43 -0
- package/templates/v4/1.120/integration/FPMJourney.ts +40 -0
- package/templates/v4/1.120/integration/FirstJourney.js +37 -0
- package/templates/v4/1.120/integration/FirstJourney.ts +34 -0
- package/templates/v4/1.120/integration/ListReportJourney.js +138 -0
- package/templates/v4/1.120/integration/ListReportJourney.ts +142 -0
- package/templates/v4/1.120/integration/ObjectPageJourney.js +171 -0
- package/templates/v4/1.120/integration/ObjectPageJourney.ts +189 -0
- package/templates/v4/1.120/integration/opaTests.qunit.html +28 -0
- package/templates/v4/1.120/integration/opaTests.qunit.js +33 -0
- package/templates/v4/1.120/integration/pages/FPM.js +30 -0
- package/templates/v4/1.120/integration/pages/FPM.ts +25 -0
- package/templates/v4/1.120/integration/pages/JourneyRunner.js +18 -0
- package/templates/v4/1.120/integration/pages/JourneyRunner.ts +37 -0
- package/templates/v4/1.120/integration/pages/ListReport.js +35 -0
- package/templates/v4/1.120/integration/pages/ListReport.ts +25 -0
- package/templates/v4/1.120/integration/pages/ObjectPage.js +42 -0
- package/templates/v4/1.120/integration/pages/ObjectPage.ts +35 -0
- package/templates/v4/1.120/integration/types/OpaJourneyTypes.d.ts +79 -0
- package/templates/v4/1.148/integration/types/OpaJourneyTypes.d.ts +7 -2
- package/templates/v4/1.152/integration/FirstJourney.ts +2 -2
- package/templates/v4/1.152/integration/ListReportJourney.ts +5 -8
- package/templates/v4/1.152/integration/ObjectPageJourney.ts +42 -47
- package/templates/v4/1.152/integration/pages/JourneyRunner.ts +1 -2
- package/templates/v4/1.152/integration/types/OpaJourneyTypes.d.ts +7 -2
- package/templates/v4/1.84/integration/ListReportJourney.js +2 -18
- package/templates/v4/1.84/integration/ListReportJourney.ts +0 -18
- package/templates/v4/1.84/integration/ObjectPageJourney.js +14 -14
- package/templates/v4/1.84/integration/ObjectPageJourney.ts +13 -13
- package/templates/v4/1.84/integration/types/OpaJourneyTypes.d.ts +7 -2
- package/templates/v4/latest/integration/FirstJourney.ts +2 -2
- package/templates/v4/latest/integration/ListReportJourney.ts +5 -8
- package/templates/v4/latest/integration/ObjectPageJourney.ts +42 -47
- package/templates/v4/latest/integration/pages/JourneyRunner.ts +1 -2
- package/templates/v4/latest/integration/types/OpaJourneyTypes.d.ts +7 -2
|
@@ -6,10 +6,10 @@ import type { Logger } from '@sap-ux/logger';
|
|
|
6
6
|
* Removes action tests the target template bucket cannot render, so journeys omit them instead of
|
|
7
7
|
* emitting assertions that fail on older runtimes:
|
|
8
8
|
* - custom (manifest-declared) actions: rendered only by `1.152` and `latest` buckets.
|
|
9
|
-
* - menu (drop-down) actions: rendered by `1.148`, `1.152`, and `latest`; the `1.84`
|
|
9
|
+
* - menu (drop-down) actions: rendered by `1.148`, `1.152`, and `latest`; the `1.84` and `1.120` buckets have no menu template.
|
|
10
10
|
*
|
|
11
11
|
* @param appFeatures - the extracted app feature data (mutated in place)
|
|
12
|
-
* @param templateUi5Version - the selected template bucket ('1.84' / '1.148' / '1.152' / 'latest')
|
|
12
|
+
* @param templateUi5Version - the selected template bucket ('1.84' / '1.120' / '1.148' / '1.152' / 'latest')
|
|
13
13
|
*/
|
|
14
14
|
export declare function removeUnsupportedActions(appFeatures: AppFeatures, templateUi5Version: string): void;
|
|
15
15
|
/**
|
|
@@ -19,10 +19,12 @@ import { compareUI5VersionGte } from '@sap-ux/ui5-application-writer';
|
|
|
19
19
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
20
20
|
const V4_TEMPLATE_LATEST = 'latest';
|
|
21
21
|
const V4_TEMPLATE_1_84 = '1.84';
|
|
22
|
+
const V4_TEMPLATE_1_120 = '1.120';
|
|
22
23
|
const V4_TEMPLATE_BUCKETS = [
|
|
23
24
|
{ minVersion: '1.153.0', template: V4_TEMPLATE_LATEST },
|
|
24
25
|
{ minVersion: '1.152.0', template: '1.152' },
|
|
25
|
-
{ minVersion: '1.148.0', template: '1.148' }
|
|
26
|
+
{ minVersion: '1.148.0', template: '1.148' },
|
|
27
|
+
{ minVersion: '1.120.0', template: V4_TEMPLATE_1_120 }
|
|
26
28
|
];
|
|
27
29
|
function getTemplateUi5Version(ui5Version) {
|
|
28
30
|
if (!ui5Version) {
|
|
@@ -39,14 +41,14 @@ function getTemplateUi5Version(ui5Version) {
|
|
|
39
41
|
* Removes action tests the target template bucket cannot render, so journeys omit them instead of
|
|
40
42
|
* emitting assertions that fail on older runtimes:
|
|
41
43
|
* - custom (manifest-declared) actions: rendered only by `1.152` and `latest` buckets.
|
|
42
|
-
* - menu (drop-down) actions: rendered by `1.148`, `1.152`, and `latest`; the `1.84`
|
|
44
|
+
* - menu (drop-down) actions: rendered by `1.148`, `1.152`, and `latest`; the `1.84` and `1.120` buckets have no menu template.
|
|
43
45
|
*
|
|
44
46
|
* @param appFeatures - the extracted app feature data (mutated in place)
|
|
45
|
-
* @param templateUi5Version - the selected template bucket ('1.84' / '1.148' / '1.152' / 'latest')
|
|
47
|
+
* @param templateUi5Version - the selected template bucket ('1.84' / '1.120' / '1.148' / '1.152' / 'latest')
|
|
46
48
|
*/
|
|
47
49
|
export function removeUnsupportedActions(appFeatures, templateUi5Version) {
|
|
48
50
|
const stripCustom = templateUi5Version !== V4_TEMPLATE_LATEST && templateUi5Version !== '1.152';
|
|
49
|
-
const stripMenu = templateUi5Version === V4_TEMPLATE_1_84;
|
|
51
|
+
const stripMenu = templateUi5Version === V4_TEMPLATE_1_84 || templateUi5Version === V4_TEMPLATE_1_120;
|
|
50
52
|
if (!stripCustom && !stripMenu) {
|
|
51
53
|
return;
|
|
52
54
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type OPAGenerationOptions = {
|
|
|
23
23
|
useVirtualPreviewEndpoints?: boolean;
|
|
24
24
|
/** If true, generate TypeScript files instead of JavaScript. */
|
|
25
25
|
enableTypeScript?: boolean;
|
|
26
|
-
/** Minimum UI5 version of the target app — selects template bucket ('1.84' / '1.148' / 'latest'). */
|
|
26
|
+
/** Minimum UI5 version of the target app — selects template bucket ('1.84' / '1.120' / '1.148' / '1.152' / 'latest'). */
|
|
27
27
|
ui5Version?: string;
|
|
28
28
|
};
|
|
29
29
|
export declare const SupportedPageTypes: {
|
|
@@ -388,7 +388,7 @@ export type WriteContext = {
|
|
|
388
388
|
hasPreexistingTests?: boolean;
|
|
389
389
|
incompatibleTestSetup?: boolean;
|
|
390
390
|
dotFileExtension: DotFileExtension;
|
|
391
|
-
/** Resolved template bucket folder name: '1.84', '1.148' or 'latest'. */
|
|
391
|
+
/** Resolved template bucket folder name: '1.84', '1.120', '1.148', '1.152' or 'latest'. */
|
|
392
392
|
templateUi5Version: string;
|
|
393
393
|
/**
|
|
394
394
|
* 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.19.
|
|
4
|
+
"version": "1.19.18",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"@sap/ux-specification": "1.144.5",
|
|
29
29
|
"@sap-ux/edmx-parser": "0.10.0",
|
|
30
30
|
"@sap-ux/annotation-converter": "0.10.23",
|
|
31
|
+
"@sap-ux/ui5-application-writer": "2.1.7",
|
|
32
|
+
"@sap-ux/fiori-generator-shared": "1.4.0",
|
|
31
33
|
"@sap-ux/logger": "1.0.3",
|
|
32
|
-
"@sap-ux/preview-middleware": "1.2.41",
|
|
33
34
|
"@sap-ux/project-access": "2.3.4",
|
|
34
|
-
"@sap-ux/
|
|
35
|
-
"@sap-ux/fiori-generator-shared": "1.4.0"
|
|
35
|
+
"@sap-ux/preview-middleware": "1.2.43"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@jest/globals": "30.5.2",
|
|
@@ -0,0 +1,43 @@
|
|
|
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 %> Journey");
|
|
26
|
+
|
|
27
|
+
opaTest("Start application", function (Given, When, Then) {
|
|
28
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
29
|
+
Given.iResetTestData();
|
|
30
|
+
Given.iStartMyApp();
|
|
31
|
+
<%_ startPages.forEach(function(pageName) { %>
|
|
32
|
+
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
33
|
+
<%_ }); -%>
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
opaTest("Teardown", function (Given, When, Then) {
|
|
37
|
+
// Cleanup
|
|
38
|
+
Given.iTearDownMyApp();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
runner.run([journey]);
|
|
43
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
import runner from "./pages/JourneyRunner";
|
|
21
|
+
|
|
22
|
+
function journey() {
|
|
23
|
+
QUnit.module("<%- name %> Journey");
|
|
24
|
+
|
|
25
|
+
opaTest("Start application", function (Given: Given, _When: When, Then: Then) {
|
|
26
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
27
|
+
Given.iResetTestData();
|
|
28
|
+
Given.iStartMyApp();
|
|
29
|
+
<%_ startPages.forEach(function(pageName) { %>
|
|
30
|
+
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
31
|
+
<%_ }); -%>
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
opaTest("Teardown", function (Given: Given) {
|
|
35
|
+
// Cleanup
|
|
36
|
+
Given.iTearDownMyApp();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
runner.run([journey]);
|
|
@@ -0,0 +1,37 @@
|
|
|
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.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
12
|
+
Given.iResetTestData();
|
|
13
|
+
Given.iStartMyApp();
|
|
14
|
+
<% if (startLR) { %>Then.onThe<%- startLR %>Generated.iSeeThisPage();<%} %>
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
<% if (startLR) { %>
|
|
18
|
+
opaTest("Navigate to ObjectPage", function (Given, When, Then) {
|
|
19
|
+
// Note: this test will fail if the ListReport page doesn't show any data
|
|
20
|
+
<% if (!hideFilterBar) { %>
|
|
21
|
+
When.onThe<%- startLR %>Generated.onFilterBar().iExecuteSearch();
|
|
22
|
+
<%} %>
|
|
23
|
+
Then.onThe<%- startLR %>Generated.onTable().iCheckRows();
|
|
24
|
+
<% if (navigatedOP) { %>
|
|
25
|
+
When.onThe<%- startLR %>Generated.onTable().iPressRow(0);
|
|
26
|
+
Then.onThe<%- navigatedOP %>Generated.iSeeThisPage();
|
|
27
|
+
<%} %>
|
|
28
|
+
});
|
|
29
|
+
<%} %>
|
|
30
|
+
opaTest("Teardown", function (Given, When, Then) {
|
|
31
|
+
// Cleanup
|
|
32
|
+
Given.iTearDownMyApp();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
runner.run([journey]);
|
|
37
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
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.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
10
|
+
Given.iResetTestData();
|
|
11
|
+
Given.iStartMyApp();
|
|
12
|
+
<% if (startLR) { %>Then.onThe<%- startLR %>Generated.iSeeThisPage();<%} %>
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
<% if (startLR) { %>
|
|
16
|
+
opaTest("Navigate to ObjectPage", function (_Given: Given, When: When, Then: Then) {
|
|
17
|
+
// Note: this test will fail if the ListReport page doesn't show any data
|
|
18
|
+
<% if (!hideFilterBar) { %>
|
|
19
|
+
When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
20
|
+
<%} %>
|
|
21
|
+
Then.onThe<%- startLR%>Generated.onTable("").iCheckRows();
|
|
22
|
+
<% if (navigatedOP) { %>
|
|
23
|
+
When.onThe<%- startLR%>Generated.onTable("").iPressRow(0);
|
|
24
|
+
Then.onThe<%- navigatedOP%>Generated.iSeeThisPage();
|
|
25
|
+
<%} %>
|
|
26
|
+
});
|
|
27
|
+
<%} %>
|
|
28
|
+
opaTest("Teardown", function (Given: Given) {
|
|
29
|
+
// Cleanup
|
|
30
|
+
Given.iTearDownMyApp();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
runner.run([journey]);
|
|
@@ -0,0 +1,138 @@
|
|
|
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.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
31
|
+
Given.iResetTestData();
|
|
32
|
+
Given.iStartMyApp();
|
|
33
|
+
<%_ startPages.forEach(function(pageName) { %>
|
|
34
|
+
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
35
|
+
<%_ }); -%>
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
<%_ if (!hideFilterBar && filterBarItems && filterBarItems.length > 0) { -%>
|
|
39
|
+
opaTest("Check filter bar", function (Given, When, Then) {
|
|
40
|
+
<%_ filterBarItems.forEach(function(item) { _%>
|
|
41
|
+
<%_ if (item.custom) { _%>
|
|
42
|
+
Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- item.description %>");
|
|
43
|
+
<%_ } else { _%>
|
|
44
|
+
Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- item.property %>" });
|
|
45
|
+
<%_ } _%>
|
|
46
|
+
<%_ }); -%>
|
|
47
|
+
});
|
|
48
|
+
<%_ } -%>
|
|
49
|
+
<%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
|
|
50
|
+
opaTest("Add semantic key properties to filter bar", function (Given, When, Then) {
|
|
51
|
+
When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation()
|
|
52
|
+
<%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
|
|
53
|
+
.and.iAddAdaptationFilterField({ property: "<%- property %>" })
|
|
54
|
+
<%_ }); -%>
|
|
55
|
+
.and.iConfirmFilterAdaptation();
|
|
56
|
+
<%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
|
|
57
|
+
Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
|
|
58
|
+
<%_ }); -%>
|
|
59
|
+
<%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
|
|
60
|
+
// When.onThe<%- startLR%>Generated.onFilterBar().iChangeFilterField({ property: "<%- property %>" }, "<value to filter>", false);
|
|
61
|
+
<%_ }); -%>
|
|
62
|
+
// When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
63
|
+
// Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
|
|
64
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
65
|
+
// Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<Action Name>", { enabled: true });
|
|
66
|
+
});
|
|
67
|
+
<%_ } -%>
|
|
68
|
+
|
|
69
|
+
// 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.
|
|
70
|
+
// opaTest("Perform a global search and check the result", function (Given, When, Then) {
|
|
71
|
+
// When.onThe<%- startLR%>Generated.onFilterBar().iChangeSearchField("Search Term");
|
|
72
|
+
// When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
73
|
+
// Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
|
|
74
|
+
// When.onThe<%- startLR%>Generated.onFilterBar().iChangeSearchField(undefined);
|
|
75
|
+
// Then.onThe<%- startLR%>Generated.onFilterBar().iCheckSearchField(undefined);
|
|
76
|
+
// });
|
|
77
|
+
|
|
78
|
+
<%_ if (createButton.visible && !isALP) { -%>
|
|
79
|
+
opaTest("Check the create button", function (Given, When, Then) {
|
|
80
|
+
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
|
|
81
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressCreate();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
<%_ } -%>
|
|
85
|
+
<%_ if (deleteButton.visible) { -%>
|
|
86
|
+
opaTest("Check the delete button", function (Given, When, Then) {
|
|
87
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
|
|
88
|
+
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
<%_ } -%>
|
|
92
|
+
<%_ (toolBarActions || []).forEach(function(item) { -%>
|
|
93
|
+
<%_ if (item.visible) { -%>
|
|
94
|
+
opaTest(<%- JSON.stringify("Check the " + item.label + " action") %>, function (Given, When, Then) {
|
|
95
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
|
|
96
|
+
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
<%_ } -%>
|
|
100
|
+
<%_ }); -%>
|
|
101
|
+
<%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
|
|
102
|
+
opaTest("Check table columns", function (Given, When, Then) {
|
|
103
|
+
Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
<%_ } -%>
|
|
107
|
+
<%_ if (startLR) { -%>
|
|
108
|
+
opaTest("Navigate to ObjectPage", function (Given, When, Then) {
|
|
109
|
+
// Note: this test will fail if the ListReport page doesn't show any data
|
|
110
|
+
<%_ if (!hideFilterBar) { -%>
|
|
111
|
+
When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
112
|
+
<%_ } -%>
|
|
113
|
+
<%_ if (tableIdentifiers && tableIdentifiers.length > 0) { -%>
|
|
114
|
+
<%_ tableIdentifiers.forEach(function(tabId) { _%>
|
|
115
|
+
When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tabId %>" });
|
|
116
|
+
Then.onThe<%- startLR%>Generated.onTable("<%- tabId %>").iCheckRows();
|
|
117
|
+
<%_ }); -%>
|
|
118
|
+
<%_ } else { -%>
|
|
119
|
+
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
|
|
120
|
+
<%_ } -%>
|
|
121
|
+
<%_ if (navigatedOP) { -%>
|
|
122
|
+
<%_ if (tableIdentifiers && tableIdentifiers.length > 0) { _%>
|
|
123
|
+
When.onThe<%- startLR%>Generated.iGoToView({ key: defaultTableId });
|
|
124
|
+
<%_ } _%>
|
|
125
|
+
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressRow(0);
|
|
126
|
+
Then.onThe<%- navigatedOP%>Generated.iSeeThisPage();
|
|
127
|
+
<%_ } -%>
|
|
128
|
+
});
|
|
129
|
+
<%_ } -%>
|
|
130
|
+
|
|
131
|
+
opaTest("Teardown", function (Given, When, Then) {
|
|
132
|
+
// Cleanup
|
|
133
|
+
Given.iTearDownMyApp();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
runner.run([journey]);
|
|
138
|
+
});
|
|
@@ -0,0 +1,142 @@
|
|
|
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.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
36
|
+
Given.iResetTestData();
|
|
37
|
+
Given.iStartMyApp();
|
|
38
|
+
<%_ startPages.forEach(function(pageName) { %>
|
|
39
|
+
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
40
|
+
<%_ }); -%>
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
<%_ if (!hideFilterBar && filterBarItems && filterBarItems.length > 0) { -%>
|
|
44
|
+
opaTest("Check filter bar", function (_Given: Given, _When: When, Then: Then) {
|
|
45
|
+
<%_ filterBarItems.forEach(function(item) { _%>
|
|
46
|
+
<%_ if (item.custom) { _%>
|
|
47
|
+
Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- item.description %>" as unknown as FilterFieldIdentifier);
|
|
48
|
+
<%_ } else { _%>
|
|
49
|
+
Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- item.property %>" });
|
|
50
|
+
<%_ } _%>
|
|
51
|
+
<%_ }); -%>
|
|
52
|
+
});
|
|
53
|
+
<%_ } -%>
|
|
54
|
+
<%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
|
|
55
|
+
opaTest("Add semantic key properties to filter bar", function (_Given: Given, When: When, Then: Then) {
|
|
56
|
+
When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation()
|
|
57
|
+
<%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
|
|
58
|
+
.and.iAddAdaptationFilterField({ property: "<%- property %>" })
|
|
59
|
+
<%_ }); -%>
|
|
60
|
+
.and.iConfirmFilterAdaptation();
|
|
61
|
+
<%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
|
|
62
|
+
Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
|
|
63
|
+
<%_ }); -%>
|
|
64
|
+
<%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
|
|
65
|
+
// When.onThe<%- startLR%>Generated.onFilterBar().iChangeFilterField({ property: "<%- property %>" }, "<value to filter>", false);
|
|
66
|
+
<%_ }); -%>
|
|
67
|
+
// When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
68
|
+
// Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
|
|
69
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
70
|
+
// Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<Action Name>", { enabled: true });
|
|
71
|
+
});
|
|
72
|
+
<%_ } -%>
|
|
73
|
+
|
|
74
|
+
// 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.
|
|
75
|
+
// opaTest("Perform a global search and check the result", function (Given: Given, When: When, Then: Then) {
|
|
76
|
+
// When.onThe<%- startLR%>Generated.onFilterBar().iChangeSearchField("Search Term");
|
|
77
|
+
// When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
78
|
+
// Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
|
|
79
|
+
// When.onThe<%- startLR%>Generated.onFilterBar().iChangeSearchField(undefined);
|
|
80
|
+
// Then.onThe<%- startLR%>Generated.onFilterBar().iCheckSearchField(undefined);
|
|
81
|
+
// });
|
|
82
|
+
|
|
83
|
+
<%_ if (createButton.visible && !isALP) { -%>
|
|
84
|
+
opaTest("Check the create button", function (_Given: Given, _When: When, Then: Then) {
|
|
85
|
+
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
|
|
86
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressCreate();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
<%_ } -%>
|
|
90
|
+
<%_ if (deleteButton.visible) { -%>
|
|
91
|
+
opaTest("Check the delete button", function (_Given: Given, _When: When, Then: Then) {
|
|
92
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
|
|
93
|
+
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
<%_ } -%>
|
|
97
|
+
<%_ (toolBarActions || []).forEach(function(item) { -%>
|
|
98
|
+
<%_ if (item.visible) { -%>
|
|
99
|
+
opaTest(<%- JSON.stringify("Check the " + item.label + " action") %>, function (_Given: Given, _When: When, Then: Then) {
|
|
100
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
|
|
101
|
+
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
<%_ } -%>
|
|
105
|
+
<%_ }); -%>
|
|
106
|
+
<%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
|
|
107
|
+
opaTest("Check table columns", function (_Given: Given, _When: When, Then: Then) {
|
|
108
|
+
Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
<%_ } -%>
|
|
112
|
+
<%_ if (startLR) { -%>
|
|
113
|
+
opaTest("Navigate to ObjectPage", function (_Given: Given, When: When, Then: Then) {
|
|
114
|
+
// Note: this test will fail if the ListReport page doesn't show any data
|
|
115
|
+
<%_ if (!hideFilterBar) { -%>
|
|
116
|
+
When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
117
|
+
<%_ } -%>
|
|
118
|
+
<%_ if (tableIdentifiers && tableIdentifiers.length > 0) { -%>
|
|
119
|
+
<%_ tableIdentifiers.forEach(function(tabId) { _%>
|
|
120
|
+
When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tabId %>" });
|
|
121
|
+
Then.onThe<%- startLR%>Generated.onTable("<%- tabId %>").iCheckRows();
|
|
122
|
+
<%_ }); -%>
|
|
123
|
+
<%_ } else { -%>
|
|
124
|
+
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
|
|
125
|
+
<%_ } -%>
|
|
126
|
+
<%_ if (navigatedOP) { -%>
|
|
127
|
+
<%_ if (tableIdentifiers && tableIdentifiers.length > 0) { _%>
|
|
128
|
+
When.onThe<%- startLR%>Generated.iGoToView({ key: defaultTableId });
|
|
129
|
+
<%_ } _%>
|
|
130
|
+
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressRow(0);
|
|
131
|
+
Then.onThe<%- navigatedOP%>Generated.iSeeThisPage();
|
|
132
|
+
<%_ } -%>
|
|
133
|
+
});
|
|
134
|
+
<%_ } -%>
|
|
135
|
+
|
|
136
|
+
opaTest("Teardown", function (Given: Given) {
|
|
137
|
+
// Cleanup
|
|
138
|
+
Given.iTearDownMyApp();
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
runner.run([journey]);
|