@sap-ux/ui5-test-writer 1.15.6 → 1.16.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.
package/dist/types.d.ts CHANGED
@@ -227,6 +227,11 @@ export type ListReportFeatures = {
227
227
  * annotation; used to generate sort-order tests against the text/description property.
228
228
  */
229
229
  textAnnotationColumns?: TextAnnotationColumn[];
230
+ /**
231
+ * Whether the table exposes column personalization (the "Columns" adaptation dialog).
232
+ * Absent/true means enabled (the Fiori elements default).
233
+ */
234
+ columnPersonalizationSupported?: boolean;
230
235
  isALP?: boolean;
231
236
  /**
232
237
  * Non-custom tab keys (`views.paths[].key`) for multi-tab List Reports; empty for
@@ -146,6 +146,15 @@ export declare function getFilterFieldItems(pageModel: TreeModel, log?: Logger):
146
146
  * @returns set of custom filter field property names, empty if none or manifest missing
147
147
  */
148
148
  export declare function getCustomFilterFieldProperties(manifest: Manifest | undefined, targetKey: string | undefined): Set<string>;
149
+ /**
150
+ * Determines whether the List Report table exposes column personalization (the "Columns" adaptation dialog).
151
+ *
152
+ * @param manifest - the application manifest (may be undefined)
153
+ * @param targetKey - routing target key of the List Report page
154
+ * @param contextPath - the page's context path, used to resolve CAP-style prefixed LineItem keys
155
+ * @returns true if the column-adaptation dialog is available for the table
156
+ */
157
+ export declare function isColumnPersonalizationEnabled(manifest: Manifest | undefined, targetKey: string | undefined, contextPath?: string): boolean;
149
158
  /**
150
159
  * Determines the non-custom tab keys for a multi-tab List Report, used to target a specific
151
160
  * table via `onTable("<key>")`. Custom tabs (backed by an app fragment) are skipped as they
@@ -176,6 +176,7 @@ export function getListReportFeatures(listReportPage, log, metadata, manifest, r
176
176
  contactCardColumns: extractContactCardColumnsFromNode(listReportPage.model.root),
177
177
  toolBarActions,
178
178
  textAnnotationColumns,
179
+ columnPersonalizationSupported: isColumnPersonalizationEnabled(manifest, listReportPage.name, listReportPage.contextPath),
179
180
  isALP: manifest ? isALPFromManifest(manifest, listReportPage.name) : false,
180
181
  tableIdentifiers: getTableIdentifiers(manifest, listReportPage.name),
181
182
  tabs: getListReportTabs(listReportPage, convertedMetadata, manifest, resolveLabel, log),
@@ -395,6 +396,69 @@ export function getCustomFilterFieldProperties(manifest, targetKey) {
395
396
  }
396
397
  return custom;
397
398
  }
399
+ /**
400
+ * Finds the LineItem control-configuration entry for the default table.
401
+ *
402
+ * @param controlConfiguration - the target's `options.settings.controlConfiguration`
403
+ * @param contextPath - the page's context path (e.g. `/Travel`), used to match CAP-style prefixed keys
404
+ * @returns the matched LineItem control-configuration value, or undefined if it cannot be identified
405
+ */
406
+ function findDefaultTableLineItemConfig(controlConfiguration, contextPath) {
407
+ const lineItemTerm = '@com.sap.vocabularies.UI.v1.LineItem';
408
+ const isLineItemKey = (key) => {
409
+ const segment = key.substring(key.lastIndexOf('/') + 1);
410
+ return segment === lineItemTerm || segment.startsWith(`${lineItemTerm}#`);
411
+ };
412
+ const lineItemKeys = Object.keys(controlConfiguration).filter(isLineItemKey);
413
+ let key;
414
+ if (lineItemKeys.length === 1) {
415
+ key = lineItemKeys[0];
416
+ }
417
+ else if (contextPath) {
418
+ // Multiple LineItem keys: only resolve when exactly one is scoped to this page's context path.
419
+ const bareUnderContext = `${contextPath}/${lineItemTerm}`;
420
+ if (controlConfiguration[bareUnderContext]) {
421
+ key = bareUnderContext;
422
+ }
423
+ else {
424
+ const underContext = lineItemKeys.filter((candidate) => candidate.startsWith(`${contextPath}/`));
425
+ key = underContext.length === 1 ? underContext[0] : undefined;
426
+ }
427
+ }
428
+ return key
429
+ ? controlConfiguration[key]
430
+ : undefined;
431
+ }
432
+ /**
433
+ * Determines whether the List Report table exposes column personalization (the "Columns" adaptation dialog).
434
+ *
435
+ * @param manifest - the application manifest (may be undefined)
436
+ * @param targetKey - routing target key of the List Report page
437
+ * @param contextPath - the page's context path, used to resolve CAP-style prefixed LineItem keys
438
+ * @returns true if the column-adaptation dialog is available for the table
439
+ */
440
+ export function isColumnPersonalizationEnabled(manifest, targetKey, contextPath) {
441
+ if (!manifest || !targetKey) {
442
+ return true;
443
+ }
444
+ const target = manifest['sap.ui5']?.routing?.targets?.[targetKey];
445
+ const controlConfiguration = target?.options?.settings?.controlConfiguration;
446
+ if (!controlConfiguration || typeof controlConfiguration !== 'object') {
447
+ return true;
448
+ }
449
+ const lineItemConfig = findDefaultTableLineItemConfig(controlConfiguration, contextPath);
450
+ const personalization = lineItemConfig?.tableSettings?.personalization;
451
+ if (personalization === undefined) {
452
+ return true;
453
+ }
454
+ if (typeof personalization === 'boolean') {
455
+ return personalization;
456
+ }
457
+ if (typeof personalization === 'object' && personalization !== null) {
458
+ return personalization.column === true;
459
+ }
460
+ return true;
461
+ }
398
462
  /**
399
463
  * Determines the non-custom tab keys for a multi-tab List Report, used to target a specific
400
464
  * table via `onTable("<key>")`. Custom tabs (backed by an app fragment) are skipped as they
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.15.6",
4
+ "version": "1.16.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -29,10 +29,10 @@
29
29
  "@sap-ux/edmx-parser": "0.10.0",
30
30
  "@sap-ux/annotation-converter": "0.10.22",
31
31
  "@sap-ux/ui5-application-writer": "2.1.5",
32
- "@sap-ux/fiori-generator-shared": "1.2.19",
33
- "@sap-ux/preview-middleware": "1.2.23",
34
32
  "@sap-ux/logger": "1.0.3",
35
- "@sap-ux/project-access": "2.2.2"
33
+ "@sap-ux/fiori-generator-shared": "1.2.19",
34
+ "@sap-ux/project-access": "2.2.2",
35
+ "@sap-ux/preview-middleware": "1.2.23"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@jest/globals": "30.4.1",
@@ -49,11 +49,11 @@ sap.ui.define([
49
49
  <%_ } -%>
50
50
  <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
51
51
  opaTest("Add semantic key properties to filter bar", function (Given, When, Then) {
52
- When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
52
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation()
53
53
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
54
- When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
54
+ .and.iAddAdaptationFilterField({ property: "<%- property %>" })
55
55
  <%_ }); -%>
56
- When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
56
+ .and.iConfirmFilterAdaptation();
57
57
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
58
58
  Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
59
59
  <%_ }); -%>
@@ -57,11 +57,11 @@ function journey() {
57
57
  <%_ } -%>
58
58
  <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
59
59
  opaTest("Add semantic key properties to filter bar", function (_Given: Given, When: When, Then: Then) {
60
- When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
60
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation()
61
61
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
62
- When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
62
+ .and.iAddAdaptationFilterField({ property: "<%- property %>" })
63
63
  <%_ }); -%>
64
- When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
64
+ .and.iConfirmFilterAdaptation();
65
65
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
66
66
  Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
67
67
  <%_ }); -%>
@@ -49,11 +49,11 @@ sap.ui.define([
49
49
  <%_ } -%>
50
50
  <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
51
51
  opaTest("Add semantic key properties to filter bar", function (Given, When, Then) {
52
- When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
52
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation()
53
53
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
54
- When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
54
+ .and.iAddAdaptationFilterField({ property: "<%- property %>" })
55
55
  <%_ }); -%>
56
- When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
56
+ .and.iConfirmFilterAdaptation();
57
57
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
58
58
  Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
59
59
  <%_ }); -%>
@@ -214,6 +214,16 @@ sap.ui.define([
214
214
  <%_ }); -%>
215
215
  });
216
216
  <%_ } -%>
217
+ <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0 && columnPersonalizationSupported !== false) { -%>
218
+ opaTest("Check columns in adaptation dialog", function (Given, When, Then) {
219
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iOpenColumnAdaptation();
220
+ <%_ textAnnotationColumns.forEach(function(column) { _%>
221
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iAddAdaptationColumn({ name: "<%- column.textProperty %>" });
222
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAdaptationColumn({ name: "<%- column.textProperty %>" });
223
+ <%_ }); -%>
224
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iConfirmColumnAdaptation();
225
+ });
226
+ <%_ } -%>
217
227
 
218
228
  <%_ if (contactCardColumns.length > 0) { -%>
219
229
  opaTest("Check contact card links", function (Given, When, Then) {
@@ -61,11 +61,11 @@ function journey() {
61
61
  <%_ } -%>
62
62
  <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
63
63
  opaTest("Add semantic key properties to filter bar", function (_Given: Given, When: When, Then: Then) {
64
- When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
64
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation()
65
65
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
66
- When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
66
+ .and.iAddAdaptationFilterField({ property: "<%- property %>" })
67
67
  <%_ }); -%>
68
- When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
68
+ .and.iConfirmFilterAdaptation();
69
69
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
70
70
  Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
71
71
  <%_ }); -%>
@@ -225,6 +225,16 @@ function journey() {
225
225
  <%_ }); -%>
226
226
  });
227
227
  <%_ } -%>
228
+ <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0 && columnPersonalizationSupported !== false) { -%>
229
+ opaTest("Check columns in adaptation dialog", function (_Given: Given, When: When, Then: Then) {
230
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iOpenColumnAdaptation();
231
+ <%_ textAnnotationColumns.forEach(function(column) { _%>
232
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iAddAdaptationColumn({ name: "<%- column.textProperty %>" });
233
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAdaptationColumn({ name: "<%- column.textProperty %>" });
234
+ <%_ }); -%>
235
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iConfirmColumnAdaptation();
236
+ });
237
+ <%_ } -%>
228
238
 
229
239
  <%_ if (contactCardColumns.length > 0) { -%>
230
240
  opaTest("Check contact card links", function (_Given: Given, When: When, Then: Then) {
@@ -49,11 +49,11 @@ sap.ui.define([
49
49
  <%_ } -%>
50
50
  <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
51
51
  opaTest("Add semantic key properties to filter bar", function (Given, When, Then) {
52
- When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
52
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation()
53
53
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
54
- When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
54
+ .and.iAddAdaptationFilterField({ property: "<%- property %>" })
55
55
  <%_ }); -%>
56
- When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
56
+ .and.iConfirmFilterAdaptation();
57
57
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
58
58
  Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
59
59
  <%_ }); -%>
@@ -56,11 +56,11 @@ function journey() {
56
56
  <%_ } -%>
57
57
  <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
58
58
  opaTest("Add semantic key properties to filter bar", function (_Given: Given, When: When, Then: Then) {
59
- When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
59
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation()
60
60
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
61
- When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
61
+ .and.iAddAdaptationFilterField({ property: "<%- property %>" })
62
62
  <%_ }); -%>
63
- When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
63
+ .and.iConfirmFilterAdaptation();
64
64
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
65
65
  Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
66
66
  <%_ }); -%>
@@ -49,11 +49,11 @@ sap.ui.define([
49
49
  <%_ } -%>
50
50
  <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
51
51
  opaTest("Add semantic key properties to filter bar", function (Given, When, Then) {
52
- When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
52
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation()
53
53
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
54
- When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
54
+ .and.iAddAdaptationFilterField({ property: "<%- property %>" })
55
55
  <%_ }); -%>
56
- When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
56
+ .and.iConfirmFilterAdaptation();
57
57
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
58
58
  Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
59
59
  <%_ }); -%>
@@ -214,6 +214,16 @@ sap.ui.define([
214
214
  <%_ }); -%>
215
215
  });
216
216
  <%_ } -%>
217
+ <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0 && columnPersonalizationSupported !== false) { -%>
218
+ opaTest("Check columns in adaptation dialog", function (Given, When, Then) {
219
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iOpenColumnAdaptation();
220
+ <%_ textAnnotationColumns.forEach(function(column) { _%>
221
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iAddAdaptationColumn({ name: "<%- column.textProperty %>" });
222
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAdaptationColumn({ name: "<%- column.textProperty %>" });
223
+ <%_ }); -%>
224
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iConfirmColumnAdaptation();
225
+ });
226
+ <%_ } -%>
217
227
 
218
228
  <%_ if (contactCardColumns.length > 0) { -%>
219
229
  opaTest("Check contact card links", function (Given, When, Then) {
@@ -61,11 +61,11 @@ function journey() {
61
61
  <%_ } -%>
62
62
  <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
63
63
  opaTest("Add semantic key properties to filter bar", function (_Given: Given, When: When, Then: Then) {
64
- When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
64
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation()
65
65
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
66
- When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
66
+ .and.iAddAdaptationFilterField({ property: "<%- property %>" })
67
67
  <%_ }); -%>
68
- When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
68
+ .and.iConfirmFilterAdaptation();
69
69
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
70
70
  Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
71
71
  <%_ }); -%>
@@ -225,6 +225,16 @@ function journey() {
225
225
  <%_ }); -%>
226
226
  });
227
227
  <%_ } -%>
228
+ <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0 && columnPersonalizationSupported !== false) { -%>
229
+ opaTest("Check columns in adaptation dialog", function (_Given: Given, When: When, Then: Then) {
230
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iOpenColumnAdaptation();
231
+ <%_ textAnnotationColumns.forEach(function(column) { _%>
232
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iAddAdaptationColumn({ name: "<%- column.textProperty %>" });
233
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAdaptationColumn({ name: "<%- column.textProperty %>" });
234
+ <%_ }); -%>
235
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iConfirmColumnAdaptation();
236
+ });
237
+ <%_ } -%>
228
238
 
229
239
  <%_ if (contactCardColumns.length > 0) { -%>
230
240
  opaTest("Check contact card links", function (_Given: Given, When: When, Then: Then) {