@sap-ux/ui5-test-writer 1.16.1 → 1.16.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.
package/dist/types.d.ts CHANGED
@@ -133,12 +133,16 @@ export type ContactCardField = {
133
133
  property: string;
134
134
  };
135
135
  /**
136
- * A table column whose bound property carries both a `Common.Text` annotation and a
137
- * `UI.TextArrangement` annotation. `textProperty` is the text/description property the
138
- * column can be sorted by (the `Common.Text` target, e.g. "CustomerName").
136
+ * A table column whose bound property carries a `Common.Text` annotation. `textProperty` is the
137
+ * sortable text target (always present); `columnProperty` is the column's own property, omitted when
138
+ * `UI.TextArrangement` is `TextOnly` (only the text is sortable). When several columns share one text
139
+ * target, each emits its own `columnProperty` sort test but only the first emits the text-property
140
+ * test; the rest set `skipTextPropertyTest`.
139
141
  */
140
142
  export type TextAnnotationColumn = {
143
+ columnProperty?: string;
141
144
  textProperty: string;
145
+ skipTextPropertyTest?: boolean;
142
146
  };
143
147
  export type BodySubSectionFeatureData = {
144
148
  id: string;
@@ -208,26 +208,16 @@ export declare function getPropertyLabelFromMetadata(convertedMetadata: Converte
208
208
  */
209
209
  export declare function isHiddenFilter(convertedMetadata: ConvertedMetadata, entitySetName: string | undefined, propertyName: string): boolean;
210
210
  /**
211
- * Returns true if the property carries a `@com.sap.vocabularies.UI.v1.TextArrangement`
212
- * annotation nested on its `@com.sap.vocabularies.Common.v1.Text` annotation.
213
- *
214
- * @param convertedMetadata - already-converted OData metadata (metadata merged with local annotations)
215
- * @param entitySetName - name of the entity set that owns the property (undefined → false)
216
- * @param propertyName - name of the property to inspect
217
- * @returns true if the property has a text arrangement annotation
218
- */
219
- export declare function hasTextArrangement(convertedMetadata: ConvertedMetadata, entitySetName: string | undefined, propertyName: string): boolean;
220
- /**
221
- * Returns true if the property carries a `@com.sap.vocabularies.UI.v1.Hidden` annotation.
222
- * A hidden property is not exposed as a sortable column in the sort dialog, so it cannot be
223
- * used as a sort target.
224
- *
225
- * @param convertedMetadata - already-converted OData metadata (metadata merged with local annotations)
226
- * @param entitySetName - name of the entity set that owns the property (undefined → false)
227
- * @param propertyName - name of the property to inspect
228
- * @returns true if the property is hidden
211
+ * Returns true if the property's `UI.TextArrangement` is `TextOnly`, checking both the nested
212
+ * (`Common.Text`) and sibling (property-level) locations. Under `TextOnly` the code property is not
213
+ * sortable, so its sort test must be skipped.
214
+ *
215
+ * @param convertedMetadata - converted OData metadata (metadata merged with local annotations)
216
+ * @param entitySetName - entity set owning the property (undefined → false)
217
+ * @param propertyName - property to inspect
218
+ * @returns true if the text arrangement is TextOnly
229
219
  */
230
- export declare function isHiddenProperty(convertedMetadata: ConvertedMetadata, entitySetName: string | undefined, propertyName: string): boolean;
220
+ export declare function isTextOnlyArrangement(convertedMetadata: ConvertedMetadata, entitySetName: string | undefined, propertyName: string): boolean;
231
221
  /**
232
222
  * Checks the state of action buttons defined in UI.LineItem annotations for a given entity set.
233
223
  *
@@ -157,15 +157,23 @@ export function getListReportFeatures(listReportPage, log, metadata, manifest, r
157
157
  // `@UI.HiddenFilter` properties cannot be added via the adaptation dialog; skip the check when metadata is missing.
158
158
  .filter((key) => !convertedMetadata || !isHiddenFilter(convertedMetadata, listReportPage.entitySet, key))
159
159
  : undefined;
160
- // Columns with a text annotation only get a sort-order test when their bound property also
161
- // carries a UI.TextArrangement annotation (checked against the merged metadata), and the text
162
- // (sort target) property is not hidden — a hidden property is not a sortable column.
160
+ // A maintained text annotation emits a sort test for the text target property (no TextArrangement
161
+ // required). The code column is also sorted, except under TextOnly where it is not sortable.
163
162
  const meta = convertedMetadata;
163
+ const seenTextProperties = new Set();
164
164
  const textAnnotationColumns = meta
165
- ? extractTextAnnotationColumnsFromNode(listReportPage.model.root)
166
- .filter((candidate) => hasTextArrangement(meta, listReportPage.entitySet, candidate.columnProperty) &&
167
- !isHiddenProperty(meta, listReportPage.entitySet, candidate.textProperty))
168
- .map((candidate) => ({ textProperty: candidate.textProperty }))
165
+ ? extractTextAnnotationColumnsFromNode(listReportPage.model.root).map((candidate) => {
166
+ // Dedupe the text-property sort test per text target; each code column keeps its own.
167
+ const skipTextPropertyTest = seenTextProperties.has(candidate.textProperty);
168
+ seenTextProperties.add(candidate.textProperty);
169
+ return {
170
+ columnProperty: isTextOnlyArrangement(meta, listReportPage.entitySet, candidate.columnProperty)
171
+ ? undefined
172
+ : candidate.columnProperty,
173
+ textProperty: candidate.textProperty,
174
+ skipTextPropertyTest
175
+ };
176
+ })
169
177
  : [];
170
178
  return {
171
179
  name: listReportPage.name,
@@ -567,43 +575,27 @@ export function isHiddenFilter(convertedMetadata, entitySetName, propertyName) {
567
575
  return property?.annotations?.UI?.HiddenFilter?.valueOf() === true;
568
576
  }
569
577
  /**
570
- * Returns true if the property carries a `@com.sap.vocabularies.UI.v1.TextArrangement`
571
- * annotation nested on its `@com.sap.vocabularies.Common.v1.Text` annotation.
578
+ * Returns true if the property's `UI.TextArrangement` is `TextOnly`, checking both the nested
579
+ * (`Common.Text`) and sibling (property-level) locations. Under `TextOnly` the code property is not
580
+ * sortable, so its sort test must be skipped.
572
581
  *
573
- * @param convertedMetadata - already-converted OData metadata (metadata merged with local annotations)
574
- * @param entitySetName - name of the entity set that owns the property (undefined → false)
575
- * @param propertyName - name of the property to inspect
576
- * @returns true if the property has a text arrangement annotation
577
- */
578
- export function hasTextArrangement(convertedMetadata, entitySetName, propertyName) {
579
- if (!entitySetName) {
580
- return false;
581
- }
582
- const entitySet = convertedMetadata.entitySets.find((es) => es.name === entitySetName);
583
- const property = entitySet?.entityType?.entityProperties?.find((p) => p.name === propertyName);
584
- // TextArrangement is a nested annotation on the Common.Text term (see vocabularies-types Common.Text).
585
- return property?.annotations?.Common?.Text?.annotations?.UI?.TextArrangement !== undefined;
586
- }
587
- /**
588
- * Returns true if the property carries a `@com.sap.vocabularies.UI.v1.Hidden` annotation.
589
- * A hidden property is not exposed as a sortable column in the sort dialog, so it cannot be
590
- * used as a sort target.
591
- *
592
- * @param convertedMetadata - already-converted OData metadata (metadata merged with local annotations)
593
- * @param entitySetName - name of the entity set that owns the property (undefined → false)
594
- * @param propertyName - name of the property to inspect
595
- * @returns true if the property is hidden
582
+ * @param convertedMetadata - converted OData metadata (metadata merged with local annotations)
583
+ * @param entitySetName - entity set owning the property (undefined → false)
584
+ * @param propertyName - property to inspect
585
+ * @returns true if the text arrangement is TextOnly
596
586
  */
597
- export function isHiddenProperty(convertedMetadata, entitySetName, propertyName) {
587
+ export function isTextOnlyArrangement(convertedMetadata, entitySetName, propertyName) {
598
588
  if (!entitySetName) {
599
589
  return false;
600
590
  }
601
591
  const entitySet = convertedMetadata.entitySets.find((es) => es.name === entitySetName);
602
592
  const property = entitySet?.entityType?.entityProperties?.find((p) => p.name === propertyName);
603
- // The converted `@UI.Hidden` value is a Boolean wrapper object (it carries annotation metadata),
604
- // so it is always truthy — coerce via `valueOf()` to read the underlying boolean and treat an
605
- // explicit `Hidden: false` as not hidden.
606
- return property?.annotations?.UI?.Hidden?.valueOf() === true;
593
+ // The converter also populates TextArrangement as a property-level sibling of Common.Text, a
594
+ // shape vocabularies-types does not declare — hence the indexed access.
595
+ const siblingArrangement = property?.annotations?.UI?.['TextArrangement'];
596
+ const textArrangement = property?.annotations?.Common?.Text?.annotations?.UI?.TextArrangement ?? siblingArrangement;
597
+ // The converted enum value stringifies to e.g. "UI.TextArrangementType/TextOnly".
598
+ return textArrangement !== undefined && String(textArrangement).endsWith('/TextOnly');
607
599
  }
608
600
  /**
609
601
  * Checks the state of action buttons defined in UI.LineItem annotations for a given entity set.
@@ -196,13 +196,15 @@ export function extractTextAnnotationColumnsFromNode(node) {
196
196
  }
197
197
  const columnItems = getAggregations(columnsAggregation);
198
198
  const candidates = [];
199
- const seenTextProperties = new Set();
199
+ const seenColumnProperties = new Set();
200
200
  Object.entries(columnItems).forEach(([columnKey, column]) => {
201
201
  if (!isDefaultAvailableColumn(column)) {
202
202
  return;
203
203
  }
204
204
  const text = column.properties?.text;
205
- if (text?.artifactType !== 'Annotation' || !text.value || text.value === 'none') {
205
+ // The spec model uses the sentinel value "None" (any casing) to mean "no text annotation is
206
+ // maintained" — such columns must not produce a sort test.
207
+ if (text?.artifactType !== 'Annotation' || !text.value || text.value.toLowerCase() === 'none') {
206
208
  return;
207
209
  }
208
210
  // A text target reached through a navigation property (e.g. "_DunningProcedure/DunningProcedure_Text")
@@ -211,10 +213,11 @@ export function extractTextAnnotationColumnsFromNode(node) {
211
213
  return;
212
214
  }
213
215
  const columnProperty = getColumnIdentifier(column, columnKey);
214
- if (!columnProperty || seenTextProperties.has(text.value)) {
216
+ // Deduplicate by code column: distinct columns may share one text target.
217
+ if (!columnProperty || seenColumnProperties.has(columnProperty)) {
215
218
  return;
216
219
  }
217
- seenTextProperties.add(text.value);
220
+ seenColumnProperties.add(columnProperty);
218
221
  candidates.push({ columnProperty, textProperty: text.value });
219
222
  });
220
223
  return candidates;
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.16.1",
4
+ "version": "1.16.3",
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.22",
31
- "@sap-ux/logger": "1.0.3",
32
31
  "@sap-ux/ui5-application-writer": "2.1.5",
33
- "@sap-ux/preview-middleware": "1.2.24",
34
- "@sap-ux/fiori-generator-shared": "1.2.19",
35
- "@sap-ux/project-access": "2.2.2"
32
+ "@sap-ux/logger": "1.0.3",
33
+ "@sap-ux/fiori-generator-shared": "1.2.20",
34
+ "@sap-ux/project-access": "2.3.0",
35
+ "@sap-ux/preview-middleware": "1.2.25"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@jest/globals": "30.4.1",
@@ -17,9 +17,8 @@
17
17
 
18
18
  sap.ui.define([
19
19
  "sap/ui/test/opaQunit",
20
- "./pages/JourneyRunner"<% if (textAnnotationColumns && textAnnotationColumns.length > 0) { %>,
21
- "sap/ui/core/library"<% } %>
22
- ], function (opaTest, runner<% if (textAnnotationColumns && textAnnotationColumns.length > 0) { %>, coreLibrary<% } %>) {
20
+ "./pages/JourneyRunner"
21
+ ], function (opaTest, runner) {
23
22
  "use strict";
24
23
 
25
24
  function journey() {
@@ -141,14 +140,6 @@ sap.ui.define([
141
140
  <%_ } -%>
142
141
  });
143
142
  <%_ } -%>
144
- <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
145
- opaTest("Check text annotation for columns", function (Given, When, Then) {
146
- <%_ textAnnotationColumns.forEach(function(column) { _%>
147
- When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.textProperty %>" }, coreLibrary.SortOrder.Ascending);
148
- Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- column.textProperty %>" }, coreLibrary.SortOrder.Ascending, true);
149
- <%_ }); -%>
150
- });
151
- <%_ } -%>
152
143
  <%_ } -%>
153
144
 
154
145
  <%_ if (startLR) { -%>
@@ -26,9 +26,6 @@ const toolBarHasMenu = (toolBarActions || []).some(function(item) { return item.
26
26
  import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
27
27
  <% } -%>
28
28
  import runner from "./pages/JourneyRunner";
29
- <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
30
- import { SortOrder } from "sap/ui/core/library";
31
- <%_ } -%>
32
29
 
33
30
  function journey() {
34
31
  QUnit.module("<%- name%>ListReport journey");
@@ -149,14 +146,6 @@ function journey() {
149
146
  <%_ } -%>
150
147
  });
151
148
  <%_ } -%>
152
- <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
153
- opaTest("Check text annotation for columns", function (_Given: Given, When: When, Then: Then) {
154
- <%_ textAnnotationColumns.forEach(function(column) { _%>
155
- When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.textProperty %>" }, SortOrder.Ascending);
156
- Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- column.textProperty %>" }, SortOrder.Ascending, true);
157
- <%_ }); -%>
158
- });
159
- <%_ } -%>
160
149
  <%_ } -%>
161
150
 
162
151
  <%_ if (startLR) { -%>
@@ -17,9 +17,8 @@
17
17
 
18
18
  sap.ui.define([
19
19
  "sap/ui/test/opaQunit",
20
- "./pages/JourneyRunner"<% if (textAnnotationColumns && textAnnotationColumns.length > 0) { %>,
21
- "sap/ui/core/library"<% } %>
22
- ], function (opaTest, runner<% if (textAnnotationColumns && textAnnotationColumns.length > 0) { %>, coreLibrary<% } %>) {
20
+ "./pages/JourneyRunner"
21
+ ], function (opaTest, runner) {
23
22
  "use strict";
24
23
 
25
24
  function journey() {
@@ -99,14 +98,6 @@ sap.ui.define([
99
98
  <%_ } -%>
100
99
  });
101
100
  <%_ } -%>
102
- <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
103
- opaTest("Check text annotation for columns", function (Given, When, Then) {
104
- <%_ textAnnotationColumns.forEach(function(column) { _%>
105
- When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.textProperty %>" }, coreLibrary.SortOrder.Ascending);
106
- Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- column.textProperty %>" }, coreLibrary.SortOrder.Ascending, true);
107
- <%_ }); -%>
108
- });
109
- <%_ } -%>
110
101
 
111
102
  <%_ if (startLR) { -%>
112
103
  opaTest("Navigate to ObjectPage", function (Given, When, Then) {
@@ -25,9 +25,6 @@ const usesFilterFieldIdentifier =
25
25
  import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
26
26
  <% } -%>
27
27
  import runner from "./pages/JourneyRunner";
28
- <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
29
- import { SortOrder } from "sap/ui/core/library";
30
- <%_ } -%>
31
28
 
32
29
  function journey() {
33
30
  QUnit.module("<%- name%>ListReport journey");
@@ -106,14 +103,6 @@ function journey() {
106
103
  <%_ } -%>
107
104
  });
108
105
  <%_ } -%>
109
- <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
110
- opaTest("Check text annotation for columns", function (_Given: Given, When: When, Then: Then) {
111
- <%_ textAnnotationColumns.forEach(function(column) { _%>
112
- When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.textProperty %>" }, SortOrder.Ascending);
113
- Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- column.textProperty %>" }, SortOrder.Ascending, true);
114
- <%_ }); -%>
115
- });
116
- <%_ } -%>
117
106
 
118
107
  <%_ if (startLR) { -%>
119
108
  opaTest("Navigate to ObjectPage", function (_Given: Given, When: When, Then: Then) {
@@ -209,8 +209,16 @@ sap.ui.define([
209
209
  <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
210
210
  opaTest("Check text annotation for columns", function (Given, When, Then) {
211
211
  <%_ textAnnotationColumns.forEach(function(column) { _%>
212
+ <%_ if (column.columnProperty) { _%>
213
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.columnProperty %>" }, coreLibrary.SortOrder.Ascending);
214
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- column.columnProperty %>" }, coreLibrary.SortOrder.Ascending, true);
215
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.columnProperty %>" }, coreLibrary.SortOrder.None);
216
+ <%_ } _%>
217
+ <%_ if (!column.skipTextPropertyTest) { _%>
212
218
  When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.textProperty %>" }, coreLibrary.SortOrder.Ascending);
213
219
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- column.textProperty %>" }, coreLibrary.SortOrder.Ascending, true);
220
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.textProperty %>" }, coreLibrary.SortOrder.None);
221
+ <%_ } _%>
214
222
  <%_ }); -%>
215
223
  });
216
224
  <%_ } -%>
@@ -220,8 +220,16 @@ function journey() {
220
220
  <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
221
221
  opaTest("Check text annotation for columns", function (_Given: Given, When: When, Then: Then) {
222
222
  <%_ textAnnotationColumns.forEach(function(column) { _%>
223
+ <%_ if (column.columnProperty) { _%>
224
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.columnProperty %>" }, SortOrder.Ascending);
225
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- column.columnProperty %>" }, SortOrder.Ascending, true);
226
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.columnProperty %>" }, SortOrder.None);
227
+ <%_ } _%>
228
+ <%_ if (!column.skipTextPropertyTest) { _%>
223
229
  When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.textProperty %>" }, SortOrder.Ascending);
224
230
  Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- column.textProperty %>" }, SortOrder.Ascending, true);
231
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iChangeSortOrder({ name: "<%- column.textProperty %>" }, SortOrder.None);
232
+ <%_ } _%>
225
233
  <%_ }); -%>
226
234
  });
227
235
  <%_ } -%>