@sap-ux/ui5-test-writer 1.18.2 → 1.18.3
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.
|
@@ -12,7 +12,7 @@ import { addPagesToJourneyRunner } from './utils/journeyRunnerUtils.js';
|
|
|
12
12
|
import { hasVirtualOPA5, addVirtualTestConfig } from './utils/virtualOpaUtils.js';
|
|
13
13
|
import { addJourneysToOpaJourneyTypes } from './utils/opaJourneyTypesUtils.js';
|
|
14
14
|
import { getPackageScripts } from '@sap-ux/fiori-generator-shared';
|
|
15
|
-
import {
|
|
15
|
+
import { resolveFlpSandboxHtmlTarget } from './utils/flpSandboxUtils.js';
|
|
16
16
|
import { getListReportViews, isALPManifestTarget } from './utils/listReportUtils.js';
|
|
17
17
|
import { resolveOriginatingView } from './utils/objectPageUtils.js';
|
|
18
18
|
import { compareUI5VersionGte } from '@sap-ux/ui5-application-writer';
|
|
@@ -89,7 +89,12 @@ export async function generateOPAFiles(basePath, options, metadata, fs, log, sta
|
|
|
89
89
|
const rootCommonTemplateDirPath = join(__dirname, '../templates/common');
|
|
90
90
|
const templateUi5Version = getTemplateUi5Version(options.ui5Version);
|
|
91
91
|
const rootV4TemplateDirPath = join(__dirname, `../templates/${applicationType}`, templateUi5Version);
|
|
92
|
-
const
|
|
92
|
+
const webappPath = await getWebappPath(basePath);
|
|
93
|
+
const testOutDirPath = join(webappPath, 'test');
|
|
94
|
+
// use flpSandbox target if none is given by caller; if not resolvable, config.htmlTarget already contains "index.html"
|
|
95
|
+
if (!options.htmlTarget) {
|
|
96
|
+
config.htmlTarget = resolveFlpSandboxHtmlTarget(testOutDirPath, webappPath, editor) ?? config.htmlTarget;
|
|
97
|
+
}
|
|
93
98
|
// Access ux-specification to get feature data for OPA test generation
|
|
94
99
|
const appFeatures = await getAppFeatures(basePath, editor, log, metadata, manifest);
|
|
95
100
|
// Drop action tests the target template bucket cannot render (custom actions: latest only;
|
|
@@ -256,7 +261,7 @@ function logModifiedFiles(log, modifiedFiles) {
|
|
|
256
261
|
}
|
|
257
262
|
/**
|
|
258
263
|
* Resolve the standalone-mode write context: detect preexisting integration tests and an
|
|
259
|
-
* incompatible legacy setup, and
|
|
264
|
+
* incompatible legacy setup, and preserve the htmlTarget from an existing opaTests.qunit.js if present.
|
|
260
265
|
*
|
|
261
266
|
* @param writeContext - shared write context to base the resolved context on
|
|
262
267
|
* @returns a new WriteContext with the resolved values for the standalone generation
|
|
@@ -280,8 +285,8 @@ async function resolveStandaloneWriteContext(writeContext) {
|
|
|
280
285
|
}
|
|
281
286
|
/**
|
|
282
287
|
* Resolve the standalone-mode write context for the case where the integration folder is
|
|
283
|
-
* missing entirely: there are no OPA tests yet
|
|
284
|
-
* added
|
|
288
|
+
* missing entirely: there are no OPA tests yet and the int-test package script may need to be
|
|
289
|
+
* added.
|
|
285
290
|
*
|
|
286
291
|
* @param writeContext - shared write context to base the resolved context on
|
|
287
292
|
* @returns a new WriteContext with the resolved values for the standalone generation
|
|
@@ -295,17 +300,9 @@ async function resolveWriteContextForMissingIntegrationFolder(writeContext) {
|
|
|
295
300
|
writeContext.modifiedFiles.push('package.json');
|
|
296
301
|
}
|
|
297
302
|
}
|
|
298
|
-
let htmlTarget = writeContext.config.htmlTarget;
|
|
299
|
-
if (existsSync(join(writeContext.testOutDirPath, 'flpSandbox.html'))) {
|
|
300
|
-
const hashFromFlpSandbox = readHashFromFlpSandbox(join('test', 'flpSandbox.html'), await getWebappPath(writeContext.basePath), writeContext.editor);
|
|
301
|
-
if (hashFromFlpSandbox) {
|
|
302
|
-
htmlTarget = `test/flpSandbox.html#${hashFromFlpSandbox}`;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
303
|
return {
|
|
306
304
|
...writeContext,
|
|
307
|
-
hasPreexistingTests: false
|
|
308
|
-
config: { ...writeContext.config, htmlTarget }
|
|
305
|
+
hasPreexistingTests: false
|
|
309
306
|
};
|
|
310
307
|
}
|
|
311
308
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -13,7 +13,11 @@ export type OPAGenerationOptions = {
|
|
|
13
13
|
scriptName?: string;
|
|
14
14
|
/** The appID. If not specified, will be read from the manifest in sap.app/id. */
|
|
15
15
|
appID?: string;
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* The html target used for the launchUrl in the OPA journey file. If not specified, it is derived
|
|
18
|
+
* from the app's `test/flpSandbox.html` (e.g. `test/flpSandbox.html#<appIntent>`), falling back to
|
|
19
|
+
* `index.html` when no FLP sandbox is present.
|
|
20
|
+
*/
|
|
17
21
|
htmlTarget?: string;
|
|
18
22
|
/** When true, OPA harness files are served virtually; skip writing them to disk. */
|
|
19
23
|
useVirtualPreviewEndpoints?: boolean;
|
|
@@ -14,4 +14,13 @@ import type { Editor } from 'mem-fs-editor';
|
|
|
14
14
|
* @returns the application key (e.g. `fincashbankmanage-tile`), or undefined
|
|
15
15
|
*/
|
|
16
16
|
export declare function readHashFromFlpSandbox(htmlRelativePath: string, webappPath: string, fs: Editor): string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the JourneyRunner launchUrl html target from the app's FLP sandbox.
|
|
19
|
+
*
|
|
20
|
+
* @param testOutDirPath - path to the test output directory (`.../webapp/test`)
|
|
21
|
+
* @param webappPath - path to the webapp directory
|
|
22
|
+
* @param fs - mem-fs-editor instance (works against both disk and in-memory files)
|
|
23
|
+
* @returns the html target, or undefined if flpSandbox.html is missing or has no app key
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveFlpSandboxHtmlTarget(testOutDirPath: string, webappPath: string, fs: Editor): string | undefined;
|
|
17
26
|
//# sourceMappingURL=flpSandboxUtils.d.ts.map
|
|
@@ -34,4 +34,19 @@ export function readHashFromFlpSandbox(htmlRelativePath, webappPath, fs) {
|
|
|
34
34
|
return undefined;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolves the JourneyRunner launchUrl html target from the app's FLP sandbox.
|
|
39
|
+
*
|
|
40
|
+
* @param testOutDirPath - path to the test output directory (`.../webapp/test`)
|
|
41
|
+
* @param webappPath - path to the webapp directory
|
|
42
|
+
* @param fs - mem-fs-editor instance (works against both disk and in-memory files)
|
|
43
|
+
* @returns the html target, or undefined if flpSandbox.html is missing or has no app key
|
|
44
|
+
*/
|
|
45
|
+
export function resolveFlpSandboxHtmlTarget(testOutDirPath, webappPath, fs) {
|
|
46
|
+
if (!fs.exists(join(testOutDirPath, 'flpSandbox.html'))) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const appKey = readHashFromFlpSandbox(join('test', 'flpSandbox.html'), webappPath, fs);
|
|
50
|
+
return appKey ? `test/flpSandbox.html#${appKey}` : undefined;
|
|
51
|
+
}
|
|
37
52
|
//# sourceMappingURL=flpSandboxUtils.js.map
|
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.18.
|
|
4
|
+
"version": "1.18.3",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@sap-ux/logger": "1.0.3",
|
|
32
32
|
"@sap-ux/fiori-generator-shared": "1.2.22",
|
|
33
33
|
"@sap-ux/project-access": "2.3.1",
|
|
34
|
-
"@sap-ux/
|
|
35
|
-
"@sap-ux/
|
|
34
|
+
"@sap-ux/ui5-application-writer": "2.1.6",
|
|
35
|
+
"@sap-ux/preview-middleware": "1.2.27"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@jest/globals": "30.4.1",
|