@sapui5/sap.fe.test 1.102.3 → 1.105.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/package.json +4 -5
- package/src/sap/fe/test/.library +1 -1
- package/src/sap/fe/test/BaseActions.js +103 -97
- package/src/sap/fe/test/BaseArrangements.js +4 -15
- package/src/sap/fe/test/BaseAssertions.js +39 -46
- package/src/sap/fe/test/CollaborationClient.js +5 -5
- package/src/sap/fe/test/CollaborationClient.ts +5 -5
- package/src/sap/fe/test/FeMocks.js +1 -3
- package/src/sap/fe/test/FeMocks.ts +4 -7
- package/src/sap/fe/test/Flexibility.js +115 -162
- package/src/sap/fe/test/JestTemplatingHelper.js +196 -14
- package/src/sap/fe/test/JestTemplatingHelper.ts +173 -18
- package/src/sap/fe/test/JourneyRunner.js +31 -37
- package/src/sap/fe/test/ListReport.js +30 -13
- package/src/sap/fe/test/ObjectPage.js +43 -33
- package/src/sap/fe/test/Shell.js +0 -6
- package/src/sap/fe/test/TemplatePage.js +0 -2
- package/src/sap/fe/test/TemplatingTestUtils.js +20 -20
- package/src/sap/fe/test/UI5MockHelper.js +373 -320
- package/src/sap/fe/test/UI5MockHelper.ts +388 -241
- package/src/sap/fe/test/Utils.js +19 -20
- package/src/sap/fe/test/api/BaseAPI.js +11 -26
- package/src/sap/fe/test/api/ChartActions.js +116 -119
- package/src/sap/fe/test/api/ChartAssertions.js +18 -22
- package/src/sap/fe/test/api/CollaborationAPI.js +6 -6
- package/src/sap/fe/test/api/CollaborationAPI.ts +9 -11
- package/src/sap/fe/test/api/DialogAPI.js +11 -13
- package/src/sap/fe/test/api/DialogActions.js +8 -8
- package/src/sap/fe/test/api/DialogAssertions.js +9 -10
- package/src/sap/fe/test/api/DialogHelper.js +63 -0
- package/src/sap/fe/test/api/DialogMessageActions.js +2 -1
- package/src/sap/fe/test/api/DialogValueHelpActions.js +17 -39
- package/src/sap/fe/test/api/DialogValueHelpAssertions.js +47 -19
- package/src/sap/fe/test/api/FilterBarAPI.js +11 -12
- package/src/sap/fe/test/api/FilterBarActions.js +26 -40
- package/src/sap/fe/test/api/FilterBarAssertions.js +28 -47
- package/src/sap/fe/test/api/FooterActionsBase.js +3 -4
- package/src/sap/fe/test/api/FooterActionsOP.js +6 -10
- package/src/sap/fe/test/api/FooterAssertionsBase.js +5 -10
- package/src/sap/fe/test/api/FooterAssertionsOP.js +8 -13
- package/src/sap/fe/test/api/FormAPI.js +5 -6
- package/src/sap/fe/test/api/FormActions.js +20 -21
- package/src/sap/fe/test/api/FormAssertions.js +14 -20
- package/src/sap/fe/test/api/HeaderAPI.js +12 -27
- package/src/sap/fe/test/api/HeaderActions.js +10 -12
- package/src/sap/fe/test/api/HeaderActionsLR.js +76 -82
- package/src/sap/fe/test/api/HeaderAssertions.js +18 -27
- package/src/sap/fe/test/api/HeaderAssertionsLR.js +5 -8
- package/src/sap/fe/test/api/HeaderLR.js +7 -19
- package/src/sap/fe/test/api/KPICardAssertions.js +18 -37
- package/src/sap/fe/test/api/TableAPI.js +3 -13
- package/src/sap/fe/test/api/TableActions.js +2 -34
- package/src/sap/fe/test/api/TableAssertions.js +1 -24
- package/src/sap/fe/test/builder/FEBuilder.js +71 -75
- package/src/sap/fe/test/builder/MacroFieldBuilder.js +4 -3
- package/src/sap/fe/test/builder/MdcFieldBuilder.js +33 -29
- package/src/sap/fe/test/builder/MdcFilterBarBuilder.js +102 -104
- package/src/sap/fe/test/builder/MdcFilterFieldBuilder.js +9 -7
- package/src/sap/fe/test/builder/MdcTableBuilder.js +8 -4
- package/src/sap/fe/test/builder/VMBuilder.js +39 -55
- package/src/sap/fe/test/internal/ConsoleErrorChecker.js +241 -0
- package/src/sap/fe/test/internal/ConsoleErrorChecker.ts +206 -0
- package/src/sap/fe/test/internal/FEArrangements.js +28 -8
- package/src/sap/fe/test/library.js +3 -2
- package/src/sap/fe/test/library.ts +1 -0
|
@@ -1,23 +1,34 @@
|
|
|
1
|
-
import { AnyAnnotation,
|
|
1
|
+
import type { AnyAnnotation, ConvertedMetadata, EntitySet, Property } from "@sap-ux/vocabularies-types";
|
|
2
2
|
import compiler from "@sap/cds-compiler";
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
import * as path from "path";
|
|
5
|
-
import {
|
|
5
|
+
import type { RequiredOptions } from "prettier";
|
|
6
|
+
import { format } from "prettier";
|
|
6
7
|
import Log from "sap/base/Log";
|
|
7
8
|
import merge from "sap/base/util/merge";
|
|
9
|
+
import AppComponent from "sap/fe/core/AppComponent";
|
|
8
10
|
import { registerBuildingBlock } from "sap/fe/core/buildingBlocks/BuildingBlockRuntime";
|
|
9
11
|
import ConverterContext from "sap/fe/core/converters/ConverterContext";
|
|
10
|
-
import { IssueCategory, IssueSeverity } from "sap/fe/core/converters/helpers/IssueManager";
|
|
11
|
-
import { ListReportManifestSettings, ObjectPageManifestSettings } from "sap/fe/core/converters/ManifestSettings";
|
|
12
|
-
import { IDiagnostics } from "sap/fe/core/converters/TemplateConverter";
|
|
12
|
+
import type { IssueCategory, IssueSeverity } from "sap/fe/core/converters/helpers/IssueManager";
|
|
13
|
+
import type { ListReportManifestSettings, ObjectPageManifestSettings } from "sap/fe/core/converters/ManifestSettings";
|
|
14
|
+
import type { IDiagnostics } from "sap/fe/core/converters/TemplateConverter";
|
|
13
15
|
import SideEffectsFactory from "sap/fe/core/services/SideEffectsServiceFactory";
|
|
14
16
|
import TemplateModel from "sap/fe/core/TemplateModel";
|
|
15
|
-
import { DataModelObjectPath } from "sap/fe/core/templating/DataModelPathHelper";
|
|
17
|
+
import type { DataModelObjectPath } from "sap/fe/core/templating/DataModelPathHelper";
|
|
16
18
|
import BindingParser from "sap/ui/base/BindingParser";
|
|
19
|
+
import ManagedObject from "sap/ui/base/ManagedObject";
|
|
20
|
+
import Component from "sap/ui/core/Component";
|
|
21
|
+
import Control from "sap/ui/core/Control";
|
|
17
22
|
import InvisibleText from "sap/ui/core/InvisibleText";
|
|
23
|
+
import Serializer from "sap/ui/core/util/serializer/Serializer";
|
|
18
24
|
import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
|
|
19
|
-
import
|
|
25
|
+
import FlexState from "sap/ui/fl/apply/_internal/flexState/FlexState";
|
|
26
|
+
import XmlPreprocessor from "sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor";
|
|
27
|
+
import AppStorage from "sap/ui/fl/initial/_internal/Storage";
|
|
28
|
+
import Utils from "sap/ui/fl/Utils";
|
|
29
|
+
import type Context from "sap/ui/model/Context";
|
|
20
30
|
import JSONModel from "sap/ui/model/json/JSONModel";
|
|
31
|
+
import MetaModel from "sap/ui/model/MetaModel";
|
|
21
32
|
import _MetadataRequestor from "sap/ui/model/odata/v4/lib/_MetadataRequestor";
|
|
22
33
|
import ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
|
|
23
34
|
import xpath from "xpath";
|
|
@@ -90,7 +101,7 @@ export const formatBuildingBlockXML = function (xmlString: string | string[]) {
|
|
|
90
101
|
xmlString = xmlString.join("");
|
|
91
102
|
}
|
|
92
103
|
let xmlFormatted = formatXML(xmlString);
|
|
93
|
-
xmlFormatted = xmlFormatted.replace(/uid--id-[0-9]{13}-[0-9]/g, "uid--id");
|
|
104
|
+
xmlFormatted = xmlFormatted.replace(/uid--id-[0-9]{13}-[0-9]{1,2}/g, "uid--id");
|
|
94
105
|
return xmlFormatted;
|
|
95
106
|
};
|
|
96
107
|
|
|
@@ -115,7 +126,8 @@ export const formatXML = function (xmlString: string) {
|
|
|
115
126
|
/**
|
|
116
127
|
* Compile a CDS file into an EDMX file.
|
|
117
128
|
*
|
|
118
|
-
* @param cdsUrl The path to the file containing the CDS definition. This file must declare the namespace
|
|
129
|
+
* @param cdsUrl The path to the file containing the CDS definition. This file must declare the namespace
|
|
130
|
+
* sap.fe.test and a service JestService
|
|
119
131
|
* @param options Options for creating the EDMX output
|
|
120
132
|
* @param edmxFileName Allows you to override the name of the compiled EDMX metadata file
|
|
121
133
|
* @returns The path of the generated EDMX
|
|
@@ -199,14 +211,14 @@ export const getFakeDiagnostics = function (): IDiagnostics {
|
|
|
199
211
|
},
|
|
200
212
|
checkIfIssueExists(issueCategory: IssueCategory, issueSeverity: IssueSeverity, details: string): boolean {
|
|
201
213
|
return issues.find((issue) => {
|
|
202
|
-
issue.issueCategory === issueCategory && issue.issueSeverity === issueSeverity && issue.details === details;
|
|
214
|
+
return issue.issueCategory === issueCategory && issue.issueSeverity === issueSeverity && issue.details === details;
|
|
203
215
|
});
|
|
204
216
|
}
|
|
205
217
|
};
|
|
206
218
|
};
|
|
207
219
|
|
|
208
220
|
export const getConverterContextForTest = function (
|
|
209
|
-
convertedTypes:
|
|
221
|
+
convertedTypes: ConvertedMetadata,
|
|
210
222
|
manifestSettings: ListReportManifestSettings | ObjectPageManifestSettings
|
|
211
223
|
) {
|
|
212
224
|
const entitySet = convertedTypes.entitySets.find((es) => es.name === manifestSettings.entitySet);
|
|
@@ -227,7 +239,7 @@ export const getMetaModel = async function (sMetadataUrl: string) {
|
|
|
227
239
|
|
|
228
240
|
export const getDataModelObjectPathForProperty = function (
|
|
229
241
|
entitySet: EntitySet,
|
|
230
|
-
convertedTypes:
|
|
242
|
+
convertedTypes: ConvertedMetadata,
|
|
231
243
|
property?: Property | EntitySet | AnyAnnotation
|
|
232
244
|
): DataModelObjectPath {
|
|
233
245
|
const targetPath: DataModelObjectPath = {
|
|
@@ -283,11 +295,60 @@ export function evaluateBindingWithModel(
|
|
|
283
295
|
return text.getText();
|
|
284
296
|
}
|
|
285
297
|
|
|
298
|
+
const TESTVIEWID = "testViewId";
|
|
299
|
+
|
|
300
|
+
export const applyFlexChanges = async function (
|
|
301
|
+
aVariantDependentControlChanges: any[],
|
|
302
|
+
oMetaModel: MetaModel,
|
|
303
|
+
resultXML: any,
|
|
304
|
+
createChangesObject: Function
|
|
305
|
+
) {
|
|
306
|
+
const changes = createChangesObject(TESTVIEWID, aVariantDependentControlChanges);
|
|
307
|
+
const appId = "someComponent";
|
|
308
|
+
const oManifest = {
|
|
309
|
+
"sap.app": {
|
|
310
|
+
id: appId,
|
|
311
|
+
type: "application",
|
|
312
|
+
crossNavigation: {
|
|
313
|
+
outbounds: []
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
const oAppComponent: AppComponent = {
|
|
318
|
+
getDiagnostics: jest.fn().mockReturnValue(getFakeDiagnostics()),
|
|
319
|
+
getModel: jest.fn().mockReturnValue({
|
|
320
|
+
getMetaModel: jest.fn().mockReturnValue(oMetaModel)
|
|
321
|
+
}),
|
|
322
|
+
getComponentData: jest.fn().mockReturnValue({}),
|
|
323
|
+
getManifestObject: jest.fn().mockReturnValue({
|
|
324
|
+
getEntry: function (name: string) {
|
|
325
|
+
return (oManifest as any)[name];
|
|
326
|
+
}
|
|
327
|
+
})
|
|
328
|
+
} as unknown as AppComponent;
|
|
329
|
+
//fake changes
|
|
330
|
+
jest.spyOn(AppStorage, "loadFlexData").mockReturnValue(Promise.resolve(changes));
|
|
331
|
+
jest.spyOn(Component, "get").mockReturnValue(oAppComponent);
|
|
332
|
+
jest.spyOn(Utils, "getAppComponentForControl").mockReturnValue(oAppComponent);
|
|
333
|
+
await FlexState.initialize({
|
|
334
|
+
componentId: appId
|
|
335
|
+
});
|
|
336
|
+
resultXML = await XmlPreprocessor.process(resultXML, { name: "Test Fragment", componentId: appId, id: TESTVIEWID });
|
|
337
|
+
return resultXML;
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
export const getChangesFromXML = (xml: any) =>
|
|
341
|
+
[...xml.querySelectorAll("*")]
|
|
342
|
+
.flatMap((e) => [...e.attributes].map((a) => a.name))
|
|
343
|
+
.filter((attr) => attr.includes("sap.ui.fl.appliedChanges"));
|
|
344
|
+
|
|
286
345
|
export const getTemplatingResult = async function (
|
|
287
346
|
xmlInput: string,
|
|
288
347
|
sMetadataUrl: string,
|
|
289
348
|
mBindingContexts: { [x: string]: any; entitySet?: string },
|
|
290
|
-
mModels: { [x: string]: any }
|
|
349
|
+
mModels: { [x: string]: any },
|
|
350
|
+
aVariantDependentControlChanges?: any[],
|
|
351
|
+
createChangesObject?: Function
|
|
291
352
|
) {
|
|
292
353
|
const templatedXml = `<root>${xmlInput}</root>`;
|
|
293
354
|
const parser = new window.DOMParser();
|
|
@@ -330,24 +391,46 @@ export const getTemplatingResult = async function (
|
|
|
330
391
|
oPreprocessorSettings.bindingContexts["this"] = oPreprocessorSettings.models["this"].createBindingContext("/");
|
|
331
392
|
}
|
|
332
393
|
|
|
333
|
-
|
|
394
|
+
let resultXML = await XMLPreprocessor.process(xmlDoc.firstElementChild!, { name: "Test Fragment" }, oPreprocessorSettings);
|
|
395
|
+
|
|
396
|
+
if (aVariantDependentControlChanges && createChangesObject) {
|
|
397
|
+
// prefix Ids
|
|
398
|
+
[...resultXML.querySelectorAll("[id]")].forEach((node) => {
|
|
399
|
+
node.id = `${TESTVIEWID}--${node.id}`;
|
|
400
|
+
});
|
|
401
|
+
// apply flex changes
|
|
402
|
+
resultXML = await applyFlexChanges(aVariantDependentControlChanges, oMetaModel, resultXML, createChangesObject);
|
|
403
|
+
//Assert that all changes have been applied
|
|
404
|
+
const changesApplied = getChangesFromXML(resultXML);
|
|
405
|
+
expect(changesApplied.length).toBe(aVariantDependentControlChanges.length);
|
|
406
|
+
}
|
|
407
|
+
return resultXML;
|
|
334
408
|
};
|
|
335
409
|
|
|
336
410
|
export const getTemplatedXML = async function (
|
|
337
411
|
xmlInput: string,
|
|
338
412
|
sMetadataUrl: string,
|
|
339
413
|
mBindingContexts: { [x: string]: any; entitySet?: string },
|
|
340
|
-
mModels: { [x: string]: any }
|
|
414
|
+
mModels: { [x: string]: any },
|
|
415
|
+
aVariantDependentControlChanges?: any[],
|
|
416
|
+
createChangesObject?: Function
|
|
341
417
|
) {
|
|
342
|
-
const templatedXML = await getTemplatingResult(
|
|
418
|
+
const templatedXML = await getTemplatingResult(
|
|
419
|
+
xmlInput,
|
|
420
|
+
sMetadataUrl,
|
|
421
|
+
mBindingContexts,
|
|
422
|
+
mModels,
|
|
423
|
+
aVariantDependentControlChanges,
|
|
424
|
+
createChangesObject
|
|
425
|
+
);
|
|
343
426
|
return serializeXML(templatedXML);
|
|
344
427
|
};
|
|
345
428
|
|
|
346
429
|
/**
|
|
347
430
|
* Process the requested XML fragment with the provided data.
|
|
348
431
|
*
|
|
349
|
-
* @param
|
|
350
|
-
* @param
|
|
432
|
+
* @param name Fully qualified name of the fragment to be tested.
|
|
433
|
+
* @param testData Test data consisting
|
|
351
434
|
* @returns Templated fragment as string
|
|
352
435
|
*/
|
|
353
436
|
export async function processFragment(name: string, testData: { [model: string]: object }): Promise<string> {
|
|
@@ -385,3 +468,75 @@ export async function processFragment(name: string, testData: { [model: string]:
|
|
|
385
468
|
filter: (node: any) => node.type !== "Comment"
|
|
386
469
|
});
|
|
387
470
|
}
|
|
471
|
+
|
|
472
|
+
export function serializeControl(controlToSerialize: Control | Control[]) {
|
|
473
|
+
let tabCount = 0;
|
|
474
|
+
function getTab(toAdd: number = 0) {
|
|
475
|
+
let tab = "";
|
|
476
|
+
for (let i = 0; i < tabCount + toAdd; i++) {
|
|
477
|
+
tab += "\t";
|
|
478
|
+
}
|
|
479
|
+
return tab;
|
|
480
|
+
}
|
|
481
|
+
const serializeDelegate = {
|
|
482
|
+
start: function (control: Control, sAggregationName: string) {
|
|
483
|
+
let controlDetail = "";
|
|
484
|
+
if (sAggregationName) {
|
|
485
|
+
const indexInParent = (control.getParent()!.getAggregation(sAggregationName) as ManagedObject[]).indexOf(control);
|
|
486
|
+
if (indexInParent > 0) {
|
|
487
|
+
controlDetail += `,\n${getTab()}`;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
controlDetail += `${control.getMetadata().getName()}(`;
|
|
491
|
+
return controlDetail;
|
|
492
|
+
},
|
|
493
|
+
end: function () {
|
|
494
|
+
return "})";
|
|
495
|
+
},
|
|
496
|
+
middle: function (control: any) {
|
|
497
|
+
let data = `{id: ${control.getId()}`;
|
|
498
|
+
for (const oControlKey in control.mProperties) {
|
|
499
|
+
if (control.mProperties.hasOwnProperty(oControlKey)) {
|
|
500
|
+
data += `,\n${getTab()} ${oControlKey}: ${control.mProperties[oControlKey]}`;
|
|
501
|
+
} else if (control.mBindingInfos.hasOwnProperty(oControlKey)) {
|
|
502
|
+
const bindingDetail = control.mBindingInfos[oControlKey];
|
|
503
|
+
data += `,\n${getTab()} ${oControlKey}: formatter(${bindingDetail.parts.map(
|
|
504
|
+
(bindingInfo: any) => `\n${getTab(1)}${bindingInfo.model ? bindingInfo.model : ""}>${bindingInfo.path}`
|
|
505
|
+
)})`;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
for (const oControlKey in control.mAssociations) {
|
|
509
|
+
if (control.mAssociations.hasOwnProperty(oControlKey)) {
|
|
510
|
+
data += `,\n${getTab()} ${oControlKey}: ${control.mAssociations[oControlKey][0]}`;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
data += ``;
|
|
514
|
+
return data;
|
|
515
|
+
},
|
|
516
|
+
startAggregation: function (control: Control, sName: string) {
|
|
517
|
+
let out = `,\n${getTab()}${sName}`;
|
|
518
|
+
tabCount++;
|
|
519
|
+
out += `=[\n${getTab()}`;
|
|
520
|
+
return out;
|
|
521
|
+
},
|
|
522
|
+
endAggregation: function () {
|
|
523
|
+
tabCount--;
|
|
524
|
+
return `\n${getTab()}]`;
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
if (Array.isArray(controlToSerialize)) {
|
|
528
|
+
return controlToSerialize.map((controlToRender: Control) => {
|
|
529
|
+
return new Serializer(controlToRender, serializeDelegate).serialize();
|
|
530
|
+
});
|
|
531
|
+
} else {
|
|
532
|
+
return new Serializer(controlToSerialize, serializeDelegate).serialize();
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export function createAwaiter() {
|
|
537
|
+
let fnResolve!: Function;
|
|
538
|
+
const myPromise = new Promise((resolve) => {
|
|
539
|
+
fnResolve = resolve;
|
|
540
|
+
});
|
|
541
|
+
return { promise: myPromise, resolve: fnResolve };
|
|
542
|
+
}
|
|
@@ -17,7 +17,7 @@ sap.ui.define(
|
|
|
17
17
|
"sap/base/Log",
|
|
18
18
|
"sap/base/util/ObjectPath"
|
|
19
19
|
],
|
|
20
|
-
function(BaseObject, Opa5, Utils, BaseArrangements, BaseActions, BaseAssertions, Shell, opaQunit, Log, ObjectPath) {
|
|
20
|
+
function (BaseObject, Opa5, Utils, BaseArrangements, BaseActions, BaseAssertions, Shell, opaQunit, Log, ObjectPath) {
|
|
21
21
|
"use strict";
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -34,19 +34,17 @@ sap.ui.define(
|
|
|
34
34
|
* Constructs a new JourneyRunner instance.
|
|
35
35
|
*
|
|
36
36
|
* @class A JourneyRunner for executing integration tests with given settings.
|
|
37
|
-
*
|
|
38
37
|
* @param {object} [mSettings] The settings object
|
|
39
38
|
* @param {object} [mSettings.pages] The available Opa pages
|
|
40
39
|
* @param {object} [mSettings.opaConfig] The Opa configuration applied via {@link sap.ui.test.Opa5#sap.ui.test.Opa5.extendConfig}
|
|
41
40
|
* @param {string} [mSettings.launchUrl] The URL to the launching page (usually a FLP.html)
|
|
42
41
|
* @param {object} [mSettings.launchParameters] The URL launch parameters
|
|
43
42
|
* @param {boolean} [mSettings.async] If false (default), only one JourneyRunner is executed at a time
|
|
44
|
-
*
|
|
45
43
|
* @alias sap.fe.test.JourneyRunner
|
|
46
44
|
* @public
|
|
47
45
|
*/
|
|
48
46
|
var JourneyRunner = BaseObject.extend("sap.fe.test.JourneyRunner", {
|
|
49
|
-
constructor: function(mSettings) {
|
|
47
|
+
constructor: function (mSettings) {
|
|
50
48
|
BaseObject.apply(this);
|
|
51
49
|
// store a copy of the settings object
|
|
52
50
|
this._mInstanceSettings = Utils.mergeObjects(
|
|
@@ -72,15 +70,14 @@ sap.ui.define(
|
|
|
72
70
|
* @param {boolean} [mSettings.async] If false (default), only one JourneyRunner is executed at a time
|
|
73
71
|
* @param {Function[] | string[]} vJourneys The journeys to be executed. If a journey is represented as a string, it will be interpreted
|
|
74
72
|
* as a module path to the file that should be loaded. Else it is expected to be a function.
|
|
75
|
-
* Alternatively, instead of being wrapped in an array, the journeys can also be given as separate parameters:
|
|
73
|
+
* Alternatively, instead of being wrapped in an array, the journeys can also be given as separate parameters:
|
|
76
74
|
* <pre>.run(mSettings, Journey1, Journey2, ...)</pre>
|
|
77
75
|
* @returns {object} A <code>Promise</code> that is resolved after all tests have been executed
|
|
78
|
-
*
|
|
79
76
|
* @function
|
|
80
77
|
* @name sap.fe.test.JourneyRunner#run
|
|
81
78
|
* @public
|
|
82
79
|
*/
|
|
83
|
-
run: function(mSettings, vJourneys) {
|
|
80
|
+
run: function (mSettings, vJourneys) {
|
|
84
81
|
var iJourneyParameterIndex = 1;
|
|
85
82
|
if (!Utils.isOfType(mSettings, Object)) {
|
|
86
83
|
iJourneyParameterIndex = 0;
|
|
@@ -90,7 +87,8 @@ sap.ui.define(
|
|
|
90
87
|
}
|
|
91
88
|
|
|
92
89
|
var aJourneys = Array.prototype.slice.call(arguments, iJourneyParameterIndex); // journey-related parameter(s) as array
|
|
93
|
-
if (aJourneys && aJourneys.length && Array.isArray(aJourneys[0])) {
|
|
90
|
+
if (aJourneys && aJourneys.length && Array.isArray(aJourneys[0])) {
|
|
91
|
+
// if the first journey parameter is an array...
|
|
94
92
|
aJourneys = aJourneys[0]; // ...then unwrap it, to use this array itself
|
|
95
93
|
}
|
|
96
94
|
var bAsync = mSettings.async,
|
|
@@ -106,7 +104,7 @@ sap.ui.define(
|
|
|
106
104
|
.then(this._preRunActions.bind(this, mSettings))
|
|
107
105
|
.then(this._runActions.bind(this, aJourneys))
|
|
108
106
|
.then(this._postRunActions.bind(this, mSettings))
|
|
109
|
-
.catch(function(oError) {
|
|
107
|
+
.catch(function (oError) {
|
|
110
108
|
Log.error("JourneyRunner.run failed", oError);
|
|
111
109
|
});
|
|
112
110
|
|
|
@@ -127,12 +125,11 @@ sap.ui.define(
|
|
|
127
125
|
*
|
|
128
126
|
* @param {object} mSettings The settings object of the runner instance
|
|
129
127
|
* @returns {sap.ui.test.Opa} An Opa instance for the base actions
|
|
130
|
-
*
|
|
131
128
|
* @function
|
|
132
129
|
* @name sap.fe.test.JourneyRunner#getBaseActions
|
|
133
130
|
* @protected
|
|
134
131
|
*/
|
|
135
|
-
getBaseActions: function(mSettings) {
|
|
132
|
+
getBaseActions: function (mSettings) {
|
|
136
133
|
return new BaseActions();
|
|
137
134
|
},
|
|
138
135
|
|
|
@@ -146,12 +143,11 @@ sap.ui.define(
|
|
|
146
143
|
*
|
|
147
144
|
* @param {object} mSettings The settings object of the runner instance
|
|
148
145
|
* @returns {sap.ui.test.Opa} An Opa instance for the base assertions
|
|
149
|
-
*
|
|
150
146
|
* @function
|
|
151
147
|
* @name sap.fe.test.JourneyRunner#getBaseAssertions
|
|
152
148
|
* @protected
|
|
153
149
|
*/
|
|
154
|
-
getBaseAssertions: function(mSettings) {
|
|
150
|
+
getBaseAssertions: function (mSettings) {
|
|
155
151
|
return new BaseAssertions();
|
|
156
152
|
},
|
|
157
153
|
|
|
@@ -165,83 +161,83 @@ sap.ui.define(
|
|
|
165
161
|
*
|
|
166
162
|
* @param {object} mSettings The settings object of the runner instance
|
|
167
163
|
* @returns {sap.ui.test.Opa} An Opa instance for the base arrangements
|
|
168
|
-
*
|
|
169
164
|
* @function
|
|
170
165
|
* @name sap.fe.test.JourneyRunner#getBaseArrangements
|
|
171
166
|
* @protected
|
|
172
167
|
*/
|
|
173
|
-
getBaseArrangements: function(mSettings) {
|
|
168
|
+
getBaseArrangements: function (mSettings) {
|
|
174
169
|
return new BaseArrangements(mSettings);
|
|
175
170
|
},
|
|
176
171
|
|
|
177
|
-
_preRunActions: function(mSettings) {
|
|
172
|
+
_preRunActions: function (mSettings) {
|
|
178
173
|
Opa5.extendConfig(this._getOpaConfig(mSettings));
|
|
179
174
|
Opa5.createPageObjects(mSettings.pages);
|
|
180
175
|
},
|
|
181
176
|
|
|
182
|
-
_runActions: function(aJourneys) {
|
|
177
|
+
_runActions: function (aJourneys) {
|
|
183
178
|
var that = this,
|
|
184
179
|
pPromiseChain = Promise.resolve(),
|
|
185
180
|
fnRunnerResolve,
|
|
186
|
-
pRunnerEnds = new Promise(function(resolve) {
|
|
181
|
+
pRunnerEnds = new Promise(function (resolve) {
|
|
187
182
|
fnRunnerResolve = resolve;
|
|
188
183
|
});
|
|
189
184
|
|
|
190
185
|
Log.info("JourneyRunner started");
|
|
191
186
|
|
|
192
|
-
QUnit.done(function() {
|
|
187
|
+
QUnit.done(function () {
|
|
193
188
|
Log.info("JourneyRunner ended");
|
|
194
189
|
fnRunnerResolve();
|
|
195
190
|
});
|
|
196
191
|
|
|
197
|
-
aJourneys.forEach(function(vJourney) {
|
|
192
|
+
aJourneys.forEach(function (vJourney) {
|
|
198
193
|
if (Utils.isOfType(vJourney, String)) {
|
|
199
|
-
pPromiseChain = pPromiseChain.then(function() {
|
|
200
|
-
return new Promise(function(resolve, reject) {
|
|
201
|
-
sap.ui.require([vJourney], function(oJourney) {
|
|
194
|
+
pPromiseChain = pPromiseChain.then(function () {
|
|
195
|
+
return new Promise(function (resolve, reject) {
|
|
196
|
+
sap.ui.require([vJourney], function (oJourney) {
|
|
202
197
|
resolve(oJourney);
|
|
203
198
|
});
|
|
204
199
|
});
|
|
205
200
|
});
|
|
206
201
|
} else {
|
|
207
|
-
pPromiseChain = pPromiseChain.then(function() {
|
|
202
|
+
pPromiseChain = pPromiseChain.then(function () {
|
|
208
203
|
return vJourney;
|
|
209
204
|
});
|
|
210
205
|
}
|
|
211
206
|
pPromiseChain = pPromiseChain.then(that._runJourney);
|
|
212
207
|
});
|
|
213
|
-
return pPromiseChain.then(function() {
|
|
208
|
+
return pPromiseChain.then(function () {
|
|
214
209
|
return pRunnerEnds;
|
|
215
210
|
});
|
|
216
211
|
},
|
|
217
212
|
|
|
218
|
-
_runJourney: function(vJourney) {
|
|
213
|
+
_runJourney: function (vJourney) {
|
|
219
214
|
if (Utils.isOfType(vJourney, Function)) {
|
|
220
215
|
vJourney.call();
|
|
221
216
|
}
|
|
222
217
|
},
|
|
223
218
|
|
|
224
|
-
_postRunActions: function(mSettings) {
|
|
219
|
+
_postRunActions: function (mSettings) {
|
|
225
220
|
this._removePages(mSettings.pages);
|
|
226
221
|
Opa5.resetConfig();
|
|
227
222
|
},
|
|
228
223
|
|
|
229
|
-
_removePages: function(mPages) {
|
|
224
|
+
_removePages: function (mPages) {
|
|
230
225
|
var that = this;
|
|
231
|
-
mPages
|
|
232
|
-
Object.keys(mPages).forEach(function(sPageName) {
|
|
226
|
+
if (mPages) {
|
|
227
|
+
Object.keys(mPages).forEach(function (sPageName) {
|
|
233
228
|
var mPage = mPages[sPageName],
|
|
234
229
|
sClassName = that._createClassName(mPage.namespace || "sap.ui.test.opa.pageObject", sPageName);
|
|
235
230
|
// remove path entry to avoid error log flooding from OPA5 - it is newly created anyways
|
|
236
231
|
ObjectPath.set(sClassName, undefined);
|
|
237
232
|
});
|
|
233
|
+
}
|
|
238
234
|
},
|
|
239
235
|
|
|
240
|
-
_createClassName: function(sNameSpace, sName) {
|
|
236
|
+
_createClassName: function (sNameSpace, sName) {
|
|
241
237
|
return sNameSpace + "." + sName;
|
|
242
238
|
},
|
|
243
239
|
|
|
244
|
-
_getOpaConfig: function(mSettings) {
|
|
240
|
+
_getOpaConfig: function (mSettings) {
|
|
245
241
|
var oConfig = Object.assign(
|
|
246
242
|
{
|
|
247
243
|
viewNamespace: "sap.fe.templates",
|
|
@@ -272,12 +268,11 @@ sap.ui.define(
|
|
|
272
268
|
* Gets the global journey runner instance.
|
|
273
269
|
*
|
|
274
270
|
* @returns {object} The global default {@link sap.fe.test.JourneyRunner} instance
|
|
275
|
-
*
|
|
276
271
|
* @function
|
|
277
272
|
* @public
|
|
278
273
|
* @static
|
|
279
274
|
*/
|
|
280
|
-
JourneyRunner.getDefaultRunner = function() {
|
|
275
|
+
JourneyRunner.getDefaultRunner = function () {
|
|
281
276
|
if (!_oDefaultRunner) {
|
|
282
277
|
_oDefaultRunner = new JourneyRunner();
|
|
283
278
|
}
|
|
@@ -288,12 +283,11 @@ sap.ui.define(
|
|
|
288
283
|
* Sets the global journey runner instance.
|
|
289
284
|
*
|
|
290
285
|
* @param {sap.fe.test.JourneyRunner} oDefaultRunner Defines the global default {@link sap.fe.test.JourneyRunner} instance
|
|
291
|
-
*
|
|
292
286
|
* @function
|
|
293
287
|
* @public
|
|
294
288
|
* @static
|
|
295
289
|
*/
|
|
296
|
-
JourneyRunner.setDefaultRunner = function(oDefaultRunner) {
|
|
290
|
+
JourneyRunner.setDefaultRunner = function (oDefaultRunner) {
|
|
297
291
|
if (_oDefaultRunner) {
|
|
298
292
|
_oDefaultRunner.destroy();
|
|
299
293
|
}
|
|
@@ -309,7 +303,7 @@ sap.ui.define(
|
|
|
309
303
|
* @public
|
|
310
304
|
* @static
|
|
311
305
|
*/
|
|
312
|
-
JourneyRunner.run = function() {
|
|
306
|
+
JourneyRunner.run = function () {
|
|
313
307
|
var oRunner = JourneyRunner.getDefaultRunner();
|
|
314
308
|
oRunner.run.apply(oRunner, arguments);
|
|
315
309
|
};
|
|
@@ -61,19 +61,18 @@ sap.ui.define(
|
|
|
61
61
|
* <code><pre>
|
|
62
62
|
* var oListReportDefinition = new ListReport({ appId: "MyApp", componentId: "MyListReportId", entitySet: "MyEntitySet" });
|
|
63
63
|
* </pre></code>
|
|
64
|
-
*
|
|
65
64
|
* @param {object} oPageDefinition The required parameters
|
|
66
65
|
* @param {string} oPageDefinition.appId The app id (defined in the manifest root)
|
|
67
66
|
* @param {string} oPageDefinition.componentId The component id (defined in the target section for the list report within the manifest)
|
|
68
67
|
* @param {string} oPageDefinition.entitySet The entitySet (optional)(defined in the settings of the corresponding target component within the manifest)
|
|
69
68
|
* @param {string} oPageDefinition.contextPath The contextPath (optional)(defined in the settings of the corresponding target component within the manifest)
|
|
70
|
-
* @param {...object} [
|
|
69
|
+
* @param {...object} [aInAdditionalPageDefinitions] Additional custom page functions, provided in an object containing <code>actions</code> and <code>assertions</code>
|
|
71
70
|
* @returns {sap.fe.test.ListReport} A list report page definition
|
|
72
71
|
* @name sap.fe.test.ListReport
|
|
73
72
|
* @extends sap.fe.test.TemplatePage
|
|
74
73
|
* @public
|
|
75
74
|
*/
|
|
76
|
-
function ListReport(oPageDefinition,
|
|
75
|
+
function ListReport(oPageDefinition, aInAdditionalPageDefinitions) {
|
|
77
76
|
var sAppId = oPageDefinition.appId,
|
|
78
77
|
sComponentId = oPageDefinition.componentId,
|
|
79
78
|
sContextPath = oPageDefinition.contextPath,
|
|
@@ -164,7 +163,6 @@ sap.ui.define(
|
|
|
164
163
|
*
|
|
165
164
|
* @param {boolean} [bCollapse] Defines whether the header should be collapsed, else it is expanded (default)
|
|
166
165
|
* @returns {object} The result of the {@link sap.ui.test.Opa5#waitFor} function, to be used for chained statements
|
|
167
|
-
*
|
|
168
166
|
* @function
|
|
169
167
|
* @name sap.fe.test.ListReport.actions#iCollapseExpandPageHeader
|
|
170
168
|
* @public
|
|
@@ -181,6 +179,27 @@ sap.ui.define(
|
|
|
181
179
|
.description("Pressing dialog button '" + sText + "'")
|
|
182
180
|
.execute();
|
|
183
181
|
},
|
|
182
|
+
iCheckLinksCount: function (count) {
|
|
183
|
+
return OpaBuilder.create(this)
|
|
184
|
+
.hasType("sap.m.ColumnListItem")
|
|
185
|
+
.check(function (targets) {
|
|
186
|
+
if (targets.length === count) {
|
|
187
|
+
return true;
|
|
188
|
+
} else {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
}, true)
|
|
192
|
+
.description("Seeing QuickView Card with " + count + " target applications in ObjectPage")
|
|
193
|
+
.execute();
|
|
194
|
+
},
|
|
195
|
+
iClickQuickViewMoreLinksButton: function () {
|
|
196
|
+
return OpaBuilder.create(this)
|
|
197
|
+
.hasType("sap.m.Button")
|
|
198
|
+
.has(OpaBuilder.Matchers.resourceBundle("text", "sap.ui.mdc", "info.POPOVER_DEFINE_LINKS"))
|
|
199
|
+
.doPress()
|
|
200
|
+
.description("Pressing 'More Links' button")
|
|
201
|
+
.execute();
|
|
202
|
+
},
|
|
184
203
|
iClickLinkWithText: function (sText) {
|
|
185
204
|
return OpaBuilder.create(this)
|
|
186
205
|
.hasType("sap.m.Link")
|
|
@@ -422,9 +441,7 @@ sap.ui.define(
|
|
|
422
441
|
.execute();
|
|
423
442
|
},
|
|
424
443
|
iSeeDeleteConfirmation: function () {
|
|
425
|
-
return this._iSeeTheMessageToast(
|
|
426
|
-
oResourceBundleCore.getText("C_TRANSACTION_HELPER_OBJECT_PAGE_DELETE_TOAST_SINGULAR")
|
|
427
|
-
);
|
|
444
|
+
return this._iSeeTheMessageToast(oResourceBundleCore.getText("C_TRANSACTION_HELPER_DELETE_TOAST_SINGULAR"));
|
|
428
445
|
},
|
|
429
446
|
iSeePageTitle: function (sTitle) {
|
|
430
447
|
return OpaBuilder.create(this)
|
|
@@ -436,7 +453,7 @@ sap.ui.define(
|
|
|
436
453
|
iSeeVariantTitle: function (sTitle) {
|
|
437
454
|
return OpaBuilder.create(this)
|
|
438
455
|
.hasType("sap.m.Title")
|
|
439
|
-
.hasId("fe::PageVariantManagement-text")
|
|
456
|
+
.hasId("fe::PageVariantManagement-vm-text")
|
|
440
457
|
.hasProperties({ text: sTitle })
|
|
441
458
|
.description("Seeing variant title '" + sTitle + "'")
|
|
442
459
|
.execute();
|
|
@@ -444,7 +461,7 @@ sap.ui.define(
|
|
|
444
461
|
iSeeControlVMFilterBarTitle: function (sTitle) {
|
|
445
462
|
return OpaBuilder.create(this)
|
|
446
463
|
.hasType("sap.m.Title")
|
|
447
|
-
.hasId(FilterBarId + "::VariantManagement-text")
|
|
464
|
+
.hasId(FilterBarId + "::VariantManagement-vm-text")
|
|
448
465
|
.hasProperties({ text: sTitle })
|
|
449
466
|
.description("Seeing variant title '" + sTitle + "'")
|
|
450
467
|
.execute();
|
|
@@ -453,7 +470,7 @@ sap.ui.define(
|
|
|
453
470
|
var sTableId = sIconTabProperty ? getTableId(sIconTabProperty) : SingleTableId;
|
|
454
471
|
return OpaBuilder.create(this)
|
|
455
472
|
.hasType("sap.m.Title")
|
|
456
|
-
.hasId(sTableId + "::VM-text")
|
|
473
|
+
.hasId(sTableId + "::VM-vm-text")
|
|
457
474
|
.hasProperties({ text: sTitle })
|
|
458
475
|
.description("Seeing variant title '" + sTitle + "'")
|
|
459
476
|
.execute();
|
|
@@ -461,15 +478,15 @@ sap.ui.define(
|
|
|
461
478
|
iSeeVariantModified: function (bIsModified, bControl) {
|
|
462
479
|
var sLabelId;
|
|
463
480
|
if (bControl) {
|
|
464
|
-
sLabelId = FilterBarId + "::VariantManagement-modified";
|
|
481
|
+
sLabelId = FilterBarId + "::VariantManagement-vm-modified";
|
|
465
482
|
} else {
|
|
466
|
-
sLabelId = "fe::PageVariantManagement-modified";
|
|
483
|
+
sLabelId = "fe::PageVariantManagement-vm-modified";
|
|
467
484
|
}
|
|
468
485
|
|
|
469
486
|
bIsModified = bIsModified === undefined ? true : bIsModified;
|
|
470
487
|
if (bIsModified) {
|
|
471
488
|
return OpaBuilder.create(this)
|
|
472
|
-
.hasType("sap.m.
|
|
489
|
+
.hasType("sap.m.Text")
|
|
473
490
|
.hasId(sLabelId)
|
|
474
491
|
.hasProperties({ text: "*" })
|
|
475
492
|
.description("Seeing variant state as 'modified'")
|