@sap-ux/ui5-test-writer 1.13.4 → 1.15.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.
- package/dist/fiori-elements-opa-writer.js +13 -2
- package/dist/types.d.ts +6 -0
- package/dist/utils/actionUtils.d.ts +9 -1
- package/dist/utils/actionUtils.js +20 -2
- package/package.json +3 -3
- package/templates/v4/1.148/integration/FPMJourney.js +2 -0
- package/templates/v4/1.148/integration/FPMJourney.ts +2 -0
- package/templates/v4/1.148/integration/FirstJourney.js +2 -0
- package/templates/v4/1.148/integration/FirstJourney.ts +2 -0
- package/templates/v4/1.148/integration/ListReportJourney.js +2 -0
- package/templates/v4/1.148/integration/ListReportJourney.ts +2 -0
- package/templates/v4/1.148/integration/ObjectPageJourney.js +2 -0
- package/templates/v4/1.148/integration/ObjectPageJourney.ts +2 -0
- package/templates/v4/1.148/integration/types/OpaJourneyTypes.d.ts +2 -0
- package/templates/v4/1.84/integration/FPMJourney.js +2 -0
- package/templates/v4/1.84/integration/FPMJourney.ts +2 -0
- package/templates/v4/1.84/integration/FirstJourney.js +2 -0
- package/templates/v4/1.84/integration/FirstJourney.ts +2 -0
- package/templates/v4/1.84/integration/ListReportJourney.js +2 -0
- package/templates/v4/1.84/integration/ListReportJourney.ts +2 -0
- package/templates/v4/1.84/integration/ObjectPageJourney.js +2 -0
- package/templates/v4/1.84/integration/ObjectPageJourney.ts +2 -0
- package/templates/v4/1.84/integration/types/OpaJourneyTypes.d.ts +2 -0
- package/templates/v4/latest/integration/FPMJourney.js +2 -0
- package/templates/v4/latest/integration/FPMJourney.ts +2 -0
- package/templates/v4/latest/integration/FirstJourney.js +2 -0
- package/templates/v4/latest/integration/FirstJourney.ts +2 -0
- package/templates/v4/latest/integration/ListReportJourney.js +29 -5
- package/templates/v4/latest/integration/ListReportJourney.ts +33 -6
- package/templates/v4/latest/integration/ObjectPageJourney.js +4 -0
- package/templates/v4/latest/integration/ObjectPageJourney.ts +4 -0
- package/templates/v4/latest/integration/types/OpaJourneyTypes.d.ts +2 -0
|
@@ -5,7 +5,7 @@ import { create as createStorage } from 'mem-fs';
|
|
|
5
5
|
import { create } from 'mem-fs-editor';
|
|
6
6
|
import { SupportedPageTypes, ValidationError, DotFileExtension } from './types.js';
|
|
7
7
|
import { t } from './i18n.js';
|
|
8
|
-
import { FileName, DirName, getWebappPath, updatePackageScript } from '@sap-ux/project-access';
|
|
8
|
+
import { FileName, DirName, getWebappPath, updatePackageScript, getMainService } from '@sap-ux/project-access';
|
|
9
9
|
import { getAppFeatures } from './utils/modelUtils.js';
|
|
10
10
|
import { addPathsToQUnitJs, readHtmlTargetFromQUnitJs } from './utils/opaQUnitUtils.js';
|
|
11
11
|
import { addPagesToJourneyRunner } from './utils/journeyRunnerUtils.js';
|
|
@@ -120,7 +120,8 @@ export async function generateOPAFiles(basePath, options, metadata, fs, log, sta
|
|
|
120
120
|
startLR: LROP.pageLR?.targetKey,
|
|
121
121
|
navigatedOP: LROP.pageOP?.targetKey,
|
|
122
122
|
navigatedOPTabKey,
|
|
123
|
-
hideFilterBar: config.hideFilterBar
|
|
123
|
+
hideFilterBar: config.hideFilterBar,
|
|
124
|
+
serviceUri: getServiceUri(manifest)
|
|
124
125
|
};
|
|
125
126
|
const writeContext = {
|
|
126
127
|
config,
|
|
@@ -396,6 +397,16 @@ function getAppFromManifest(manifest, forcedAppID) {
|
|
|
396
397
|
}
|
|
397
398
|
return { appID, appPath };
|
|
398
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* Resolves the OData service URI used by `iResetMockData({ ServiceUri })` at the start of each journey.
|
|
402
|
+
*
|
|
403
|
+
* @param manifest - the app descriptor of the app
|
|
404
|
+
* @returns the main service's URI, or an empty string if it cannot be resolved
|
|
405
|
+
*/
|
|
406
|
+
function getServiceUri(manifest) {
|
|
407
|
+
const mainService = getMainService(manifest);
|
|
408
|
+
return (mainService && manifest['sap.app']?.dataSources?.[mainService]?.uri) || '';
|
|
409
|
+
}
|
|
399
410
|
/**
|
|
400
411
|
* Create the page configuration object from the app descriptor and the target key.
|
|
401
412
|
*
|
package/dist/types.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ export type JourneyParams = {
|
|
|
53
53
|
navigatedOP: string | undefined;
|
|
54
54
|
navigatedOPTabKey?: string;
|
|
55
55
|
hideFilterBar: boolean;
|
|
56
|
+
/** OData service URI passed to `iResetMockData({ ServiceUri })` at the start of each journey. */
|
|
57
|
+
serviceUri: string;
|
|
56
58
|
};
|
|
57
59
|
export type FEV4ManifestTarget = {
|
|
58
60
|
type?: string;
|
|
@@ -308,6 +310,10 @@ export interface ActionButtonState {
|
|
|
308
310
|
* The writer emits a follow-up marker comment so the developer can fix the assertion.
|
|
309
311
|
*/
|
|
310
312
|
labelUnresolved?: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Names of the action's non-binding parameters.
|
|
315
|
+
*/
|
|
316
|
+
parameterDialogFields?: string[];
|
|
311
317
|
}
|
|
312
318
|
export interface MenuActionState {
|
|
313
319
|
label: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConvertedMetadata } from '@sap-ux/vocabularies-types';
|
|
1
|
+
import type { Action, ConvertedMetadata } from '@sap-ux/vocabularies-types';
|
|
2
2
|
import type { ActionButtonState, ButtonState, ButtonVisibilityResult, MenuActionState } from '../types.js';
|
|
3
3
|
import { type AggregationItem } from './modelUtils.js';
|
|
4
4
|
import type { I18nLabelResolver } from './i18nUtils.js';
|
|
@@ -14,6 +14,14 @@ import type { Logger } from '@sap-ux/logger';
|
|
|
14
14
|
* @returns The set of critical action method names (empty if none)
|
|
15
15
|
*/
|
|
16
16
|
export declare function collectCriticalActionNames(metadata?: ConvertedMetadata): Set<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Collects the names of an action's non-binding parameters. For a bound action the first parameter is the binding
|
|
19
|
+
* parameter and is skipped.
|
|
20
|
+
*
|
|
21
|
+
* @param action The converted action definition
|
|
22
|
+
* @returns The non-binding parameter names, or undefined if there are none
|
|
23
|
+
*/
|
|
24
|
+
export declare function collectActionParameterNames(action?: Action): string[] | undefined;
|
|
17
25
|
type OperationAvailableWithPaths = OperationAvailable & {
|
|
18
26
|
$Path?: string;
|
|
19
27
|
path?: string;
|
|
@@ -22,6 +22,22 @@ export function collectCriticalActionNames(metadata) {
|
|
|
22
22
|
}
|
|
23
23
|
return names;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Collects the names of an action's non-binding parameters. For a bound action the first parameter is the binding
|
|
27
|
+
* parameter and is skipped.
|
|
28
|
+
*
|
|
29
|
+
* @param action The converted action definition
|
|
30
|
+
* @returns The non-binding parameter names, or undefined if there are none
|
|
31
|
+
*/
|
|
32
|
+
export function collectActionParameterNames(action) {
|
|
33
|
+
const parameters = action?.parameters;
|
|
34
|
+
if (!parameters?.length) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const startIndex = action?.isBound === true ? 1 : 0;
|
|
38
|
+
const names = parameters.slice(startIndex).map((parameter) => parameter.name);
|
|
39
|
+
return names.length > 0 ? names : undefined;
|
|
40
|
+
}
|
|
25
41
|
/**
|
|
26
42
|
* Extracts the action method name from a fully qualified action string.
|
|
27
43
|
*
|
|
@@ -138,7 +154,8 @@ export function buildActionButtonState(item, metadata, criticalActions) {
|
|
|
138
154
|
enabled,
|
|
139
155
|
dynamicPath,
|
|
140
156
|
invocationGrouping: item.InvocationGrouping ? extractEnumMemberValue(item.InvocationGrouping) : undefined,
|
|
141
|
-
isCritical: criticalActions?.has(actionMethod) ?? false
|
|
157
|
+
isCritical: criticalActions?.has(actionMethod) ?? false,
|
|
158
|
+
parameterDialogFields: collectActionParameterNames(actionTarget)
|
|
142
159
|
};
|
|
143
160
|
}
|
|
144
161
|
/**
|
|
@@ -176,7 +193,8 @@ export function buildActionStateFromSpecModelKey(aggregationKey, label, converte
|
|
|
176
193
|
visible: true,
|
|
177
194
|
enabled,
|
|
178
195
|
dynamicPath,
|
|
179
|
-
isCritical: criticalActions?.has(actionMethod) ?? false
|
|
196
|
+
isCritical: criticalActions?.has(actionMethod) ?? false,
|
|
197
|
+
parameterDialogFields: collectActionParameterNames(actionDefinition)
|
|
180
198
|
};
|
|
181
199
|
}
|
|
182
200
|
/**
|
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.
|
|
4
|
+
"version": "1.15.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@sap-ux/annotation-converter": "0.10.22",
|
|
31
31
|
"@sap-ux/ui5-application-writer": "2.1.5",
|
|
32
32
|
"@sap-ux/logger": "1.0.3",
|
|
33
|
+
"@sap-ux/preview-middleware": "1.2.18",
|
|
33
34
|
"@sap-ux/fiori-generator-shared": "1.2.18",
|
|
34
|
-
"@sap-ux/project-access": "2.2.1"
|
|
35
|
-
"@sap-ux/preview-middleware": "1.2.18"
|
|
35
|
+
"@sap-ux/project-access": "2.2.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@jest/globals": "30.4.1",
|
|
@@ -25,6 +25,8 @@ sap.ui.define([
|
|
|
25
25
|
QUnit.module("<%- name %> Journey");
|
|
26
26
|
|
|
27
27
|
opaTest("Start application", function (Given, When, Then) {
|
|
28
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
29
|
+
Given.iResetTestData();
|
|
28
30
|
Given.iStartMyApp();
|
|
29
31
|
<%_ startPages.forEach(function(pageName) { %>
|
|
30
32
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -23,6 +23,8 @@ function journey() {
|
|
|
23
23
|
QUnit.module("<%- name %> Journey");
|
|
24
24
|
|
|
25
25
|
opaTest("Start application", function (Given: Given, _When: When, Then: Then) {
|
|
26
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
27
|
+
Given.iResetTestData();
|
|
26
28
|
Given.iStartMyApp();
|
|
27
29
|
<%_ startPages.forEach(function(pageName) { %>
|
|
28
30
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -8,6 +8,8 @@ sap.ui.define([
|
|
|
8
8
|
QUnit.module("First journey");
|
|
9
9
|
|
|
10
10
|
opaTest("Start application", function (Given, When, Then) {
|
|
11
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
12
|
+
Given.iResetTestData();
|
|
11
13
|
Given.iStartMyApp();
|
|
12
14
|
<% if (startLR) { %>Then.onThe<%- startLR %>.iSeeThisPage();<%} %>
|
|
13
15
|
});
|
|
@@ -6,6 +6,8 @@ function journey() {
|
|
|
6
6
|
QUnit.module("First journey");
|
|
7
7
|
|
|
8
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();
|
|
9
11
|
Given.iStartMyApp();
|
|
10
12
|
<% if (startLR) { %>Then.onThe<%- startLR %>Generated.iSeeThisPage();<%} %>
|
|
11
13
|
});
|
|
@@ -28,6 +28,8 @@ sap.ui.define([
|
|
|
28
28
|
const defaultTableId = <%- tableIdentifiers && tableIdentifiers.length > 0 ? '"' + tableIdentifiers[0] + '"' : '""' %>;
|
|
29
29
|
|
|
30
30
|
opaTest("Start application", function (Given, When, Then) {
|
|
31
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
32
|
+
Given.iResetTestData();
|
|
31
33
|
Given.iStartMyApp();
|
|
32
34
|
<%_ startPages.forEach(function(pageName) { %>
|
|
33
35
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -36,6 +36,8 @@ function journey() {
|
|
|
36
36
|
const defaultTableId = <%- tableIdentifiers && tableIdentifiers.length > 0 ? '"' + tableIdentifiers[0] + '"' : '""' %>;
|
|
37
37
|
|
|
38
38
|
opaTest("Start application", function (Given: Given, _When: When, Then: Then) {
|
|
39
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
40
|
+
Given.iResetTestData();
|
|
39
41
|
Given.iStartMyApp();
|
|
40
42
|
<%_ startPages.forEach(function(pageName) { %>
|
|
41
43
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -25,6 +25,8 @@ sap.ui.define([
|
|
|
25
25
|
QUnit.module("<%- name%>ObjectPage journey");
|
|
26
26
|
|
|
27
27
|
opaTest("Navigate to <%- name%>ObjectPage", function (Given, When, Then) {
|
|
28
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
29
|
+
Given.iResetTestData();
|
|
28
30
|
Given.iStartMyApp();
|
|
29
31
|
<% if(navigationParents.parentLRName) { -%>
|
|
30
32
|
<% const parentTableId = navigationParents.parentLRViewKey ? '"' + navigationParents.parentLRViewKey + '"' : ''; -%>
|
|
@@ -45,6 +45,8 @@ function journey() {
|
|
|
45
45
|
QUnit.module("<%- name%>ObjectPage journey");
|
|
46
46
|
|
|
47
47
|
opaTest("Navigate to <%- name%>ObjectPage", function (Given: Given, When: When, Then: Then) {
|
|
48
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
49
|
+
Given.iResetTestData();
|
|
48
50
|
Given.iStartMyApp();
|
|
49
51
|
<% if(navigationParents.parentLRName) { -%>
|
|
50
52
|
<% const parentTableId = navigationParents.parentLRViewKey ? '"' + navigationParents.parentLRViewKey + '"' : '""'; -%>
|
|
@@ -47,6 +47,8 @@ type WithAnd<T> = {
|
|
|
47
47
|
export type Given = Opa5 & BaseArrangements & {
|
|
48
48
|
iTearDownMyApp: () => Given;
|
|
49
49
|
iStartMyApp: (sAppHash?: string, mInUrlParameters?: object) => Given;
|
|
50
|
+
iResetMockData: (oAppInfo?: { AppId?: string; ServiceUri?: string }) => Given;
|
|
51
|
+
iResetTestData: () => Given;
|
|
50
52
|
and: Given;
|
|
51
53
|
};
|
|
52
54
|
|
|
@@ -25,6 +25,8 @@ sap.ui.define([
|
|
|
25
25
|
QUnit.module("<%- name %> Journey");
|
|
26
26
|
|
|
27
27
|
opaTest("Start application", function (Given, When, Then) {
|
|
28
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
29
|
+
Given.iResetTestData();
|
|
28
30
|
Given.iStartMyApp();
|
|
29
31
|
<%_ startPages.forEach(function(pageName) { %>
|
|
30
32
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -23,6 +23,8 @@ function journey() {
|
|
|
23
23
|
QUnit.module("<%- name %> Journey");
|
|
24
24
|
|
|
25
25
|
opaTest("Start application", function (Given: Given, _When: When, Then: Then) {
|
|
26
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
27
|
+
Given.iResetTestData();
|
|
26
28
|
Given.iStartMyApp();
|
|
27
29
|
<%_ startPages.forEach(function(pageName) { %>
|
|
28
30
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -8,6 +8,8 @@ sap.ui.define([
|
|
|
8
8
|
QUnit.module("First journey");
|
|
9
9
|
|
|
10
10
|
opaTest("Start application", function (Given, When, Then) {
|
|
11
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
12
|
+
Given.iResetTestData();
|
|
11
13
|
Given.iStartMyApp();
|
|
12
14
|
<% if (startLR) { %>Then.onThe<%- startLR %>.iSeeThisPage();<%} %>
|
|
13
15
|
});
|
|
@@ -6,6 +6,8 @@ function journey() {
|
|
|
6
6
|
QUnit.module("First journey");
|
|
7
7
|
|
|
8
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();
|
|
9
11
|
Given.iStartMyApp();
|
|
10
12
|
<% if (startLR) { %>Then.onThe<%- startLR %>Generated.iSeeThisPage();<%} %>
|
|
11
13
|
});
|
|
@@ -28,6 +28,8 @@ sap.ui.define([
|
|
|
28
28
|
const defaultTableId = <%- tableIdentifiers && tableIdentifiers.length > 0 ? '"' + tableIdentifiers[0] + '"' : '""' %>;
|
|
29
29
|
|
|
30
30
|
opaTest("Start application", function (Given, When, Then) {
|
|
31
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
32
|
+
Given.iResetTestData();
|
|
31
33
|
Given.iStartMyApp();
|
|
32
34
|
<%_ startPages.forEach(function(pageName) { %>
|
|
33
35
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -35,6 +35,8 @@ function journey() {
|
|
|
35
35
|
const defaultTableId = <%- tableIdentifiers && tableIdentifiers.length > 0 ? '"' + tableIdentifiers[0] + '"' : '""' %>;
|
|
36
36
|
|
|
37
37
|
opaTest("Start application", function (Given: Given, _When: When, Then: Then) {
|
|
38
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
39
|
+
Given.iResetTestData();
|
|
38
40
|
Given.iStartMyApp();
|
|
39
41
|
<%_ startPages.forEach(function(pageName) { %>
|
|
40
42
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -25,6 +25,8 @@ sap.ui.define([
|
|
|
25
25
|
QUnit.module("<%- name%>ObjectPage journey");
|
|
26
26
|
|
|
27
27
|
opaTest("Navigate to <%- name%>ObjectPage", function (Given, When, Then) {
|
|
28
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
29
|
+
Given.iResetTestData();
|
|
28
30
|
Given.iStartMyApp();
|
|
29
31
|
<% if(navigationParents.parentLRName) { -%>
|
|
30
32
|
<% const parentTableId = navigationParents.parentLRViewKey ? '"' + navigationParents.parentLRViewKey + '"' : ''; -%>
|
|
@@ -44,6 +44,8 @@ function journey() {
|
|
|
44
44
|
QUnit.module("<%- name%>ObjectPage journey");
|
|
45
45
|
|
|
46
46
|
opaTest("Navigate to <%- name%>ObjectPage", function (Given: Given, When: When, Then: Then) {
|
|
47
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
48
|
+
Given.iResetTestData();
|
|
47
49
|
Given.iStartMyApp();
|
|
48
50
|
<% if(navigationParents.parentLRName) { -%>
|
|
49
51
|
<% const parentTableId = navigationParents.parentLRViewKey ? '"' + navigationParents.parentLRViewKey + '"' : '""'; -%>
|
|
@@ -47,6 +47,8 @@ type WithAnd<T> = {
|
|
|
47
47
|
export type Given = Opa5 & BaseArrangements & {
|
|
48
48
|
iTearDownMyApp: () => Given;
|
|
49
49
|
iStartMyApp: (sAppHash?: string, mInUrlParameters?: object) => Given;
|
|
50
|
+
iResetMockData: (oAppInfo?: { AppId?: string; ServiceUri?: string }) => Given;
|
|
51
|
+
iResetTestData: () => Given;
|
|
50
52
|
and: Given;
|
|
51
53
|
};
|
|
52
54
|
|
|
@@ -25,6 +25,8 @@ sap.ui.define([
|
|
|
25
25
|
QUnit.module("<%- name %> Journey");
|
|
26
26
|
|
|
27
27
|
opaTest("Start application", function (Given, When, Then) {
|
|
28
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
29
|
+
Given.iResetTestData();
|
|
28
30
|
Given.iStartMyApp();
|
|
29
31
|
<%_ startPages.forEach(function(pageName) { %>
|
|
30
32
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -23,6 +23,8 @@ function journey() {
|
|
|
23
23
|
QUnit.module("<%- name %> Journey");
|
|
24
24
|
|
|
25
25
|
opaTest("Start application", function (Given: Given, _When: When, Then: Then) {
|
|
26
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
27
|
+
Given.iResetTestData();
|
|
26
28
|
Given.iStartMyApp();
|
|
27
29
|
<%_ startPages.forEach(function(pageName) { %>
|
|
28
30
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -8,6 +8,8 @@ sap.ui.define([
|
|
|
8
8
|
QUnit.module("First journey");
|
|
9
9
|
|
|
10
10
|
opaTest("Start application", function (Given, When, Then) {
|
|
11
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
12
|
+
Given.iResetTestData();
|
|
11
13
|
Given.iStartMyApp();
|
|
12
14
|
<% if (startLR) { %>Then.onThe<%- startLR %>.iSeeThisPage();<%} %>
|
|
13
15
|
});
|
|
@@ -6,6 +6,8 @@ function journey() {
|
|
|
6
6
|
QUnit.module("First journey");
|
|
7
7
|
|
|
8
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();
|
|
9
11
|
Given.iStartMyApp();
|
|
10
12
|
<% if (startLR) { %>Then.onThe<%- startLR %>Generated.iSeeThisPage();<%} %>
|
|
11
13
|
});
|
|
@@ -28,6 +28,8 @@ sap.ui.define([
|
|
|
28
28
|
const defaultTableId = <%- tableIdentifiers && tableIdentifiers.length > 0 ? '"' + tableIdentifiers[0] + '"' : '""' %>;
|
|
29
29
|
|
|
30
30
|
opaTest("Start application", function (Given, When, Then) {
|
|
31
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
32
|
+
Given.iResetTestData();
|
|
31
33
|
Given.iStartMyApp();
|
|
32
34
|
<%_ startPages.forEach(function(pageName) { %>
|
|
33
35
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -127,6 +129,11 @@ sap.ui.define([
|
|
|
127
129
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
|
|
128
130
|
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
|
|
129
131
|
<%_ } _%>
|
|
132
|
+
<%_ const toolBarHasDialogAction = (toolBarActions || []).some(function(action) { return action.visible && !action.menuActions && !action.custom && action.enabled !== 'dynamic' && (action.isCritical || (action.parameterDialogFields && action.parameterDialogFields.length > 0)); }); _%>
|
|
133
|
+
<%_ if (!hideFilterBar && toolBarHasDialogAction) { _%>
|
|
134
|
+
// Populate the table so the actions below have a row to select.
|
|
135
|
+
When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
136
|
+
<%_ } _%>
|
|
130
137
|
<%_ toolBarActions.forEach(function(item) { _%>
|
|
131
138
|
<%_ if (item.visible) { _%>
|
|
132
139
|
<%_ if (item.menuActions) { _%>
|
|
@@ -153,26 +160,43 @@ sap.ui.define([
|
|
|
153
160
|
<%_ } else { _%>
|
|
154
161
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
|
|
155
162
|
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
|
|
156
|
-
<%_
|
|
157
|
-
|
|
163
|
+
<%_ const hasParamDialog = item.parameterDialogFields && item.parameterDialogFields.length > 0; _%>
|
|
164
|
+
<%_ if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
|
|
165
|
+
// "<%- item.label %>" is conditionally enabled (Core.OperationAvailable path); it may be disabled for the selected row. Uncomment and select a row that enables it to test the <%- hasParamDialog ? 'action parameter dialog' : 'confirmation dialog' %>.
|
|
158
166
|
<%_ if (!hideFilterBar) { _%>
|
|
159
167
|
// When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
160
168
|
<%_ } _%>
|
|
161
169
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
162
170
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
|
|
171
|
+
<%_ if (hasParamDialog) { _%>
|
|
172
|
+
<%_ item.parameterDialogFields.forEach(function(parameter) { _%>
|
|
173
|
+
// Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
|
|
174
|
+
<%_ }); _%>
|
|
175
|
+
// When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
|
|
176
|
+
<%_ } else { _%>
|
|
163
177
|
// Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
|
|
164
178
|
// When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
|
|
165
|
-
<%_ } else if (item.isCritical) { _%>
|
|
166
|
-
<%_ if (!hideFilterBar) { _%>
|
|
167
|
-
When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
168
179
|
<%_ } _%>
|
|
180
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
181
|
+
<%_ } else if (item.isCritical || hasParamDialog) { _%>
|
|
169
182
|
<%_ if (item.enabled !== true) { _%>
|
|
170
183
|
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
171
184
|
<%_ } _%>
|
|
172
185
|
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
|
|
186
|
+
<%_ if (hasParamDialog) { _%>
|
|
187
|
+
<%_ item.parameterDialogFields.forEach(function(parameter) { _%>
|
|
188
|
+
Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
|
|
189
|
+
<%_ }); _%>
|
|
190
|
+
When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
|
|
191
|
+
<%_ } else { _%>
|
|
173
192
|
Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
|
|
174
193
|
When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
|
|
175
194
|
<%_ } _%>
|
|
195
|
+
<%_ if (item.enabled !== true) { _%>
|
|
196
|
+
// Deselect the row so the following actions start with an empty selection.
|
|
197
|
+
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
198
|
+
<%_ } _%>
|
|
199
|
+
<%_ } _%>
|
|
176
200
|
<%_ } _%>
|
|
177
201
|
<%_ } _%>
|
|
178
202
|
<%_ }); -%>
|
|
@@ -21,6 +21,10 @@ import type { Given, When, Then } from "./types/OpaJourneyTypes.gen";
|
|
|
21
21
|
const usesFilterFieldIdentifier =
|
|
22
22
|
!hideFilterBar && filterBarItems && filterBarItems.some(function(item) { return item.custom; });
|
|
23
23
|
const toolBarHasMenu = (toolBarActions || []).some(function(item) { return item.visible && item.menuActions && !item.splitButton; });
|
|
24
|
+
const toolBarHasDialogAction = (toolBarActions || []).some(function(item) {
|
|
25
|
+
return item.visible && !item.menuActions && !item.custom && item.enabled !== 'dynamic' &&
|
|
26
|
+
(item.isCritical || (item.parameterDialogFields && item.parameterDialogFields.length > 0));
|
|
27
|
+
});
|
|
24
28
|
-%>
|
|
25
29
|
<% if (usesFilterFieldIdentifier) { -%>
|
|
26
30
|
import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
|
|
@@ -36,6 +40,8 @@ function journey() {
|
|
|
36
40
|
const defaultTableId = <%- tableIdentifiers && tableIdentifiers.length > 0 ? '"' + tableIdentifiers[0] + '"' : '""' %>;
|
|
37
41
|
|
|
38
42
|
opaTest("Start application", function (Given: Given, _When: When, Then: Then) {
|
|
43
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
44
|
+
Given.iResetTestData();
|
|
39
45
|
Given.iStartMyApp();
|
|
40
46
|
<%_ startPages.forEach(function(pageName) { %>
|
|
41
47
|
Then.onThe<%- pageName %>Generated.iSeeThisPage();
|
|
@@ -125,7 +131,7 @@ function journey() {
|
|
|
125
131
|
});
|
|
126
132
|
<%_ } else { -%>
|
|
127
133
|
<%_ if ((toolBarActions && toolBarActions.length > 0 ) || (tableColumns && Object.keys(tableColumns).length > 0)) { -%>
|
|
128
|
-
opaTest("Check table columns and actions", function (_Given: Given, <% if (toolBarHasMenu ||
|
|
134
|
+
opaTest("Check table columns and actions", function (_Given: Given, <% if (toolBarHasMenu || toolBarHasDialogAction) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
|
|
129
135
|
<%_ if (toolBarActions && toolBarActions.length > 0) { -%>
|
|
130
136
|
<%_ if (createButton.visible && !isALP) { _%>
|
|
131
137
|
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
|
|
@@ -135,6 +141,10 @@ function journey() {
|
|
|
135
141
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
|
|
136
142
|
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
|
|
137
143
|
<%_ } _%>
|
|
144
|
+
<%_ if (!hideFilterBar && toolBarHasDialogAction) { _%>
|
|
145
|
+
// Populate the table so the actions below have a row to select.
|
|
146
|
+
When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
147
|
+
<%_ } _%>
|
|
138
148
|
<%_ toolBarActions.forEach(function(item) { _%>
|
|
139
149
|
<%_ if (item.visible) { _%>
|
|
140
150
|
<%_ if (item.menuActions) { _%>
|
|
@@ -161,26 +171,43 @@ function journey() {
|
|
|
161
171
|
<%_ } else { _%>
|
|
162
172
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
|
|
163
173
|
Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
|
|
164
|
-
<%_
|
|
165
|
-
|
|
174
|
+
<%_ const hasParamDialog = item.parameterDialogFields && item.parameterDialogFields.length > 0; _%>
|
|
175
|
+
<%_ if ((item.isCritical || hasParamDialog) && item.enabled === 'dynamic') { _%>
|
|
176
|
+
// "<%- item.label %>" is conditionally enabled (Core.OperationAvailable path); it may be disabled for the selected row. Uncomment and select a row that enables it to test the <%- hasParamDialog ? 'action parameter dialog' : 'confirmation dialog' %>.
|
|
166
177
|
<%_ if (!hideFilterBar) { _%>
|
|
167
178
|
// When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
168
179
|
<%_ } _%>
|
|
169
180
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
170
181
|
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
|
|
182
|
+
<%_ if (hasParamDialog) { _%>
|
|
183
|
+
<%_ item.parameterDialogFields.forEach(function(parameter) { _%>
|
|
184
|
+
// Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
|
|
185
|
+
<%_ }); _%>
|
|
186
|
+
// When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
|
|
187
|
+
<%_ } else { _%>
|
|
171
188
|
// Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
|
|
172
189
|
// When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
|
|
173
|
-
<%_ } else if (item.isCritical) { _%>
|
|
174
|
-
<%_ if (!hideFilterBar) { _%>
|
|
175
|
-
When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
|
|
176
190
|
<%_ } _%>
|
|
191
|
+
// When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
192
|
+
<%_ } else if (item.isCritical || hasParamDialog) { _%>
|
|
177
193
|
<%_ if (item.enabled !== true) { _%>
|
|
178
194
|
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
179
195
|
<%_ } _%>
|
|
180
196
|
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iExecuteAction("<%- item.label %>");
|
|
197
|
+
<%_ if (hasParamDialog) { _%>
|
|
198
|
+
<%_ item.parameterDialogFields.forEach(function(parameter) { _%>
|
|
199
|
+
Then.onThe<%- startLR%>Generated.onActionDialog().iCheckActionParameterDialogField({ property: "<%- parameter %>" }, undefined, { visible: true });
|
|
200
|
+
<%_ }); _%>
|
|
201
|
+
When.onThe<%- startLR%>Generated.onActionDialog().iCancel();
|
|
202
|
+
<%_ } else { _%>
|
|
181
203
|
Then.onThe<%- startLR%>Generated.onMessageDialog().iCheckState();
|
|
182
204
|
When.onThe<%- startLR%>Generated.onMessageDialog().iCancel();
|
|
183
205
|
<%_ } _%>
|
|
206
|
+
<%_ if (item.enabled !== true) { _%>
|
|
207
|
+
// Deselect the row so the following actions start with an empty selection.
|
|
208
|
+
When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
|
|
209
|
+
<%_ } _%>
|
|
210
|
+
<%_ } _%>
|
|
184
211
|
<%_ } _%>
|
|
185
212
|
<%_ } _%>
|
|
186
213
|
<%_ }); -%>
|
|
@@ -25,6 +25,8 @@ sap.ui.define([
|
|
|
25
25
|
QUnit.module("<%- name%>ObjectPage journey");
|
|
26
26
|
|
|
27
27
|
opaTest("Navigate to <%- name%>ObjectPage", function (Given, When, Then) {
|
|
28
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
29
|
+
Given.iResetTestData();
|
|
28
30
|
Given.iStartMyApp();
|
|
29
31
|
<% if(navigationParents.parentLRName) { -%>
|
|
30
32
|
<% const parentTableId = navigationParents.parentLRViewKey ? '"' + navigationParents.parentLRViewKey + '"' : ''; -%>
|
|
@@ -183,6 +185,8 @@ sap.ui.define([
|
|
|
183
185
|
When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
|
|
184
186
|
Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
|
|
185
187
|
When.onThe<%- name%>Generated.onMessageDialog().iCancel();
|
|
188
|
+
// Deselect the row so the following actions start with an empty selection.
|
|
189
|
+
When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
|
|
186
190
|
<% } else if (!action.custom && !action.menuActions) { -%>
|
|
187
191
|
// When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
|
|
188
192
|
<% } -%>
|
|
@@ -53,6 +53,8 @@ function journey() {
|
|
|
53
53
|
QUnit.module("<%- name%>ObjectPage journey");
|
|
54
54
|
|
|
55
55
|
opaTest("Navigate to <%- name%>ObjectPage", function (Given: Given, When: When, Then: Then) {
|
|
56
|
+
Given.iResetMockData({ ServiceUri: <%- JSON.stringify(serviceUri) %> });
|
|
57
|
+
Given.iResetTestData();
|
|
56
58
|
Given.iStartMyApp();
|
|
57
59
|
<% if(navigationParents.parentLRName) { -%>
|
|
58
60
|
<% const parentTableId = navigationParents.parentLRViewKey ? '"' + navigationParents.parentLRViewKey + '"' : '""'; -%>
|
|
@@ -211,6 +213,8 @@ function journey() {
|
|
|
211
213
|
When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iExecuteAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
|
|
212
214
|
Then.onThe<%- name%>Generated.onMessageDialog().iCheckState();
|
|
213
215
|
When.onThe<%- name%>Generated.onMessageDialog().iCancel();
|
|
216
|
+
// Deselect the row so the following actions start with an empty selection.
|
|
217
|
+
When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iSelectRows(0);
|
|
214
218
|
<% } else if (!action.custom && !action.menuActions) { -%>
|
|
215
219
|
// When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
|
|
216
220
|
<% } -%>
|
|
@@ -47,6 +47,8 @@ type WithAnd<T> = {
|
|
|
47
47
|
export type Given = Opa5 & BaseArrangements & {
|
|
48
48
|
iTearDownMyApp: () => Given;
|
|
49
49
|
iStartMyApp: (sAppHash?: string, mInUrlParameters?: object) => Given;
|
|
50
|
+
iResetMockData: (oAppInfo?: { AppId?: string; ServiceUri?: string }) => Given;
|
|
51
|
+
iResetTestData: () => Given;
|
|
50
52
|
and: Given;
|
|
51
53
|
};
|
|
52
54
|
|