@sap-ux/ui5-test-writer 1.2.27 → 1.2.29

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.
@@ -10,7 +10,8 @@
10
10
  "warn": {
11
11
  "cannotUpdateJourneyRunner": "Could not update `JourneyRunner.js`. The existing file may be missing or unreadable. New pages were not registered.",
12
12
  "cannotUpdateOpaTestsQunit": "Could not update `opaTests.qunit.js`. The existing file may be missing or unreadable. New journey paths were not registered.",
13
- "cannotUpdateOpaJourneyTypes": "Could not update `OpaJourneyTypes.d.ts`. The existing file may be missing or unreadable. New journey type definitions were not registered."
13
+ "cannotUpdateOpaJourneyTypes": "Could not update `OpaJourneyTypes.d.ts`. The existing file may be missing or unreadable. New journey type definitions were not registered.",
14
+ "noFilterFieldTests": "Unable to extract filter fields from the project model using specification. No filter field tests are generated."
14
15
  },
15
16
  "info": {
16
17
  "opaJourneyTypesNotUpdated": "`OpaJourneyTypes.d.ts` was not updated due to an incompatible existing test setup.",
package/dist/types.d.ts CHANGED
@@ -107,6 +107,7 @@ export type ObjectPageNavigationParent = {
107
107
  };
108
108
  export type ObjectPageNavigationParents = {
109
109
  parentLRName?: string;
110
+ parentLRTableIdentifier?: string;
110
111
  parentOPs: ObjectPageNavigationParent[];
111
112
  };
112
113
  export type SectionFormField = {
@@ -150,6 +151,15 @@ export type ObjectPageFeatures = {
150
151
  headerActions?: ActionButtonState[];
151
152
  editButton?: ButtonState;
152
153
  };
154
+ /**
155
+ * Filter bar item consumed by the List Report journey template. Custom filter fields fall
156
+ * back to their (translatable) label, so `custom` selects the label vs. `{ property }` form.
157
+ */
158
+ export type FilterBarItem = {
159
+ property: string;
160
+ description: string;
161
+ custom: boolean;
162
+ };
153
163
  export type ListReportFeatures = {
154
164
  name?: string;
155
165
  createButton?: {
@@ -162,10 +172,15 @@ export type ListReportFeatures = {
162
172
  visible?: boolean;
163
173
  dynamicPath?: string;
164
174
  };
165
- filterBarItems?: string[];
175
+ filterBarItems?: FilterBarItem[];
166
176
  tableColumns?: Record<string, Record<string, string | number | boolean>>;
167
177
  toolBarActions?: ActionButtonState[];
168
178
  isALP?: boolean;
179
+ /**
180
+ * Non-custom tab keys (`views.paths[].key`) for multi-tab List Reports; empty for
181
+ * single-table LRs. Used to target a specific tab via `onTable("<key>")`.
182
+ */
183
+ tableIdentifiers?: string[];
169
184
  semanticKey?: {
170
185
  semanticKeyProperties?: string[];
171
186
  missingFromFilterBar?: string[];
@@ -174,8 +189,8 @@ export type ListReportFeatures = {
174
189
  export interface ActionButtonState {
175
190
  label: string;
176
191
  /**
177
- * For List Report actions: the full OData binding path (e.g. "namespace.ActionName(entityType=@odata.context)").
178
- * For Object Page actions extracted from the spec model: the method name only (e.g. "Copy").
192
+ * Action method name only (e.g. `"SetToBooked"`). Used as the `action` field of
193
+ * `ActionIdentifier` in `iCheckAction({ service, action, unbound })`.
179
194
  */
180
195
  action: string;
181
196
  visible: boolean;
@@ -197,12 +212,12 @@ export interface ActionButtonState {
197
212
  invocationGrouping?: string;
198
213
  /**
199
214
  * OData schema namespace used as the `service` parameter in iCheckAction({ service, action, unbound }).
200
- * Populated for Object Page actions extracted via the spec model + metadata.
215
+ * Populated for both List Report and Object Page actions extracted via metadata.
201
216
  */
202
217
  service?: string;
203
218
  /**
204
219
  * Whether the action is unbound (not bound to a specific entity instance).
205
- * Populated for Object Page actions extracted via the spec model + metadata.
220
+ * Populated for both List Report and Object Page actions extracted via metadata.
206
221
  */
207
222
  unbound?: boolean;
208
223
  }
@@ -106,7 +106,9 @@ export function buildActionButtonState(item, metadata) {
106
106
  const { enabled, dynamicPath } = analyzeOperationAvailability(operationAvailable, isEntityBound);
107
107
  return {
108
108
  label: item.Label || '',
109
- action: actionString,
109
+ action: actionMethod,
110
+ service: metadata.namespace ?? '',
111
+ unbound: !isEntityBound,
110
112
  visible: true,
111
113
  enabled,
112
114
  dynamicPath,
@@ -79,6 +79,70 @@ export declare function getToolBarActions(pageModel: TreeModel): TreeAggregation
79
79
  * @returns - an array of filter field names
80
80
  */
81
81
  export declare function getFilterFieldNames(pageModel: TreeModel, log?: Logger): string[];
82
+ /**
83
+ * Retrieves filter field property names paired with their translated labels from the page model.
84
+ *
85
+ * Used by the List Report path where custom filter fields must be matched by label rather
86
+ * than by property, because their control ids do not follow the standard filter-field pattern.
87
+ *
88
+ * @param pageModel - the tree model containing filter bar definitions
89
+ * @param log - optional logger instance
90
+ * @returns - an array of `{ property, description }` entries
91
+ */
92
+ export declare function getFilterFieldItems(pageModel: TreeModel, log?: Logger): {
93
+ property: string;
94
+ description: string;
95
+ }[];
96
+ /**
97
+ * Extracts the property names of custom filter fields declared in the manifest.
98
+ *
99
+ * Custom filter fields render with a non-standard control id and so cannot be matched by
100
+ * `iCheckFilterField({ property })`; callers fall back to matching them by label instead.
101
+ *
102
+ * @param manifest - the application manifest (may be undefined)
103
+ * @param targetKey - routing target key of the List Report page
104
+ * @returns set of custom filter field property names, empty if none or manifest missing
105
+ */
106
+ export declare function getCustomFilterFieldProperties(manifest: Manifest | undefined, targetKey: string | undefined): Set<string>;
107
+ /**
108
+ * Determines the non-custom tab keys for a multi-tab List Report, used to target a specific
109
+ * table via `onTable("<key>")`. Custom tabs (backed by an app fragment) are skipped as they
110
+ * typically host no queryable table.
111
+ *
112
+ * Returns an empty array for single-table List Reports, where `onTable()` resolves the table
113
+ * without a tab id.
114
+ *
115
+ * @param manifest - the application manifest (may be undefined)
116
+ * @param targetKey - routing target key of the List Report page
117
+ * @returns array of non-custom tab keys in manifest order, empty for single-table LRs
118
+ */
119
+ export declare function getTableIdentifiers(manifest: Manifest | undefined, targetKey: string | undefined): string[];
120
+ /**
121
+ * Retrieves the value of `@com.sap.vocabularies.Common.v1.Label` for a specific property
122
+ * of the given entity set.
123
+ *
124
+ * Used as a fallback label source for custom filter fields whose manifest-declared label
125
+ * is an unresolved i18n placeholder (e.g. `{i18n>Foo}`).
126
+ *
127
+ * @param convertedMetadata - already-converted OData metadata
128
+ * @param entitySetName - name of the entity set that owns the property
129
+ * @param propertyName - name of the property whose label should be read
130
+ * @returns the label string, or undefined if not found
131
+ */
132
+ export declare function getPropertyLabelFromMetadata(convertedMetadata: ConvertedMetadata, entitySetName: string, propertyName: string): string | undefined;
133
+ /**
134
+ * Returns true if the property is annotated with `@com.sap.vocabularies.UI.v1.HiddenFilter`.
135
+ *
136
+ * Properties with this annotation are excluded from the user's filter adaptation dialog.
137
+ * Attempting to add them at runtime via `iAddAdaptationFilterField({ property })` fails
138
+ * because the field is never offered by the dialog.
139
+ *
140
+ * @param convertedMetadata - already-converted OData metadata
141
+ * @param entitySetName - name of the entity set that owns the property (undefined → false)
142
+ * @param propertyName - name of the property to inspect
143
+ * @returns true if the property is hidden from the filter adaptation dialog
144
+ */
145
+ export declare function isHiddenFilter(convertedMetadata: ConvertedMetadata, entitySetName: string | undefined, propertyName: string): boolean;
82
146
  /**
83
147
  * Checks the state of action buttons defined in UI.LineItem annotations for a given entity set.
84
148
  *
@@ -130,7 +194,7 @@ export declare function isSemanticKeyInFilterBar(pageModel: TreeModel, metadataX
130
194
  *
131
195
  * @param convertedMetadata - The already-converted OData metadata
132
196
  * @param entitySetName - The name of the entity set to inspect
133
- * @param resolveLabels - when true, each property name is replaced with its Common.Label value (falls back to the property name when no label is defined). Use this when comparing against getFilterFieldNames(), which also returns labels.
197
+ * @param resolveLabels - when true, each property name is replaced with its Common.Label value (falling back to the property name); default false
134
198
  * @returns An array of PropertyPath string values (or their labels) from the SemanticKey annotation, or an empty array if not found
135
199
  * @throws {Error} If the entity set is not found
136
200
  */
@@ -141,7 +205,7 @@ export declare function getSemanticKeyPropertiesFromMetadata(convertedMetadata:
141
205
  *
142
206
  * @param metadataXml - The OData metadata XML content as a string
143
207
  * @param entitySetName - The name of the entity set to inspect
144
- * @param resolveLabels - when true, each property name is replaced with its Common.Label value (falls back to the property name when no label is defined). Use this when comparing against getFilterFieldNames(), which also returns labels.
208
+ * @param resolveLabels - when true, each property name is replaced with its Common.Label value (falling back to the property name); default false
145
209
  * @returns An array of PropertyPath string values (or their labels) from the SemanticKey annotation, or an empty array if not found
146
210
  * @throws {Error} If the metadata cannot be parsed or the entity set is not found
147
211
  */
@@ -1,7 +1,8 @@
1
- import { getFilterFields, getSelectionFieldItems, getTableColumnData, getAggregations } from './modelUtils.js';
1
+ import { getFilterFields, getSelectionFieldItems, getSelectionFieldItemsWithLabels, getTableColumnData, getAggregations } from './modelUtils.js';
2
2
  import { parse } from '@sap-ux/edmx-parser';
3
3
  import { convert } from '@sap-ux/annotation-converter';
4
4
  import { extractActionMethodName, buildActionButtonState, safeCheckButtonVisibility, safeCheckButtonVisibilityFromMetadata } from './actionUtils.js';
5
+ import { t } from '../i18n.js';
5
6
  export { checkButtonVisibility, safeCheckEditVisibility } from './actionUtils.js';
6
7
  export { safeCheckButtonVisibility };
7
8
  /**
@@ -45,7 +46,7 @@ export function safeCheckActionButtonStates(convertedMetadata, entitySetName, ac
45
46
  */
46
47
  export function safeGetSemanticKeyProperties(convertedMetadata, entitySetName, log) {
47
48
  try {
48
- return getSemanticKeyPropertiesFromMetadata(convertedMetadata, entitySetName, true);
49
+ return getSemanticKeyPropertiesFromMetadata(convertedMetadata, entitySetName, false);
49
50
  }
50
51
  catch (error) {
51
52
  log?.debug(`Failed to get semantic key properties: ${error instanceof Error ? error.message : String(error)}`);
@@ -92,14 +93,16 @@ export function isALPFromManifest(manifest, targetKey) {
92
93
  */
93
94
  export function getListReportFeatures(listReportPage, log, metadata, manifest) {
94
95
  const toolbarActions = getToolBarActionNames(listReportPage.model, log);
95
- const filterBarItems = getFilterFieldNames(listReportPage.model, log);
96
+ const filterFieldEntries = getFilterFieldItems(listReportPage.model, log);
97
+ const customFilterFieldProperties = getCustomFilterFieldProperties(manifest, listReportPage.name);
96
98
  let buttonVisibility;
97
99
  let semanticKeyProperties;
98
100
  let toolBarActions = [];
101
+ let convertedMetadata;
99
102
  if (metadata && listReportPage.entitySet) {
100
103
  const entitySetName = listReportPage.entitySet;
101
104
  try {
102
- const convertedMetadata = convert(parse(metadata));
105
+ convertedMetadata = convert(parse(metadata));
103
106
  buttonVisibility = safeCheckButtonVisibilityFromMetadata(convertedMetadata, entitySetName, log);
104
107
  semanticKeyProperties = safeGetSemanticKeyProperties(convertedMetadata, entitySetName, log);
105
108
  toolBarActions = safeCheckActionButtonStates(convertedMetadata, entitySetName, toolbarActions, log);
@@ -108,8 +111,29 @@ export function getListReportFeatures(listReportPage, log, metadata, manifest) {
108
111
  log?.debug(`Failed to parse metadata: ${error instanceof Error ? error.message : String(error)}`);
109
112
  }
110
113
  }
111
- const missingKeys = semanticKeyProperties?.length && filterBarItems.length
112
- ? semanticKeyProperties.filter((key) => !filterBarItems.includes(key))
114
+ // Custom filter fields are matched by rendered label, so resolve unresolved i18n
115
+ // placeholders via the property's OData `@Common.Label`.
116
+ const filterBarItems = filterFieldEntries.map((entry) => {
117
+ const custom = customFilterFieldProperties.has(entry.property);
118
+ let description = entry.description;
119
+ if (custom &&
120
+ typeof description === 'string' &&
121
+ description.startsWith('{i18n>') &&
122
+ convertedMetadata &&
123
+ listReportPage.entitySet) {
124
+ const resolved = getPropertyLabelFromMetadata(convertedMetadata, listReportPage.entitySet, entry.property);
125
+ if (resolved) {
126
+ description = resolved;
127
+ }
128
+ }
129
+ return { property: entry.property, description, custom };
130
+ });
131
+ const filterBarProperties = filterBarItems.map((item) => item.property);
132
+ const missingKeys = semanticKeyProperties?.length && filterBarProperties.length
133
+ ? semanticKeyProperties
134
+ .filter((key) => !filterBarProperties.includes(key))
135
+ // `@UI.HiddenFilter` properties cannot be added via the adaptation dialog; skip the check when metadata is missing.
136
+ .filter((key) => !convertedMetadata || !isHiddenFilter(convertedMetadata, listReportPage.entitySet, key))
113
137
  : undefined;
114
138
  return {
115
139
  name: listReportPage.name,
@@ -119,6 +143,7 @@ export function getListReportFeatures(listReportPage, log, metadata, manifest) {
119
143
  tableColumns: getTableColumnData(listReportPage.model, log),
120
144
  toolBarActions,
121
145
  isALP: manifest ? isALPFromManifest(manifest, listReportPage.name) : false,
146
+ tableIdentifiers: getTableIdentifiers(manifest, listReportPage.name),
122
147
  semanticKey: {
123
148
  semanticKeyProperties,
124
149
  missingFromFilterBar: missingKeys?.length ? missingKeys : undefined
@@ -157,10 +182,144 @@ export function getFilterFieldNames(pageModel, log) {
157
182
  log?.debug(error);
158
183
  }
159
184
  if (!filterBarItems?.length) {
160
- log?.warn('Unable to extract filter fields from project model using specification. No filter field tests will be generated.');
185
+ log?.warn(t('warn.noFilterFieldTests'));
186
+ }
187
+ return filterBarItems;
188
+ }
189
+ /**
190
+ * Retrieves filter field property names paired with their translated labels from the page model.
191
+ *
192
+ * Used by the List Report path where custom filter fields must be matched by label rather
193
+ * than by property, because their control ids do not follow the standard filter-field pattern.
194
+ *
195
+ * @param pageModel - the tree model containing filter bar definitions
196
+ * @param log - optional logger instance
197
+ * @returns - an array of `{ property, description }` entries
198
+ */
199
+ export function getFilterFieldItems(pageModel, log) {
200
+ let filterBarItems = [];
201
+ try {
202
+ const filterBarAggregations = getFilterFields(pageModel);
203
+ filterBarItems = getSelectionFieldItemsWithLabels(filterBarAggregations);
204
+ }
205
+ catch (error) {
206
+ log?.debug(error);
207
+ }
208
+ if (!filterBarItems.length) {
209
+ log?.warn(t('warn.noFilterFieldTests'));
161
210
  }
162
211
  return filterBarItems;
163
212
  }
213
+ /**
214
+ * Extracts the property names of custom filter fields declared in the manifest.
215
+ *
216
+ * Custom filter fields render with a non-standard control id and so cannot be matched by
217
+ * `iCheckFilterField({ property })`; callers fall back to matching them by label instead.
218
+ *
219
+ * @param manifest - the application manifest (may be undefined)
220
+ * @param targetKey - routing target key of the List Report page
221
+ * @returns set of custom filter field property names, empty if none or manifest missing
222
+ */
223
+ export function getCustomFilterFieldProperties(manifest, targetKey) {
224
+ const custom = new Set();
225
+ if (!manifest || !targetKey) {
226
+ return custom;
227
+ }
228
+ const target = manifest['sap.ui5']?.routing?.targets?.[targetKey];
229
+ const controlConfiguration = target?.options?.settings?.controlConfiguration;
230
+ if (!controlConfiguration || typeof controlConfiguration !== 'object') {
231
+ return custom;
232
+ }
233
+ const selectionFieldsConfig = controlConfiguration['@com.sap.vocabularies.UI.v1.SelectionFields'];
234
+ const filterFields = selectionFieldsConfig?.filterFields;
235
+ if (!filterFields || typeof filterFields !== 'object') {
236
+ return custom;
237
+ }
238
+ for (const [property, config] of Object.entries(filterFields)) {
239
+ if (config && typeof config === 'object' && typeof config.template === 'string' && config.template.length > 0) {
240
+ custom.add(property);
241
+ }
242
+ }
243
+ return custom;
244
+ }
245
+ /**
246
+ * Determines the non-custom tab keys for a multi-tab List Report, used to target a specific
247
+ * table via `onTable("<key>")`. Custom tabs (backed by an app fragment) are skipped as they
248
+ * typically host no queryable table.
249
+ *
250
+ * Returns an empty array for single-table List Reports, where `onTable()` resolves the table
251
+ * without a tab id.
252
+ *
253
+ * @param manifest - the application manifest (may be undefined)
254
+ * @param targetKey - routing target key of the List Report page
255
+ * @returns array of non-custom tab keys in manifest order, empty for single-table LRs
256
+ */
257
+ export function getTableIdentifiers(manifest, targetKey) {
258
+ if (!manifest || !targetKey) {
259
+ return [];
260
+ }
261
+ const target = manifest['sap.ui5']?.routing?.targets?.[targetKey];
262
+ const paths = target?.options?.settings?.views?.paths;
263
+ if (!Array.isArray(paths) || paths.length === 0) {
264
+ return [];
265
+ }
266
+ const identifiers = [];
267
+ for (const path of paths) {
268
+ if (path &&
269
+ typeof path.key === 'string' &&
270
+ path.key.length > 0 &&
271
+ !(typeof path.template === 'string' && path.template.length > 0)) {
272
+ identifiers.push(path.key);
273
+ }
274
+ }
275
+ // A single non-custom tab needs no tab-targeting; treat it like a single-table List Report.
276
+ if (identifiers.length <= 1) {
277
+ return [];
278
+ }
279
+ return identifiers;
280
+ }
281
+ /**
282
+ * Retrieves the value of `@com.sap.vocabularies.Common.v1.Label` for a specific property
283
+ * of the given entity set.
284
+ *
285
+ * Used as a fallback label source for custom filter fields whose manifest-declared label
286
+ * is an unresolved i18n placeholder (e.g. `{i18n>Foo}`).
287
+ *
288
+ * @param convertedMetadata - already-converted OData metadata
289
+ * @param entitySetName - name of the entity set that owns the property
290
+ * @param propertyName - name of the property whose label should be read
291
+ * @returns the label string, or undefined if not found
292
+ */
293
+ export function getPropertyLabelFromMetadata(convertedMetadata, entitySetName, propertyName) {
294
+ const entitySet = convertedMetadata.entitySets.find((es) => es.name === entitySetName);
295
+ const property = entitySet?.entityType?.entityProperties?.find((p) => p.name === propertyName);
296
+ const label = property?.annotations?.Common?.Label;
297
+ const labelStr = label !== undefined && label !== null ? String(label) : '';
298
+ return labelStr.length > 0 ? labelStr : undefined;
299
+ }
300
+ /**
301
+ * Returns true if the property is annotated with `@com.sap.vocabularies.UI.v1.HiddenFilter`.
302
+ *
303
+ * Properties with this annotation are excluded from the user's filter adaptation dialog.
304
+ * Attempting to add them at runtime via `iAddAdaptationFilterField({ property })` fails
305
+ * because the field is never offered by the dialog.
306
+ *
307
+ * @param convertedMetadata - already-converted OData metadata
308
+ * @param entitySetName - name of the entity set that owns the property (undefined → false)
309
+ * @param propertyName - name of the property to inspect
310
+ * @returns true if the property is hidden from the filter adaptation dialog
311
+ */
312
+ export function isHiddenFilter(convertedMetadata, entitySetName, propertyName) {
313
+ if (!entitySetName) {
314
+ return false;
315
+ }
316
+ const entitySet = convertedMetadata.entitySets.find((es) => es.name === entitySetName);
317
+ const property = entitySet?.entityType?.entityProperties?.find((p) => p.name === propertyName);
318
+ // The converted `@UI.HiddenFilter` value is a Boolean wrapper object (it carries annotation
319
+ // metadata), so it is always truthy — `Boolean(x)` / `!== undefined` would treat an explicit
320
+ // `HiddenFilter: false` as hidden. Coerce via `valueOf()` to read the underlying boolean.
321
+ return property?.annotations?.UI?.HiddenFilter?.valueOf() === true;
322
+ }
164
323
  /**
165
324
  * Checks the state of action buttons defined in UI.LineItem annotations for a given entity set.
166
325
  *
@@ -292,7 +451,7 @@ function extractItemDescriptions(aggregations) {
292
451
  */
293
452
  export function isSemanticKeyInFilterBar(pageModel, metadataXml, entitySetName, log) {
294
453
  try {
295
- const semanticKeys = getSemanticKeyProperties(metadataXml, entitySetName, true);
454
+ const semanticKeys = getSemanticKeyProperties(metadataXml, entitySetName, false);
296
455
  if (!semanticKeys.length) {
297
456
  return false;
298
457
  }
@@ -309,7 +468,7 @@ export function isSemanticKeyInFilterBar(pageModel, metadataXml, entitySetName,
309
468
  *
310
469
  * @param convertedMetadata - The already-converted OData metadata
311
470
  * @param entitySetName - The name of the entity set to inspect
312
- * @param resolveLabels - when true, each property name is replaced with its Common.Label value (falls back to the property name when no label is defined). Use this when comparing against getFilterFieldNames(), which also returns labels.
471
+ * @param resolveLabels - when true, each property name is replaced with its Common.Label value (falling back to the property name); default false
313
472
  * @returns An array of PropertyPath string values (or their labels) from the SemanticKey annotation, or an empty array if not found
314
473
  * @throws {Error} If the entity set is not found
315
474
  */
@@ -339,7 +498,7 @@ export function getSemanticKeyPropertiesFromMetadata(convertedMetadata, entitySe
339
498
  *
340
499
  * @param metadataXml - The OData metadata XML content as a string
341
500
  * @param entitySetName - The name of the entity set to inspect
342
- * @param resolveLabels - when true, each property name is replaced with its Common.Label value (falls back to the property name when no label is defined). Use this when comparing against getFilterFieldNames(), which also returns labels.
501
+ * @param resolveLabels - when true, each property name is replaced with its Common.Label value (falling back to the property name); default false
343
502
  * @returns An array of PropertyPath string values (or their labels) from the SemanticKey annotation, or an empty array if not found
344
503
  * @throws {Error} If the metadata cannot be parsed or the entity set is not found
345
504
  */
@@ -94,12 +94,24 @@ export declare function getFPMFeatures(page: PageWithModelV4, log?: Logger): FPM
94
94
  */
95
95
  export declare function getAggregations(node: TreeAggregation): TreeAggregations;
96
96
  /**
97
- * Retrieves selection field items from the given selection fields aggregation.
97
+ * Retrieves the stable OData property names of the selection fields, so generated
98
+ * filter-field checks do not break under translation.
98
99
  *
99
100
  * @param selectionFieldsAgg - The selection fields aggregation containing field definitions.
100
- * @returns An array of selection field descriptions.
101
+ * @returns An array of selection field property names.
101
102
  */
102
103
  export declare function getSelectionFieldItems(selectionFieldsAgg: TreeAggregations): string[];
104
+ /**
105
+ * Retrieves both the property name and translated label of each selection field, for the
106
+ * List Report path where custom filter fields must fall back to matching by label.
107
+ *
108
+ * @param selectionFieldsAgg - The selection fields aggregation containing field definitions.
109
+ * @returns Array of `{ property, description }` entries.
110
+ */
111
+ export declare function getSelectionFieldItemsWithLabels(selectionFieldsAgg: TreeAggregations): {
112
+ property: string;
113
+ description: string;
114
+ }[];
103
115
  /**
104
116
  * Retrieves filter field descriptions from the given tree model.
105
117
  *
@@ -52,7 +52,7 @@ export async function getAppFeatures(basePath, fs, log, metadata, manifest) {
52
52
  }
53
53
  if (objectPages) {
54
54
  log?.warn('Extracting Object Page features from application model');
55
- featureData.objectPages = await getObjectPageFeatures(objectPages, listReportPage?.name, log, projectMetadata);
55
+ featureData.objectPages = await getObjectPageFeatures(objectPages, listReportPage?.name, log, projectMetadata, manifest);
56
56
  log?.warn('objectPages features extracted: ' + JSON.stringify(featureData.objectPages));
57
57
  }
58
58
  if (fpmPage) {
@@ -146,16 +146,42 @@ export function getAggregations(node) {
146
146
  return {};
147
147
  }
148
148
  /**
149
- * Retrieves selection field items from the given selection fields aggregation.
149
+ * Retrieves the stable OData property names of the selection fields, so generated
150
+ * filter-field checks do not break under translation.
150
151
  *
151
152
  * @param selectionFieldsAgg - The selection fields aggregation containing field definitions.
152
- * @returns An array of selection field descriptions.
153
+ * @returns An array of selection field property names.
153
154
  */
154
155
  export function getSelectionFieldItems(selectionFieldsAgg) {
155
156
  if (selectionFieldsAgg && typeof selectionFieldsAgg === 'object') {
156
157
  const items = [];
157
158
  for (const itemKey in selectionFieldsAgg) {
158
- items.push(selectionFieldsAgg[itemKey].description);
159
+ const item = selectionFieldsAgg[itemKey];
160
+ const property = item.schema?.keys?.[0]?.value;
161
+ if (property) {
162
+ items.push(property);
163
+ }
164
+ }
165
+ return items;
166
+ }
167
+ return [];
168
+ }
169
+ /**
170
+ * Retrieves both the property name and translated label of each selection field, for the
171
+ * List Report path where custom filter fields must fall back to matching by label.
172
+ *
173
+ * @param selectionFieldsAgg - The selection fields aggregation containing field definitions.
174
+ * @returns Array of `{ property, description }` entries.
175
+ */
176
+ export function getSelectionFieldItemsWithLabels(selectionFieldsAgg) {
177
+ if (selectionFieldsAgg && typeof selectionFieldsAgg === 'object') {
178
+ const items = [];
179
+ for (const itemKey in selectionFieldsAgg) {
180
+ const item = selectionFieldsAgg[itemKey];
181
+ const property = item.schema?.keys?.[0]?.value;
182
+ if (property) {
183
+ items.push({ property, description: item.description ?? property });
184
+ }
159
185
  }
160
186
  return items;
161
187
  }
@@ -1,4 +1,5 @@
1
1
  import type { Logger } from '@sap-ux/logger';
2
+ import type { Manifest } from '@sap-ux/project-access';
2
3
  import type { ApplicationModel } from '@sap/ux-specification/dist/types/src/parser/index.js';
3
4
  import type { ObjectPageFeatures } from '../types.js';
4
5
  import type { PageWithModelV4 } from '@sap/ux-specification/dist/types/src/parser/application.js';
@@ -9,9 +10,10 @@ import type { PageWithModelV4 } from '@sap/ux-specification/dist/types/src/parse
9
10
  * @param listReportPageKey - the key of the List Report page in the application model, used to find navigation routes to object pages
10
11
  * @param log - optional logger instance
11
12
  * @param metadata - optional metadata for the OPA test generation
13
+ * @param manifest - optional application manifest, used to resolve the parent List Report's default table tab
12
14
  * @returns a record of object page feature data
13
15
  */
14
- export declare function getObjectPageFeatures(objectPages: PageWithModelV4[], listReportPageKey?: string, log?: Logger, metadata?: string): Promise<ObjectPageFeatures[]>;
16
+ export declare function getObjectPageFeatures(objectPages: PageWithModelV4[], listReportPageKey?: string, log?: Logger, metadata?: string, manifest?: Manifest): Promise<ObjectPageFeatures[]>;
15
17
  /**
16
18
  * Retrieves all Object Page definitions from the given application model, as long as the page is reachable via standard navigation routes.
17
19
  *
@@ -4,6 +4,7 @@ import { PageTypeV4 } from '@sap/ux-specification/dist/types/src/common/page.js'
4
4
  import { parse } from '@sap-ux/edmx-parser';
5
5
  import { convert } from '@sap-ux/annotation-converter';
6
6
  import { buildActionStateFromSpecModelKey, safeCheckButtonVisibility, safeCheckEditVisibility } from './actionUtils.js';
7
+ import { getTableIdentifiers } from './listReportUtils.js';
7
8
  /**
8
9
  * Extracts feature data for object pages from the application model.
9
10
  *
@@ -11,9 +12,10 @@ import { buildActionStateFromSpecModelKey, safeCheckButtonVisibility, safeCheckE
11
12
  * @param listReportPageKey - the key of the List Report page in the application model, used to find navigation routes to object pages
12
13
  * @param log - optional logger instance
13
14
  * @param metadata - optional metadata for the OPA test generation
15
+ * @param manifest - optional application manifest, used to resolve the parent List Report's default table tab
14
16
  * @returns a record of object page feature data
15
17
  */
16
- export async function getObjectPageFeatures(objectPages, listReportPageKey, log, metadata) {
18
+ export async function getObjectPageFeatures(objectPages, listReportPageKey, log, metadata, manifest) {
17
19
  const objectPageFeatures = [];
18
20
  if (!objectPages || objectPages.length === 0) {
19
21
  log?.warn('Object Pages not found in application model. Dynamic tests will not be generated for Object Pages.');
@@ -22,10 +24,13 @@ export async function getObjectPageFeatures(objectPages, listReportPageKey, log,
22
24
  // attempt to get individual feature data for each object page
23
25
  const convertedMetadata = metadata ? convert(parse(metadata)) : undefined;
24
26
  const schemaNamespace = convertedMetadata?.namespace ?? '';
27
+ // The parent List Report's default (first) table tab. Empty for single-table LRs;
28
+ // used so the OP's "navigate from parent LR" step targets a concrete tab on multi-tab LRs.
29
+ const parentLRTableIdentifier = getTableIdentifiers(manifest, listReportPageKey)[0];
25
30
  for (const objectPage of objectPages) {
26
31
  const pageFeatureData = {};
27
32
  pageFeatureData.name = objectPage.name;
28
- pageFeatureData.navigationParents = getObjectPageNavigationParents(objectPage.name, objectPages, listReportPageKey);
33
+ pageFeatureData.navigationParents = getObjectPageNavigationParents(objectPage.name, objectPages, listReportPageKey, parentLRTableIdentifier);
29
34
  // extract header sections (facets)
30
35
  pageFeatureData.headerSections = extractObjectPageHeaderSectionsData(objectPage);
31
36
  // extract body sections (includes section-level actions and standard create/delete buttons)
@@ -65,9 +70,10 @@ export function getObjectPages(applicationModel) {
65
70
  * @param targetObjectPageKey - key of the target object page
66
71
  * @param objectPages - the array of object pages extracted from the application model
67
72
  * @param listReportPageKey - the key of the List Report page in the application model, used to find navigation routes to object pages
73
+ * @param parentLRTableIdentifier - the parent List Report's default table tab key (empty for single-table LRs)
68
74
  * @returns navigation data including the ordered ancestor Object Page chain
69
75
  */
70
- function getObjectPageNavigationParents(targetObjectPageKey, objectPages, listReportPageKey) {
76
+ function getObjectPageNavigationParents(targetObjectPageKey, objectPages, listReportPageKey, parentLRTableIdentifier) {
71
77
  const parentOPs = [];
72
78
  const visited = new Set([targetObjectPageKey]); // guard against infinite loop in case of invalid manifest entries
73
79
  let cursor = targetObjectPageKey;
@@ -92,6 +98,7 @@ function getObjectPageNavigationParents(targetObjectPageKey, objectPages, listRe
92
98
  }
93
99
  return {
94
100
  parentLRName: listReportPageKey ?? '', // app is possibly malformed if no LR found
101
+ parentLRTableIdentifier,
95
102
  parentOPs
96
103
  };
97
104
  }
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.27",
4
+ "version": "1.2.29",
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.0",
32
32
  "@sap-ux/logger": "1.0.3",
33
- "@sap-ux/fiori-generator-shared": "1.2.1",
34
- "@sap-ux/project-access": "2.1.7",
35
- "@sap-ux/preview-middleware": "1.0.44"
33
+ "@sap-ux/fiori-generator-shared": "1.2.2",
34
+ "@sap-ux/project-access": "2.1.8",
35
+ "@sap-ux/preview-middleware": "1.0.45"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@jest/globals": "30.4.1",
@@ -30,7 +30,7 @@ sap.ui.define([
30
30
  Then.onThe<%- pageName %>Generated.iSeeThisPage();
31
31
  <%_ if (filterBarItems && filterBarItems.length > 0) { -%>
32
32
  <%_ filterBarItems.forEach(function(item) { _%>
33
- Then.onThe<%- pageName%>Generated.onFilterBar().iCheckFilterField("<%- item %>");
33
+ Then.onThe<%- pageName%>Generated.onFilterBar().iCheckFilterField({ property: "<%- item %>" });
34
34
  <%_ }); -%>
35
35
  <%_ } -%>
36
36
  <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { _%>
@@ -24,6 +24,8 @@ sap.ui.define([
24
24
  function journey() {
25
25
  QUnit.module("<%- name%>ListReport journey");
26
26
 
27
+ const defaultTableId = <%- tableIdentifiers && tableIdentifiers.length > 0 ? '"' + tableIdentifiers[0] + '"' : '""' %>;
28
+
27
29
  opaTest("Start application", function (Given, When, Then) {
28
30
  Given.iStartMyApp();
29
31
  <%_ startPages.forEach(function(pageName) { %>
@@ -34,27 +36,31 @@ sap.ui.define([
34
36
  <%_ if (!hideFilterBar && filterBarItems && filterBarItems.length > 0) { -%>
35
37
  opaTest("Check filter bar", function (Given, When, Then) {
36
38
  <%_ filterBarItems.forEach(function(item) { _%>
37
- Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- item %>");
39
+ <%_ if (item.custom) { _%>
40
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- item.description %>");
41
+ <%_ } else { _%>
42
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- item.property %>" });
43
+ <%_ } _%>
38
44
  <%_ }); -%>
39
45
  });
40
46
  <%_ } -%>
41
47
  <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
42
48
  opaTest("Add semantic key properties to filter bar", function (Given, When, Then) {
43
- Then.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
49
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
44
50
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
45
- When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField("<%- property %>");
51
+ When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
46
52
  <%_ }); -%>
47
- Then.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
53
+ When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
48
54
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
49
- Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- property %>");
55
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
50
56
  <%_ }); -%>
51
57
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
52
- // Then.onThe<%- startLR%>Generated.onFilterBar().iChangeFilterField("<%- property %>");
58
+ // When.onThe<%- startLR%>Generated.onFilterBar().iChangeFilterField({ property: "<%- property %>" }, "<value to filter>", false);
53
59
  <%_ }); -%>
54
- // Then.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
55
- // Then.onThe<%- startLR%>Generated.onTable().iCheckRows();
56
- // Then.onThe<%- startLR%>Generated.onTable().iSelectRows(0);
57
- // Then.onThe<%- startLR%>Generated.onTable().iCheckAction("<Action Name>", { enabled: true });
60
+ // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
61
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
62
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
63
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<Action Name>", { enabled: true });
58
64
  });
59
65
  <%_ } -%>
60
66
 
@@ -62,47 +68,58 @@ sap.ui.define([
62
68
  // opaTest("Perform a global search and check the result", function (Given, When, Then) {
63
69
  // When.onThe<%- startLR%>Generated.onFilterBar().iChangeSearchField("Search Term");
64
70
  // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
65
- // Then.onThe<%- startLR%>Generated.onTable().iCheckRows();
71
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
66
72
  // });
67
73
 
68
74
  <%_ if ((toolBarActions && toolBarActions.length > 0 ) || (tableColumns && Object.keys(tableColumns).length > 0)) { -%>
69
75
  opaTest("Check table columns and actions", function (Given, When, Then) {
70
76
  <%_ if (toolBarActions && toolBarActions.length > 0) { -%>
71
77
  <%_ if (createButton.visible && !isALP) { _%>
72
- Then.onThe<%- startLR%>Generated.onTable().iCheckCreate({ visible: true });
73
- // Then.onThe<%- startLR%>Generated.onTable().iPressCreate();
78
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
79
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressCreate();
74
80
  <%_ } _%>
75
81
  <%_ if (deleteButton.visible) { _%>
76
- // Then.onThe<%- startLR%>Generated.onTable().iPressDelete();
77
- Then.onThe<%- startLR%>Generated.onTable().iCheckDelete({ visible: true });
82
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
83
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
78
84
  <%_ } _%>
79
85
  <%_ toolBarActions.forEach(function(item) { _%>
80
86
  <%_ if (item.visible) { _%>
81
- // Then.onThe<%- startLR%>Generated.onTable().iPressAction("<%- item.label %>");
82
- Then.onThe<%- startLR%>Generated.onTable().iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
87
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
88
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
83
89
  <%_ } _%>
84
90
  <%_ }); -%>
85
91
  <%_ } -%>
86
92
  <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
87
- Then.onThe<%- startLR %>Generated.onTable().iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
88
- <%_ } %>
93
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
94
+ <%_ } -%>
89
95
  });
90
- <%_ } %>
96
+ <%_ } -%>
91
97
 
92
- <% if (startLR) { %>
98
+ <%_ if (startLR) { -%>
93
99
  opaTest("Navigate to ObjectPage", function (Given, When, Then) {
94
100
  // Note: this test will fail if the ListReport page doesn't show any data
95
- <% if (!hideFilterBar) { %>
101
+ <%_ if (!hideFilterBar) { -%>
96
102
  When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
97
- <%} %>
98
- Then.onThe<%- startLR%>Generated.onTable().iCheckRows();
99
- <% if (navigatedOP) { %>
100
- When.onThe<%- startLR%>Generated.onTable().iPressRow(0);
103
+ <%_ } -%>
104
+ <%_ if (tableIdentifiers && tableIdentifiers.length > 0) { -%>
105
+ <%_ tableIdentifiers.forEach(function(tabId) { _%>
106
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tabId %>" });
107
+ Then.onThe<%- startLR%>Generated.onTable("<%- tabId %>").iCheckRows();
108
+ <%_ }); -%>
109
+ <%_ } else { -%>
110
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
111
+ <%_ } -%>
112
+ <%_ if (navigatedOP) { -%>
113
+ <%_ if (tableIdentifiers && tableIdentifiers.length > 0) { _%>
114
+ When.onThe<%- startLR%>Generated.iGoToView({ key: defaultTableId });
115
+ <%_ } _%>
116
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressRow(0);
101
117
  Then.onThe<%- navigatedOP%>Generated.iSeeThisPage();
102
- <%} %>
118
+ <%_ } -%>
103
119
  });
104
- <%} %>
105
- opaTest("Teardown", function (Given, When, Then) {
120
+ <%_ } -%>
121
+
122
+ opaTest("Teardown", function (Given, When, Then) {
106
123
  // Cleanup
107
124
  Given.iTearDownMyApp();
108
125
  });
@@ -19,8 +19,7 @@ import opaTest from "sap/ui/test/opaQunit";
19
19
  import type { Given, When, Then } from "./types/OpaJourneyTypes";
20
20
  <%_
21
21
  const usesFilterFieldIdentifier =
22
- (!hideFilterBar && filterBarItems && filterBarItems.length > 0) ||
23
- (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0);
22
+ !hideFilterBar && filterBarItems && filterBarItems.some(function(item) { return item.custom; });
24
23
  -%>
25
24
  <% if (usesFilterFieldIdentifier) { -%>
26
25
  import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
@@ -30,6 +29,8 @@ import runner from "./pages/JourneyRunner";
30
29
  function journey() {
31
30
  QUnit.module("<%- name%>ListReport journey");
32
31
 
32
+ const defaultTableId = <%- tableIdentifiers && tableIdentifiers.length > 0 ? '"' + tableIdentifiers[0] + '"' : '""' %>;
33
+
33
34
  opaTest("Start application", function (Given: Given, _When: When, Then: Then) {
34
35
  Given.iStartMyApp();
35
36
  <%_ startPages.forEach(function(pageName) { %>
@@ -40,27 +41,31 @@ function journey() {
40
41
  <%_ if (!hideFilterBar && filterBarItems && filterBarItems.length > 0) { -%>
41
42
  opaTest("Check filter bar", function (_Given: Given, _When: When, Then: Then) {
42
43
  <%_ filterBarItems.forEach(function(item) { _%>
43
- Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- item %>" as unknown as FilterFieldIdentifier);
44
+ <%_ if (item.custom) { _%>
45
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- item.description %>" as unknown as FilterFieldIdentifier);
46
+ <%_ } else { _%>
47
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- item.property %>" });
48
+ <%_ } _%>
44
49
  <%_ }); -%>
45
50
  });
46
51
  <%_ } -%>
47
52
  <%_ if (semanticKey && semanticKey.missingFromFilterBar && semanticKey.missingFromFilterBar.length > 0) { %>
48
53
  opaTest("Add semantic key properties to filter bar", function (_Given: Given, When: When, Then: Then) {
49
- Then.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
54
+ When.onThe<%- startLR%>Generated.onFilterBar().iOpenFilterAdaptation();
50
55
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
51
- When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField("<%- property %>");
56
+ When.onThe<%- startLR%>Generated.onFilterBar().iAddAdaptationFilterField({ property: "<%- property %>" });
52
57
  <%_ }); -%>
53
- Then.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
58
+ When.onThe<%- startLR%>Generated.onFilterBar().iConfirmFilterAdaptation();
54
59
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
55
- Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField("<%- property %>" as unknown as FilterFieldIdentifier);
60
+ Then.onThe<%- startLR%>Generated.onFilterBar().iCheckFilterField({ property: "<%- property %>" });
56
61
  <%_ }); -%>
57
62
  <%_ semanticKey.missingFromFilterBar.forEach(function(property) { _%>
58
- // Then.onThe<%- startLR%>Generated.onFilterBar().iChangeFilterField({ property: "<%- property %>" });
63
+ // When.onThe<%- startLR%>Generated.onFilterBar().iChangeFilterField({ property: "<%- property %>" }, "<value to filter>", false);
59
64
  <%_ }); -%>
60
- // Then.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
61
- // Then.onThe<%- startLR%>Generated.onTable("").iCheckRows();
62
- // Then.onThe<%- startLR%>Generated.onTable("").iSelectRows(0);
63
- // Then.onThe<%- startLR%>Generated.onTable("").iCheckAction("<Action Name>", { enabled: true });
65
+ // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
66
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
67
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iSelectRows(0);
68
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<Action Name>", { enabled: true });
64
69
  });
65
70
  <%_ } -%>
66
71
 
@@ -68,46 +73,57 @@ function journey() {
68
73
  // opaTest("Perform a global search and check the result", function (Given: Given, When: When, Then: Then) {
69
74
  // When.onThe<%- startLR%>Generated.onFilterBar().iChangeSearchField("Search Term");
70
75
  // When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
71
- // Then.onThe<%- startLR%>Generated.onTable("").iCheckRows();
76
+ // Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
72
77
  // });
73
78
 
74
79
  <%_ if ((toolBarActions && toolBarActions.length > 0 ) || (tableColumns && Object.keys(tableColumns).length > 0)) { -%>
75
80
  opaTest("Check table columns and actions", function (_Given: Given, _When: When, Then: Then) {
76
81
  <%_ if (toolBarActions && toolBarActions.length > 0) { -%>
77
82
  <%_ if (createButton.visible && !isALP) { _%>
78
- Then.onThe<%- startLR%>Generated.onTable("").iCheckCreate({ visible: true });
79
- // Then.onthe<%- startLR%>Generated.onTable("").iPressCreate();
83
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckCreate({ visible: true });
84
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressCreate();
80
85
  <%_ } _%>
81
86
  <%_ if (deleteButton.visible) { _%>
82
- // Then.onthe<%- startLR%>Generated.onTable("").iPressDelete();
83
- Then.onThe<%- startLR%>Generated.onTable("").iCheckDelete({ visible: true });
87
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressDelete();
88
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckDelete({ visible: true });
84
89
  <%_ } _%>
85
90
  <%_ toolBarActions.forEach(function(item) { _%>
86
91
  <%_ if (item.visible) { _%>
87
- // Then.onThe<%- startLR%>Generated.onTable("").iPressAction("<%- item.label %>");
88
- Then.onThe<%- startLR%>Generated.onTable("").iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
92
+ // When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressAction("<%- item.label %>");
93
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckAction("<%- item.label %>", { enabled: <%- item.enabled === true %> });
89
94
  <%_ } _%>
90
95
  <%_ }); -%>
91
96
  <%_ } -%>
92
97
  <%_ if (tableColumns && Object.keys(tableColumns).length > 0) { -%>
93
- Then.onThe<%- startLR %>Generated.onTable("").iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
94
- <%_ } %>
98
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
99
+ <%_ } -%>
95
100
  });
96
- <%_ } %>
101
+ <%_ } -%>
97
102
 
98
- <% if (startLR) { %>
103
+ <%_ if (startLR) { -%>
99
104
  opaTest("Navigate to ObjectPage", function (_Given: Given, When: When, Then: Then) {
100
105
  // Note: this test will fail if the ListReport page doesn't show any data
101
- <% if (!hideFilterBar) { %>
106
+ <%_ if (!hideFilterBar) { -%>
102
107
  When.onThe<%- startLR%>Generated.onFilterBar().iExecuteSearch();
103
- <%} %>
104
- Then.onThe<%- startLR%>Generated.onTable("").iCheckRows();
105
- <% if (navigatedOP) { %>
106
- When.onThe<%- startLR%>Generated.onTable("").iPressRow(0);
108
+ <%_ } -%>
109
+ <%_ if (tableIdentifiers && tableIdentifiers.length > 0) { -%>
110
+ <%_ tableIdentifiers.forEach(function(tabId) { _%>
111
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tabId %>" });
112
+ Then.onThe<%- startLR%>Generated.onTable("<%- tabId %>").iCheckRows();
113
+ <%_ }); -%>
114
+ <%_ } else { -%>
115
+ Then.onThe<%- startLR%>Generated.onTable(defaultTableId).iCheckRows();
116
+ <%_ } -%>
117
+ <%_ if (navigatedOP) { -%>
118
+ <%_ if (tableIdentifiers && tableIdentifiers.length > 0) { _%>
119
+ When.onThe<%- startLR%>Generated.iGoToView({ key: defaultTableId });
120
+ <%_ } _%>
121
+ When.onThe<%- startLR%>Generated.onTable(defaultTableId).iPressRow(0);
107
122
  Then.onThe<%- navigatedOP%>Generated.iSeeThisPage();
108
- <%} %>
123
+ <%_ } -%>
109
124
  });
110
- <%} %>
125
+ <%_ } -%>
126
+
111
127
  opaTest("Teardown", function (Given: Given) {
112
128
  // Cleanup
113
129
  Given.iTearDownMyApp();
@@ -30,8 +30,8 @@ sap.ui.define([
30
30
  <% if (!hideFilterBar) { -%>
31
31
  When.onThe<%- navigationParents.parentLRName%>Generated.onFilterBar().iExecuteSearch();
32
32
  <% } -%>
33
- Then.onThe<%- navigationParents.parentLRName%>Generated.onTable().iCheckRows();
34
- When.onThe<%- navigationParents.parentLRName%>Generated.onTable().iPressRow(0);
33
+ Then.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- navigationParents.parentLRTableIdentifier ? '"' + navigationParents.parentLRTableIdentifier + '"' : '' %>).iCheckRows();
34
+ When.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- navigationParents.parentLRTableIdentifier ? '"' + navigationParents.parentLRTableIdentifier + '"' : '' %>).iPressRow(0);
35
35
  <% } -%>
36
36
  <% navigationParents.parentOPs.forEach(function(parent) { %>
37
37
  Then.onThe<%- parent.name %>Generated.iSeeThisPage();
@@ -51,11 +51,11 @@ sap.ui.define([
51
51
  <% headerActions.forEach(function(action) { -%>
52
52
  <% if (action.visible) { -%>
53
53
  <% if (action.enabled === 'dynamic') { -%>
54
- Then.onThe<%- name%>Generated.onHeader().iCheckAction("<%- action.label %>" /* , { enabled: true } */);
54
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
55
55
  <% } else { -%>
56
- Then.onThe<%- name%>Generated.onHeader().iCheckAction("<%- action.label %>", { enabled: <%- action.enabled === true %> });
56
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
57
57
  <% } -%>
58
- // When.onThe<%- name%>Generated.onHeader().iPressAction("<%- action.label %>");
58
+ // When.onThe<%- name%>Generated.onHeader().iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
59
59
  <% } -%>
60
60
  <% }); -%>
61
61
  });
@@ -97,18 +97,18 @@ sap.ui.define([
97
97
  <% if (action.visible) { -%>
98
98
  <% if (section.isTable && section.navigationProperty) { -%>
99
99
  <% if (action.enabled === 'dynamic') { -%>
100
- Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction("<%- action.label %>" /* , { enabled: true } */);
100
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
101
101
  <% } else { -%>
102
- Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction("<%- action.label %>", { enabled: <%- action.enabled === true %> });
102
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
103
103
  <% } -%>
104
- // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction("<%- action.label %>");
104
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
105
105
  <% } else { -%>
106
106
  <% if (action.enabled === 'dynamic') { -%>
107
- Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction("<%- action.label %>" /* , { enabled: true } */);
107
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
108
108
  <% } else { -%>
109
- Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction("<%- action.label %>", { enabled: <%- action.enabled === true %> });
109
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
110
110
  <% } -%>
111
- // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iPressAction("<%- action.label %>");
111
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
112
112
  <% } -%>
113
113
  <% } -%>
114
114
  <% }); -%>
@@ -49,8 +49,8 @@ function journey() {
49
49
  <% if (!hideFilterBar) { -%>
50
50
  When.onThe<%- navigationParents.parentLRName%>Generated.onFilterBar().iExecuteSearch();
51
51
  <% } -%>
52
- Then.onThe<%- navigationParents.parentLRName%>Generated.onTable("").iCheckRows();
53
- When.onThe<%- navigationParents.parentLRName%>Generated.onTable("").iPressRow(0);
52
+ Then.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- navigationParents.parentLRTableIdentifier ? '"' + navigationParents.parentLRTableIdentifier + '"' : '""' %>).iCheckRows();
53
+ When.onThe<%- navigationParents.parentLRName%>Generated.onTable(<%- navigationParents.parentLRTableIdentifier ? '"' + navigationParents.parentLRTableIdentifier + '"' : '""' %>).iPressRow(0);
54
54
  <% } -%>
55
55
  <% navigationParents.parentOPs.forEach(function(parent) { %>
56
56
  Then.onThe<%- parent.name %>Generated.iSeeThisPage();
@@ -70,11 +70,11 @@ function journey() {
70
70
  <% headerActions.forEach(function(action) { -%>
71
71
  <% if (action.visible) { -%>
72
72
  <% if (action.enabled === 'dynamic') { -%>
73
- Then.onThe<%- name%>Generated.onHeader().iCheckAction("<%- action.label %>" /* , { enabled: true } */);
73
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
74
74
  <% } else { -%>
75
- Then.onThe<%- name%>Generated.onHeader().iCheckAction("<%- action.label %>", { enabled: <%- action.enabled === true %> });
75
+ Then.onThe<%- name%>Generated.onHeader().iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
76
76
  <% } -%>
77
- // When.onThe<%- name%>Generated.onHeader().iPressAction("<%- action.label %>");
77
+ // When.onThe<%- name%>Generated.onHeader().iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
78
78
  <% } -%>
79
79
  <% }); -%>
80
80
  });
@@ -116,18 +116,18 @@ function journey() {
116
116
  <% if (action.visible) { -%>
117
117
  <% if (section.isTable && section.navigationProperty) { -%>
118
118
  <% if (action.enabled === 'dynamic') { -%>
119
- Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction("<%- action.label %>" /* , { enabled: true } */);
119
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
120
120
  <% } else { -%>
121
- Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction("<%- action.label %>", { enabled: <%- action.enabled === true %> });
121
+ Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
122
122
  <% } -%>
123
- // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction("<%- action.label %>");
123
+ // When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
124
124
  <% } else { -%>
125
125
  <% if (action.enabled === 'dynamic') { -%>
126
- Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction("<%- action.label %>" /* , { enabled: true } */);
126
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> } /* , { enabled: true } */);
127
127
  <% } else { -%>
128
- Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction("<%- action.label %>", { enabled: <%- action.enabled === true %> });
128
+ Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> }, { enabled: <%- action.enabled === true %> });
129
129
  <% } -%>
130
- // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iPressAction("<%- action.label %>");
130
+ // When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iPressAction({ service: "<%- action.service %>", action: "<%- action.action %>", unbound: <%- action.unbound === true %> });
131
131
  <% } -%>
132
132
  <% } -%>
133
133
  <% }); -%>
@@ -145,7 +145,7 @@ function journey() {
145
145
  <% if (section?.subSections?.length > 0) { -%>
146
146
  <% section.subSections.forEach(function(subSection) { -%>
147
147
  //When.onThe<%- name%>Generated.iGoToSection({ section: "<%- section.id %>", subSection: "<%- subSection.id %>" });
148
- Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" });
148
+ Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" }, {});
149
149
  <% if (subSection.fields && subSection.fields.length > 0) { -%>
150
150
  <% subSection.fields.forEach(function(field) { -%>
151
151
  Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });