@sap-ux/ui5-test-writer 1.4.3 → 1.5.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.
@@ -22,6 +22,17 @@ export interface SectionItem extends AggregationItem {
22
22
  custom?: boolean;
23
23
  name?: string;
24
24
  order?: number;
25
+ properties?: {
26
+ stashed?: {
27
+ freeText: string | boolean;
28
+ };
29
+ hidden?: {
30
+ value: boolean;
31
+ };
32
+ hideByProperty?: {
33
+ value: string | boolean;
34
+ };
35
+ };
25
36
  schema: {
26
37
  keys: {
27
38
  name: string;
@@ -25,6 +25,9 @@ export async function getAppFeatures(basePath, fs, log, metadata, manifest) {
25
25
  // readApp calls createApplicationAccess internally if given a path, but it uses the "live" version of project-access without fs enhancement
26
26
  const appAccess = await createApplicationAccess(basePath, { fs: fs });
27
27
  const specification = await appAccess.getSpecification();
28
+ // `includeAnnotationProperties` only becomes available with ux-specification 1.144.8, but updating
29
+ // the dependency causes imports to break, due to a change in export mechanism
30
+ // TODO: Remove workaround when ux-specification is updated to 1.144.8 or later
28
31
  const readAppOptions = {
29
32
  app: appAccess,
30
33
  fs: fs,
@@ -135,6 +135,9 @@ function extractObjectPageHeaderSectionsData(objectPage) {
135
135
  const sectionsAggregation = getAggregations(headerAggregation)['sections'];
136
136
  const sections = getAggregations(sectionsAggregation);
137
137
  Object.values(sections).forEach((section) => {
138
+ if (isSectionHidden(section)) {
139
+ return;
140
+ }
138
141
  const facetId = getSectionIdentifier(section);
139
142
  if (!facetId) {
140
143
  // if no identifier can be found for the section, it is not possible to reliably identify it in tests, so skip it
@@ -173,6 +176,9 @@ function extractObjectPageBodySectionsData(objectPage, convertedMetadata, schema
173
176
  const sectionsAggregation = getAggregations(objectPage.model.root)['sections'];
174
177
  const sections = getAggregations(sectionsAggregation);
175
178
  Object.entries(sections).forEach(([sectionKey, section]) => {
179
+ if (isSectionHidden(section)) {
180
+ return;
181
+ }
176
182
  const sectionId = getSectionIdentifier(section) ?? sectionKey;
177
183
  const subSections = extractBodySubSectionsData(section, sectionId, convertedMetadata, objectPage.entitySet);
178
184
  const navigationProperty = getNavigationPropertyFromKey(sectionKey);
@@ -264,7 +270,7 @@ function extractSectionActions(section, convertedMetadata, schemaNamespace) {
264
270
  */
265
271
  function extractBodySubSectionsData(section, parentSectionId, convertedMetadata, entitySetName) {
266
272
  const subSectionItems = getAggregations(getAggregations(section)['subsections']);
267
- const childEntries = Object.entries(subSectionItems);
273
+ const childEntries = Object.entries(subSectionItems).filter(([, child]) => !isSectionHidden(child));
268
274
  // all-FieldGroup CollectionFacet is collapsed into one sub-section with inherited id from parent
269
275
  // Table or nested CollectionFacet sub-sections are kept as distinct sub-sections with their own ids
270
276
  return isFormOnlyCollectionFacet(childEntries)
@@ -566,6 +572,17 @@ function isSectionMicroChart(section) {
566
572
  function isTableSection(section) {
567
573
  return !!section.isTable || !!getAggregations(section).table;
568
574
  }
575
+ /**
576
+ * Checks whether a section is hidden by a UI.Hidden annotation and should be skipped.
577
+ *
578
+ * @param section - section entry from ux specification
579
+ * @returns true if the section is marked hidden
580
+ */
581
+ function isSectionHidden(section) {
582
+ // hideByProperty holds a dynamic hide expression; skip unless it is a static `false` (always visible).
583
+ return (section.properties?.hidden?.value === true ||
584
+ (section.properties?.hideByProperty !== undefined && section.properties.hideByProperty.value !== false));
585
+ }
569
586
  /**
570
587
  * Checks if the section contains a form based on it's aggregations.
571
588
  *
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.4.3",
4
+ "version": "1.5.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -28,11 +28,11 @@
28
28
  "@sap/ux-specification": "1.144.5",
29
29
  "@sap-ux/edmx-parser": "0.10.0",
30
30
  "@sap-ux/annotation-converter": "0.10.21",
31
- "@sap-ux/ui5-application-writer": "2.1.3",
32
31
  "@sap-ux/logger": "1.0.3",
33
- "@sap-ux/project-access": "2.1.10",
32
+ "@sap-ux/ui5-application-writer": "2.1.3",
34
33
  "@sap-ux/fiori-generator-shared": "1.2.6",
35
- "@sap-ux/preview-middleware": "1.1.2"
34
+ "@sap-ux/project-access": "2.1.10",
35
+ "@sap-ux/preview-middleware": "1.1.3"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@jest/globals": "30.4.1",