@sap-ux/ui5-test-writer 1.2.34 → 1.2.35

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.
@@ -46,6 +46,19 @@ export async function generateOPAFiles(basePath, options, metadata, fs, log, sta
46
46
  // OPA Journey file
47
47
  const startPages = config.pages.filter((page) => page.isStartup).map((page) => page.targetKey);
48
48
  const LROP = findLROP(config.pages, manifest);
49
+ // Only projects with a startup ListReport page (LROP) or an FPM page get ux-specification-derived
50
+ // journeys. All other project types (ObjectPage-only, Analytical List Page, unrecognized) fall back
51
+ // to the generic FirstJourney starter.
52
+ const generateUxSpecJourneys = !!LROP.pageLR || !!appFeatures.fpm;
53
+ // ALP pages are tagged with the `AnalyticalListPage` template in `createPageConfig`, which already
54
+ // excludes them from `findLROP` above (it matches only `template === 'ListReport'`). An ALP is a
55
+ // ListReport component under the hood with no dedicated page-object template or framework class, so
56
+ // now that detection is done, normalize the marker back to `ListReport` for all downstream rendering.
57
+ for (const page of config.pages) {
58
+ if (page.template === 'AnalyticalListPage') {
59
+ page.template = 'ListReport';
60
+ }
61
+ }
49
62
  const journeyParams = {
50
63
  startPages,
51
64
  startLR: LROP.pageLR?.targetKey,
@@ -62,6 +75,7 @@ export async function generateOPAFiles(basePath, options, metadata, fs, log, sta
62
75
  log,
63
76
  journeyParams,
64
77
  dotFileExtension,
78
+ generateUxSpecJourneys,
65
79
  modifiedFiles: []
66
80
  };
67
81
  if (standalone) {
@@ -350,6 +364,9 @@ function createPageConfig(manifest, targetKey, forcedAppID) {
350
364
  isStartup: false,
351
365
  fileName: targetKey + '.gen'
352
366
  };
367
+ if (target.options?.settings?.views) {
368
+ pageConfig.template = 'AnalyticalListPage';
369
+ }
353
370
  if (target.options.settings.contextPath) {
354
371
  pageConfig.contextPath = target.options.settings.contextPath;
355
372
  }
@@ -511,7 +528,7 @@ function writeOpaJourneyTypes(writeContext) {
511
528
  function writeJourneyFiles(appFeatures, writeContext) {
512
529
  const { config, rootV4TemplateDirPath, testOutDirPath, editor, journeyParams, dotFileExtension } = writeContext;
513
530
  const generatedJourneys = [];
514
- if (appFeatures.listReport?.name) {
531
+ if (writeContext.generateUxSpecJourneys && appFeatures.listReport?.name) {
515
532
  editor.copyTpl(join(rootV4TemplateDirPath, 'integration', `ListReportJourney${dotFileExtension}`), join(testOutDirPath, 'integration', `${appFeatures.listReport.name}Journey.gen${dotFileExtension}`), {
516
533
  ...journeyParams,
517
534
  ...appFeatures.listReport,
@@ -521,7 +538,7 @@ function writeJourneyFiles(appFeatures, writeContext) {
521
538
  });
522
539
  generatedJourneys.push(appFeatures.listReport.name);
523
540
  }
524
- if (appFeatures.objectPages && appFeatures.objectPages.length > 0) {
541
+ if (writeContext.generateUxSpecJourneys && appFeatures.objectPages && appFeatures.objectPages.length > 0) {
525
542
  appFeatures.objectPages.forEach((objectPage) => {
526
543
  if (objectPage.name) {
527
544
  editor.copyTpl(join(rootV4TemplateDirPath, 'integration', `ObjectPageJourney${dotFileExtension}`), join(testOutDirPath, 'integration', `${objectPage.name}Journey.gen${dotFileExtension}`), {
@@ -535,7 +552,7 @@ function writeJourneyFiles(appFeatures, writeContext) {
535
552
  }
536
553
  });
537
554
  }
538
- if (appFeatures.fpm?.name) {
555
+ if (writeContext.generateUxSpecJourneys && appFeatures.fpm?.name) {
539
556
  // FPM TypeScript support is out of scope for the initial TS OPA5 work
540
557
  // (LROP only). The FPM journey path below is hardcoded `.js` and there is
541
558
  // no `FPM.ts` template, so we force `DotFileExtension.JS` for the FPM
@@ -551,7 +568,7 @@ function writeJourneyFiles(appFeatures, writeContext) {
551
568
  });
552
569
  generatedJourneys.push(appFeatures.fpm.name);
553
570
  }
554
- if (generatedJourneys.length === 0 && !writeContext.hasPreexistingTests) {
571
+ if (generatedJourneys.length === 0 && !writeContext.incompatibleTestSetup) {
555
572
  writeFallbackJourney(writeContext);
556
573
  }
557
574
  return generatedJourneys;
@@ -564,7 +581,12 @@ function writeJourneyFiles(appFeatures, writeContext) {
564
581
  */
565
582
  function writeFallbackJourney(writeContext) {
566
583
  const { config, rootV4TemplateDirPath, testOutDirPath, editor, journeyParams, dotFileExtension } = writeContext;
567
- editor.copyTpl(join(rootV4TemplateDirPath, 'integration', `FirstJourney${dotFileExtension}`), join(testOutDirPath, 'integration', `${config.opaJourneyFileName}${dotFileExtension}`), journeyParams, undefined, {
584
+ const fallbackPath = join(testOutDirPath, 'integration', `${config.opaJourneyFileName}${dotFileExtension}`);
585
+ // Do not clobber an existing fallback file (e.g. a user-edited FirstJourney in a preexisting test setup).
586
+ if (editor.exists(fallbackPath)) {
587
+ return;
588
+ }
589
+ editor.copyTpl(join(rootV4TemplateDirPath, 'integration', `FirstJourney${dotFileExtension}`), fallbackPath, journeyParams, undefined, {
568
590
  globOptions: { dot: true }
569
591
  });
570
592
  }
@@ -676,9 +698,12 @@ function writeOpaTestsStartupFiles(writeContext, generatedJourneys = []) {
676
698
  * @returns true if the file was written, false otherwise
677
699
  */
678
700
  function updateReferencesInOpaTestsStartupFiles(writeContext, generatedJourneys = []) {
679
- return addPathsToQUnitJs(generatedJourneys.map((page) => {
680
- return `${writeContext.config.appPath}/test/integration/${page}Journey.gen`;
681
- }), writeContext.testOutDirPath, writeContext.editor, writeContext.log);
701
+ // With no ux-spec journeys, wire the fallback journey (plain `opaJourneyFileName`, no `Journey.gen`
702
+ // suffix) into the existing qunit harness so the test setup remains runnable.
703
+ const journeyPaths = generatedJourneys.length > 0
704
+ ? generatedJourneys.map((page) => `${writeContext.config.appPath}/test/integration/${page}Journey.gen`)
705
+ : [`${writeContext.config.appPath}/test/integration/${writeContext.config.opaJourneyFileName}`];
706
+ return addPathsToQUnitJs(journeyPaths, writeContext.testOutDirPath, writeContext.editor, writeContext.log);
682
707
  }
683
708
  /**
684
709
  * Writes a page object in a mem-fs-editor.
package/dist/types.d.ts CHANGED
@@ -243,6 +243,12 @@ export type WriteContext = {
243
243
  hasPreexistingTests?: boolean;
244
244
  incompatibleTestSetup?: boolean;
245
245
  dotFileExtension: DotFileExtension;
246
+ /**
247
+ * When true, ux-specification-derived journeys (ListReport, ObjectPage, FPM) are generated.
248
+ * When false (e.g. ObjectPage-only or Analytical List Page projects), only the generic
249
+ * fallback `FirstJourney` is written.
250
+ */
251
+ generateUxSpecJourneys: boolean;
246
252
  modifiedFiles: string[];
247
253
  };
248
254
  export type FormField = {
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.2.34",
4
+ "version": "1.2.35",
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.21",
31
31
  "@sap-ux/ui5-application-writer": "2.1.2",
32
32
  "@sap-ux/logger": "1.0.3",
33
+ "@sap-ux/fiori-generator-shared": "1.2.5",
33
34
  "@sap-ux/project-access": "2.1.9",
34
- "@sap-ux/preview-middleware": "1.0.49",
35
- "@sap-ux/fiori-generator-shared": "1.2.5"
35
+ "@sap-ux/preview-middleware": "1.0.49"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@jest/globals": "30.4.1",