@sap-ux/ui5-test-writer 0.1.6 → 0.1.7
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/index.js +17 -17
- package/dist/types.d.ts +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14,10 +14,10 @@ const i18n_1 = require("./i18n");
|
|
|
14
14
|
* @returns the manifest object. An exception is thrown if the manifest cannot be read.
|
|
15
15
|
*/
|
|
16
16
|
function readManifest(fs, basePath) {
|
|
17
|
-
const manifest = fs.readJSON(path_1.join(basePath, 'webapp/manifest.json'));
|
|
17
|
+
const manifest = fs.readJSON((0, path_1.join)(basePath, 'webapp/manifest.json'));
|
|
18
18
|
if (!manifest) {
|
|
19
|
-
throw new types_1.ValidationError(i18n_1.t('error.cannotReadManifest', {
|
|
20
|
-
filePath: path_1.join(basePath, 'webapp/manifest.json')
|
|
19
|
+
throw new types_1.ValidationError((0, i18n_1.t)('error.cannotReadManifest', {
|
|
20
|
+
filePath: (0, path_1.join)(basePath, 'webapp/manifest.json')
|
|
21
21
|
}));
|
|
22
22
|
}
|
|
23
23
|
return manifest;
|
|
@@ -39,7 +39,7 @@ function getAppTypeFromManifest(manifest) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
if (!isFEV4) {
|
|
42
|
-
throw new types_1.ValidationError(i18n_1.t('error.badApplicationType'));
|
|
42
|
+
throw new types_1.ValidationError((0, i18n_1.t)('error.badApplicationType'));
|
|
43
43
|
}
|
|
44
44
|
return 'v4'; // For the time being, only FE V4 is supported
|
|
45
45
|
}
|
|
@@ -55,7 +55,7 @@ function getAppFromManifest(manifest, forcedAppID) {
|
|
|
55
55
|
const appID = forcedAppID || ((_a = manifest['sap.app']) === null || _a === void 0 ? void 0 : _a.id);
|
|
56
56
|
const appPath = appID === null || appID === void 0 ? void 0 : appID.split('.').join('/');
|
|
57
57
|
if (!appID || !appPath) {
|
|
58
|
-
throw new types_1.ValidationError(i18n_1.t('error.cannotReadAppID'));
|
|
58
|
+
throw new types_1.ValidationError((0, i18n_1.t)('error.cannotReadAppID'));
|
|
59
59
|
}
|
|
60
60
|
return { appID, appPath };
|
|
61
61
|
}
|
|
@@ -189,7 +189,7 @@ function findLROP(pages, manifest) {
|
|
|
189
189
|
* @param fs - a reference to a mem-fs editor
|
|
190
190
|
*/
|
|
191
191
|
function writePageObject(pageConfig, rootTemplateDirPath, testOutDirPath, fs) {
|
|
192
|
-
fs.copyTpl(path_1.join(rootTemplateDirPath, `integration/pages/${pageConfig.template}.js`), path_1.join(testOutDirPath, `integration/pages/${pageConfig.targetKey}.js`), pageConfig, undefined, {
|
|
192
|
+
fs.copyTpl((0, path_1.join)(rootTemplateDirPath, `integration/pages/${pageConfig.template}.js`), (0, path_1.join)(testOutDirPath, `integration/pages/${pageConfig.targetKey}.js`), pageConfig, undefined, {
|
|
193
193
|
globOptions: { dot: true }
|
|
194
194
|
});
|
|
195
195
|
}
|
|
@@ -206,17 +206,17 @@ function writePageObject(pageConfig, rootTemplateDirPath, testOutDirPath, fs) {
|
|
|
206
206
|
*/
|
|
207
207
|
function generateOPAFiles(basePath, opaConfig, fs) {
|
|
208
208
|
var _a, _b;
|
|
209
|
-
const editor = fs || mem_fs_editor_1.create(mem_fs_1.create());
|
|
209
|
+
const editor = fs || (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
210
210
|
const manifest = readManifest(editor, basePath);
|
|
211
211
|
const applicationType = getAppTypeFromManifest(manifest);
|
|
212
212
|
const config = createConfig(manifest, opaConfig);
|
|
213
|
-
const rootCommonTemplateDirPath = path_1.join(__dirname, '../templates/common');
|
|
214
|
-
const rootV4TemplateDirPath = path_1.join(__dirname, `../templates/${applicationType}`); // Only v4 is supported for the time being
|
|
215
|
-
const testOutDirPath = path_1.join(basePath, 'webapp/test');
|
|
213
|
+
const rootCommonTemplateDirPath = (0, path_1.join)(__dirname, '../templates/common');
|
|
214
|
+
const rootV4TemplateDirPath = (0, path_1.join)(__dirname, `../templates/${applicationType}`); // Only v4 is supported for the time being
|
|
215
|
+
const testOutDirPath = (0, path_1.join)(basePath, 'webapp/test');
|
|
216
216
|
// Common test files
|
|
217
|
-
editor.copy(path_1.join(rootCommonTemplateDirPath), testOutDirPath);
|
|
217
|
+
editor.copy((0, path_1.join)(rootCommonTemplateDirPath), testOutDirPath);
|
|
218
218
|
// Integration (OPA) test files - version-specific
|
|
219
|
-
editor.copyTpl(path_1.join(rootV4TemplateDirPath, 'integration', 'opaTests.*.*'), path_1.join(testOutDirPath, 'integration'), config, undefined, {
|
|
219
|
+
editor.copyTpl((0, path_1.join)(rootV4TemplateDirPath, 'integration', 'opaTests.*.*'), (0, path_1.join)(testOutDirPath, 'integration'), config, undefined, {
|
|
220
220
|
globOptions: { dot: true }
|
|
221
221
|
});
|
|
222
222
|
// Pages files (one for each page in the app)
|
|
@@ -231,7 +231,7 @@ function generateOPAFiles(basePath, opaConfig, fs) {
|
|
|
231
231
|
startLR: (_a = LROP.pageLR) === null || _a === void 0 ? void 0 : _a.targetKey,
|
|
232
232
|
navigatedOP: (_b = LROP.pageOP) === null || _b === void 0 ? void 0 : _b.targetKey
|
|
233
233
|
};
|
|
234
|
-
editor.copyTpl(path_1.join(rootV4TemplateDirPath, 'integration/FirstJourney.js'), path_1.join(testOutDirPath, `integration/${config.opaJourneyFileName}.js`), journeyParams, undefined, {
|
|
234
|
+
editor.copyTpl((0, path_1.join)(rootV4TemplateDirPath, 'integration/FirstJourney.js'), (0, path_1.join)(testOutDirPath, `integration/${config.opaJourneyFileName}.js`), journeyParams, undefined, {
|
|
235
235
|
globOptions: { dot: true }
|
|
236
236
|
});
|
|
237
237
|
return editor;
|
|
@@ -249,17 +249,17 @@ exports.generateOPAFiles = generateOPAFiles;
|
|
|
249
249
|
* @returns Reference to a mem-fs-editor
|
|
250
250
|
*/
|
|
251
251
|
function generatePageObjectFile(basePath, pageObjectParameters, fs) {
|
|
252
|
-
const editor = fs || mem_fs_editor_1.create(mem_fs_1.create());
|
|
252
|
+
const editor = fs || (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
253
253
|
const manifest = readManifest(editor, basePath);
|
|
254
254
|
const applicationType = getAppTypeFromManifest(manifest);
|
|
255
255
|
const pageConfig = createPageConfig(manifest, pageObjectParameters.targetKey, pageObjectParameters.appID);
|
|
256
256
|
if (pageConfig) {
|
|
257
|
-
const rootTemplateDirPath = path_1.join(__dirname, `../templates/${applicationType}`); // Only v4 is supported for the time being
|
|
258
|
-
const testOutDirPath = path_1.join(basePath, 'webapp/test');
|
|
257
|
+
const rootTemplateDirPath = (0, path_1.join)(__dirname, `../templates/${applicationType}`); // Only v4 is supported for the time being
|
|
258
|
+
const testOutDirPath = (0, path_1.join)(basePath, 'webapp/test');
|
|
259
259
|
writePageObject(pageConfig, rootTemplateDirPath, testOutDirPath, editor);
|
|
260
260
|
}
|
|
261
261
|
else {
|
|
262
|
-
throw new types_1.ValidationError(i18n_1.t('error.cannotGeneratePageFile', {
|
|
262
|
+
throw new types_1.ValidationError((0, i18n_1.t)('error.cannotGeneratePageFile', {
|
|
263
263
|
targetKey: pageObjectParameters.targetKey
|
|
264
264
|
}));
|
|
265
265
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const SupportedPageTypes: {
|
|
2
2
|
[id: string]: string;
|
|
3
3
|
};
|
|
4
|
-
export
|
|
4
|
+
export type FEV4OPAPageConfig = {
|
|
5
5
|
appID: string;
|
|
6
6
|
appPath: string;
|
|
7
7
|
template: string;
|
|
@@ -10,13 +10,13 @@ export declare type FEV4OPAPageConfig = {
|
|
|
10
10
|
targetKey: string;
|
|
11
11
|
isStartup: boolean;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type FEV4OPAConfig = {
|
|
14
14
|
appID: string;
|
|
15
15
|
appPath: string;
|
|
16
16
|
pages: FEV4OPAPageConfig[];
|
|
17
17
|
opaJourneyFileName: string;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type FEV4ManifestTarget = {
|
|
20
20
|
type?: string;
|
|
21
21
|
name?: string;
|
|
22
22
|
id?: string;
|
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": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"mem-fs-editor": "9.4.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@sap-ux/project-access": "1.
|
|
29
|
+
"@sap-ux/project-access": "1.1.3",
|
|
30
30
|
"@types/ejs": "3.1.0",
|
|
31
31
|
"@types/fs-extra": "9.0.13",
|
|
32
32
|
"@types/mem-fs": "1.1.2",
|