@sap-ux/ui5-test-writer 0.1.7 → 0.1.9

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/i18n.js CHANGED
@@ -46,5 +46,7 @@ function t(key, options) {
46
46
  return i18next_1.default.t(key, options);
47
47
  }
48
48
  exports.t = t;
49
- initI18n();
49
+ initI18n().catch(() => {
50
+ // Ignore any errors since the write will still work
51
+ });
50
52
  //# sourceMappingURL=i18n.js.map
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import type { Editor } from 'mem-fs-editor';
6
6
  * @param basePath - the absolute target path where the application will be generated
7
7
  * @param opaConfig - parameters for the generation
8
8
  * @param opaConfig.scriptName - the name of the OPA journey file. If not specified, 'FirstJourney' will be used
9
+ * @param opaConfig.htmlTarget - the name of the html that will be used in OPA journey file. If not specified, 'index.html' will be used
9
10
  * @param opaConfig.appID - the appID. If not specified, will be read from the manifest in sap.app/id
10
11
  * @param fs - an optional reference to a mem-fs editor
11
12
  * @returns Reference to a mem-fs-editor
@@ -13,6 +14,7 @@ import type { Editor } from 'mem-fs-editor';
13
14
  export declare function generateOPAFiles(basePath: string, opaConfig: {
14
15
  scriptName?: string;
15
16
  appID?: string;
17
+ htmlTarget?: string;
16
18
  }, fs?: Editor): Editor;
17
19
  /**
18
20
  * Generate a page object file for a Fiori elements for OData V4 application.
package/dist/index.js CHANGED
@@ -97,31 +97,33 @@ function createPageConfig(manifest, targetKey, forcedAppID) {
97
97
  * @param manifest - the app descriptor of the target app
98
98
  * @param opaConfig - parameters for the generation
99
99
  * @param opaConfig.scriptName - the name of the OPA journey file. If not specified, 'FirstJourney' will be used
100
+ * @param opaConfig.htmlTarget - the name of the html file that will be used in the OPA journey file. If not specified, 'index.html' will be used
100
101
  * @param opaConfig.appID - the appID. If not specified, will be read from the manifest in sap.app/id
101
102
  * @returns OPA test configuration object
102
103
  */
103
104
  function createConfig(manifest, opaConfig) {
104
- var _a, _b, _c, _d, _e, _f;
105
+ var _a, _b, _c, _d, _e, _f, _g, _h;
105
106
  // General application info
106
107
  const { appID, appPath } = getAppFromManifest(manifest, opaConfig.appID);
107
108
  const config = {
108
109
  appID,
109
110
  appPath,
110
111
  pages: [],
111
- opaJourneyFileName: opaConfig.scriptName || 'FirstJourney'
112
+ opaJourneyFileName: (_a = opaConfig.scriptName) !== null && _a !== void 0 ? _a : 'FirstJourney',
113
+ htmlTarget: (_b = opaConfig.htmlTarget) !== null && _b !== void 0 ? _b : 'index.html'
112
114
  };
113
115
  // Identify startup targets from the routes
114
- const appRoutes = ((_c = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.routing) === null || _b === void 0 ? void 0 : _b.routes) !== null && _c !== void 0 ? _c : []);
116
+ const appRoutes = ((_e = (_d = (_c = manifest['sap.ui5']) === null || _c === void 0 ? void 0 : _c.routing) === null || _d === void 0 ? void 0 : _d.routes) !== null && _e !== void 0 ? _e : []);
115
117
  // Find the route with an empty pattern (except for the trailing query part)
116
118
  const startupRoute = appRoutes.find((route) => {
117
119
  return route.pattern.replace(':?query:', '') === '';
118
120
  });
119
- let startupTargets = (_d = startupRoute === null || startupRoute === void 0 ? void 0 : startupRoute.target) !== null && _d !== void 0 ? _d : [];
121
+ let startupTargets = (_f = startupRoute === null || startupRoute === void 0 ? void 0 : startupRoute.target) !== null && _f !== void 0 ? _f : [];
120
122
  if (!Array.isArray(startupTargets)) {
121
123
  startupTargets = [startupTargets];
122
124
  }
123
125
  // Create page configurations in supported cases
124
- const appTargets = (_f = (_e = manifest['sap.ui5']) === null || _e === void 0 ? void 0 : _e.routing) === null || _f === void 0 ? void 0 : _f.targets;
126
+ const appTargets = (_h = (_g = manifest['sap.ui5']) === null || _g === void 0 ? void 0 : _g.routing) === null || _h === void 0 ? void 0 : _h.targets;
125
127
  for (const targetKey in appTargets) {
126
128
  const pageConfig = createPageConfig(manifest, targetKey, opaConfig.appID);
127
129
  if (pageConfig) {
@@ -200,6 +202,7 @@ function writePageObject(pageConfig, rootTemplateDirPath, testOutDirPath, fs) {
200
202
  * @param basePath - the absolute target path where the application will be generated
201
203
  * @param opaConfig - parameters for the generation
202
204
  * @param opaConfig.scriptName - the name of the OPA journey file. If not specified, 'FirstJourney' will be used
205
+ * @param opaConfig.htmlTarget - the name of the html that will be used in OPA journey file. If not specified, 'index.html' will be used
203
206
  * @param opaConfig.appID - the appID. If not specified, will be read from the manifest in sap.app/id
204
207
  * @param fs - an optional reference to a mem-fs editor
205
208
  * @returns Reference to a mem-fs-editor
package/dist/types.d.ts CHANGED
@@ -15,6 +15,7 @@ export type FEV4OPAConfig = {
15
15
  appPath: string;
16
16
  pages: FEV4OPAPageConfig[];
17
17
  opaJourneyFileName: string;
18
+ htmlTarget: string;
18
19
  };
19
20
  export type FEV4ManifestTarget = {
20
21
  type?: 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.7",
4
+ "version": "0.1.9",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -26,12 +26,12 @@
26
26
  "mem-fs-editor": "9.4.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@sap-ux/project-access": "1.1.3",
30
29
  "@types/ejs": "3.1.0",
31
30
  "@types/fs-extra": "9.0.13",
32
31
  "@types/mem-fs": "1.1.2",
33
32
  "@types/mem-fs-editor": "7.0.1",
34
- "fs-extra": "10.0.0"
33
+ "fs-extra": "10.0.0",
34
+ "@sap-ux/project-access": "1.8.1"
35
35
  },
36
36
  "engines": {
37
37
  "pnpm": ">=6.26.1 < 7.0.0 || >=7.1.0",
@@ -7,8 +7,8 @@ sap.ui.require(
7
7
  function(JourneyRunner, opaJourney, <%- pages.map(function(page) {return page.targetKey;}).join(', ')%>) {
8
8
  'use strict';
9
9
  var JourneyRunner = new JourneyRunner({
10
- // start index.html in web folder
11
- launchUrl: sap.ui.require.toUrl('<%- appPath %>') + '/index.html'
10
+ // start <%- htmlTarget %> in web folder
11
+ launchUrl: sap.ui.require.toUrl('<%- appPath %>') + '/<%- htmlTarget %>'
12
12
  });
13
13
 
14
14