@sap-ux/ui5-test-writer 1.18.3 → 1.19.1

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.
@@ -599,6 +599,8 @@ function writeJourneyFiles(appFeatures, writeContext) {
599
599
  editor.copyTpl(join(rootV4TemplateDirPath, 'integration', `ListReportJourney${dotFileExtension}`), join(testOutDirPath, 'integration', `${appFeatures.listReport.name}Journey.gen${dotFileExtension}`), {
600
600
  ...journeyParams,
601
601
  ...appFeatures.listReport,
602
+ defaultSortOrder: appFeatures.listReport.defaultSortOrder ?? [],
603
+ defaultFilterValues: appFeatures.listReport.defaultFilterValues ?? [],
602
604
  appPath: config.appPath
603
605
  }, undefined, {
604
606
  globOptions: { dot: true }
package/dist/types.d.ts CHANGED
@@ -69,6 +69,7 @@ export type FEV4ManifestTarget = {
69
69
  entitySet?: string;
70
70
  contextPath?: string;
71
71
  hideFilterBar?: boolean;
72
+ defaultTemplateAnnotationPath?: string;
72
73
  navigation?: {
73
74
  [id: string]: {
74
75
  detail?: {
@@ -114,6 +115,19 @@ export interface FFOPAConfig {
114
115
  ui5Theme?: string;
115
116
  useVirtualPreviewEndpoints?: boolean;
116
117
  }
118
+ export type SortOrderItem = {
119
+ property: string;
120
+ descending: boolean;
121
+ };
122
+ export type FilterDefaultValue = {
123
+ property: string;
124
+ /** Low value of the EQ/LE/GE/LT/GT/NE range, normalized (IsDigitSequence zero-padded to maxLength). */
125
+ value: string;
126
+ /** High value for BT (between) ranges. */
127
+ value2?: string;
128
+ /** MDC condition operator string (e.g. 'EQ', 'BT', 'LE'). Omitted for EQ (default). */
129
+ operator?: string;
130
+ };
117
131
  export type ObjectPageNavigationParent = {
118
132
  name: string;
119
133
  navigationProperty: string;
@@ -129,6 +143,7 @@ export type SectionFormField = {
129
143
  connectedFields?: string;
130
144
  fieldGroup?: string;
131
145
  targetAnnotation?: string;
146
+ checkBoxGroup?: boolean;
132
147
  };
133
148
  export type TableColumn = {
134
149
  header?: string;
@@ -217,6 +232,7 @@ export type ListReportTab = {
217
232
  };
218
233
  textAnnotationColumns: TextAnnotationColumn[];
219
234
  columnPersonalizationSupported?: boolean;
235
+ defaultSortOrder?: SortOrderItem[];
220
236
  };
221
237
  export type ListReportFeatures = {
222
238
  name?: string;
@@ -259,6 +275,8 @@ export type ListReportFeatures = {
259
275
  semanticKeyProperties?: string[];
260
276
  missingFromFilterBar?: string[];
261
277
  };
278
+ defaultSortOrder?: SortOrderItem[];
279
+ defaultFilterValues?: FilterDefaultValue[];
262
280
  };
263
281
  export interface ActionButtonState {
264
282
  label: string;
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from '@sap-ux/logger';
2
2
  import type { TreeAggregation, TreeAggregations, TreeModel } from '@sap/ux-specification/dist/types/src/parser/index.js';
3
- import type { ActionButtonsResult, ActionButtonState, ButtonState, FEV4ManifestTarget, ListReportFeatures, ListReportTab } from '../types.js';
3
+ import type { ActionButtonsResult, ActionButtonState, ButtonState, FEV4ManifestTarget, FilterDefaultValue, ListReportFeatures, ListReportTab, SortOrderItem } from '../types.js';
4
4
  import { type I18nLabelResolver } from './i18nUtils.js';
5
5
  import type { TextAnnotationColumnCandidate } from './tableUtils.js';
6
6
  import type { ConvertedMetadata } from '@sap-ux/vocabularies-types';
@@ -68,6 +68,26 @@ export declare function isALPFromManifest(manifest: Manifest, targetKey?: string
68
68
  * @returns candidate columns with their bound property and the text annotation target property
69
69
  */
70
70
  export declare function extractTextAnnotationCandidatesFromMetadata(columnProperties: string[], convertedMetadata: ConvertedMetadata, entitySet: string | undefined): TextAnnotationColumnCandidate[];
71
+ /**
72
+ * Extracts default sort order items from a PresentationVariant on the given entity set.
73
+ *
74
+ * @param convertedMetadata - converted OData metadata
75
+ * @param entitySetName - the entity set name
76
+ * @param annotationPath - optional annotationPath from the tab's view config (multi-tab)
77
+ * @returns array of sort order items, empty if no PV or no SortOrder defined
78
+ */
79
+ export declare function getDefaultSortOrder(convertedMetadata: ConvertedMetadata, entitySetName: string, annotationPath?: string): SortOrderItem[];
80
+ /**
81
+ * Extracts default filter values from a SelectionVariant on the given entity set (single-table LR only).
82
+ * Only Sign=I ranges are included. IsDigitSequence properties are zero-padded to maxLength.
83
+ * Supports EQ, BT, LE, GE, LT, GT, NE operators.
84
+ *
85
+ * @param convertedMetadata - converted OData metadata
86
+ * @param entitySetName - the entity set name
87
+ * @param annotationPath - optional annotationPath from the tab's view config (multi-tab)
88
+ * @returns array of filter default values, empty if no SV or no applicable ranges
89
+ */
90
+ export declare function getDefaultFilterValues(convertedMetadata: ConvertedMetadata, entitySetName: string, annotationPath?: string): FilterDefaultValue[];
71
91
  /**
72
92
  * Gets List Report features from the page model using ux-specification.
73
93
  *
@@ -7,6 +7,7 @@ import { extractActionMethodName, buildActionButtonState, buildMenuActionState,
7
7
  import { t } from '../i18n.js';
8
8
  export { checkButtonVisibility, safeCheckEditVisibility } from './actionUtils.js';
9
9
  export { safeCheckButtonVisibility };
10
+ const SUPPORTED_OPERATORS = new Set(['EQ', 'BT', 'LE', 'GE', 'LT', 'GT', 'NE']);
10
11
  /**
11
12
  * Builds a button state object from button visibility result.
12
13
  *
@@ -86,6 +87,20 @@ export function isALPFromManifest(manifest, targetKey) {
86
87
  return target?.name === 'sap.fe.templates.ListReport' && isALPManifestTarget(target);
87
88
  });
88
89
  }
90
+ /**
91
+ * Returns the `defaultTemplateAnnotationPath` from the manifest target's settings, if present.
92
+ *
93
+ * @param manifest - the application manifest
94
+ * @param targetKey - the routing target key for the List Report page
95
+ * @returns the annotation path string, or undefined if not configured
96
+ */
97
+ function getDefaultTemplateAnnotationPath(manifest, targetKey) {
98
+ if (!manifest || !targetKey) {
99
+ return undefined;
100
+ }
101
+ const target = manifest['sap.ui5']?.routing?.targets?.[targetKey];
102
+ return target?.options?.settings?.defaultTemplateAnnotationPath;
103
+ }
89
104
  /**
90
105
  * Resolves raw text-annotation candidates into the template shape, deduplicating the text-property test
91
106
  * per text target. Each candidate asserts its own code column and text target independently; when columns
@@ -145,6 +160,229 @@ export function extractTextAnnotationCandidatesFromMetadata(columnProperties, co
145
160
  }
146
161
  return candidates;
147
162
  }
163
+ /**
164
+ * Resolves the PresentationVariant and SelectionVariant from the entity type annotations,
165
+ * following the fallback chain: qualified SPV/PV (via annotationPath) → unqualified SPV → unqualified PV/SV.
166
+ *
167
+ * @param entityType - the converted entity type to read annotations from
168
+ * @param annotationPath - optional full annotation path string (e.g. `UI.SelectionPresentationVariant#VAR2`)
169
+ * @returns the resolved presentationVariant and selectionVariant objects, or undefined for each if not found
170
+ */
171
+ function resolveVariantAnnotation(entityType, annotationPath) {
172
+ const ui = entityType.annotations.UI;
173
+ if (!ui) {
174
+ return { presentationVariant: undefined, selectionVariant: undefined };
175
+ }
176
+ if (annotationPath) {
177
+ return resolveVariantFromPath(ui, annotationPath);
178
+ }
179
+ const spv = ui.SelectionPresentationVariant;
180
+ if (spv) {
181
+ return { presentationVariant: spv.PresentationVariant, selectionVariant: spv.SelectionVariant };
182
+ }
183
+ return { presentationVariant: ui.PresentationVariant, selectionVariant: ui.SelectionVariant };
184
+ }
185
+ /**
186
+ * Resolves a variant annotation from a qualified annotationPath string.
187
+ *
188
+ * @param ui - the UI annotation map from the entity type
189
+ * @param annotationPath - the full annotation path (e.g. `UI.SelectionPresentationVariant#VAR2`)
190
+ * @returns the resolved presentationVariant and selectionVariant objects
191
+ */
192
+ function resolveVariantFromPath(ui, annotationPath) {
193
+ const hashIndex = annotationPath.indexOf('#');
194
+ const qualifier = hashIndex >= 0 ? annotationPath.slice(hashIndex + 1) : undefined;
195
+ const term = annotationPath.slice(annotationPath.lastIndexOf('.') + 1, hashIndex >= 0 ? hashIndex : undefined);
196
+ const key = qualifier ? `${term}#${qualifier}` : term;
197
+ switch (term) {
198
+ case 'SelectionPresentationVariant': {
199
+ const spv = ui[key];
200
+ return { presentationVariant: spv?.PresentationVariant, selectionVariant: spv?.SelectionVariant };
201
+ }
202
+ case 'PresentationVariant':
203
+ return { presentationVariant: ui[key], selectionVariant: undefined };
204
+ case 'SelectionVariant': {
205
+ // A bare SV has no PV of its own; fall back to the unqualified PV for sort assertions.
206
+ const fallbackPV = ui.SelectionPresentationVariant?.PresentationVariant ?? ui.PresentationVariant;
207
+ return { presentationVariant: fallbackPV, selectionVariant: ui[key] };
208
+ }
209
+ default:
210
+ return { presentationVariant: undefined, selectionVariant: undefined };
211
+ }
212
+ }
213
+ /**
214
+ * Extracts default sort order items from a PresentationVariant on the given entity set.
215
+ *
216
+ * @param convertedMetadata - converted OData metadata
217
+ * @param entitySetName - the entity set name
218
+ * @param annotationPath - optional annotationPath from the tab's view config (multi-tab)
219
+ * @returns array of sort order items, empty if no PV or no SortOrder defined
220
+ */
221
+ export function getDefaultSortOrder(convertedMetadata, entitySetName, annotationPath) {
222
+ const entitySet = convertedMetadata.entitySets.find((es) => es.name === entitySetName);
223
+ const entityType = entitySet?.entityType;
224
+ if (!entityType) {
225
+ return [];
226
+ }
227
+ const { presentationVariant } = resolveVariantAnnotation(entityType, annotationPath);
228
+ const sortOrder = presentationVariant?.SortOrder;
229
+ if (!sortOrder?.length) {
230
+ return [];
231
+ }
232
+ return sortOrder.flatMap((entry) => {
233
+ const property = entry.Property?.value;
234
+ if (!property) {
235
+ return [];
236
+ }
237
+ const desc = entry.Descending;
238
+ const descending = typeof desc === 'boolean' ? desc : desc?.valueOf?.() === true;
239
+ return [{ property, descending: !!descending }];
240
+ });
241
+ }
242
+ /**
243
+ * Extracts default filter values from a SelectionVariant on the given entity set (single-table LR only).
244
+ * Only Sign=I ranges are included. IsDigitSequence properties are zero-padded to maxLength.
245
+ * Supports EQ, BT, LE, GE, LT, GT, NE operators.
246
+ *
247
+ * @param convertedMetadata - converted OData metadata
248
+ * @param entitySetName - the entity set name
249
+ * @param annotationPath - optional annotationPath from the tab's view config (multi-tab)
250
+ * @returns array of filter default values, empty if no SV or no applicable ranges
251
+ */
252
+ export function getDefaultFilterValues(convertedMetadata, entitySetName, annotationPath) {
253
+ const entitySet = convertedMetadata.entitySets.find((es) => es.name === entitySetName);
254
+ const entityType = entitySet?.entityType;
255
+ if (!entityType) {
256
+ return [];
257
+ }
258
+ const { selectionVariant } = resolveVariantAnnotation(entityType, annotationPath);
259
+ const selectOptions = selectionVariant?.SelectOptions;
260
+ if (!selectOptions?.length) {
261
+ return [];
262
+ }
263
+ return selectOptions.flatMap((option) => extractFilterItem(option, entityType));
264
+ }
265
+ /**
266
+ * Zero-pads a filter value to the property's maxLength when the property has Common.IsDigitSequence.
267
+ *
268
+ * @param val - the raw Low value from the SelectionRangeType
269
+ * @param propertyName - the OData property name
270
+ * @param entityType - the entity type to look up property metadata
271
+ * @returns the normalized value, zero-padded if the property is a digit sequence
272
+ */
273
+ function normalizeFilterValue(val, propertyName, entityType) {
274
+ const prop = entityType.entityProperties.find((p) => p.name === propertyName);
275
+ const isDigitSeq = prop?.annotations.Common?.IsDigitSequence?.valueOf() === true;
276
+ const maxLength = prop?.maxLength;
277
+ return isDigitSeq && maxLength ? val.padStart(maxLength, '0') : val;
278
+ }
279
+ /**
280
+ * Extracts a single FilterDefaultValue from one SelectOptionType entry, or empty if no applicable range.
281
+ *
282
+ * @param selectOption - a SelectOptionType entry from the converted metadata
283
+ * @param entityType - the entity type to look up property metadata for normalization
284
+ * @returns array with one FilterDefaultValue if an applicable range is found, empty otherwise
285
+ */
286
+ function extractFilterItem(selectOption, entityType) {
287
+ const propertyName = selectOption.PropertyName?.value;
288
+ if (!propertyName) {
289
+ return [];
290
+ }
291
+ const result = [];
292
+ for (const range of selectOption.Ranges ?? []) {
293
+ const sign = range.Sign?.split('/').pop();
294
+ const operator = range.Option?.split('/').pop();
295
+ if (sign !== 'I' || !operator || !SUPPORTED_OPERATORS.has(operator)) {
296
+ continue;
297
+ }
298
+ const low = range.Low != null ? String(range.Low) : undefined;
299
+ const high = range.High != null ? String(range.High) : undefined;
300
+ if (low === undefined || (operator === 'BT' && high === undefined)) {
301
+ continue;
302
+ }
303
+ const value = normalizeFilterValue(low, propertyName, entityType);
304
+ const item = { property: propertyName, value, ...(operator !== 'EQ' && { operator }) };
305
+ if (operator === 'BT') {
306
+ item.value2 = normalizeFilterValue(high ?? '', propertyName, entityType);
307
+ }
308
+ result.push(item);
309
+ }
310
+ return result;
311
+ }
312
+ /**
313
+ * Builds a single FilterBarItem, resolving i18n labels for custom filter fields via OData metadata.
314
+ *
315
+ * @param entry - the raw filter field entry with property name and description
316
+ * @param entry.property - the OData property name of the filter field
317
+ * @param entry.description - the rendered label of the filter field
318
+ * @param customFilterFieldProperties - set of property names declared as custom filter fields in the manifest
319
+ * @param convertedMetadata - optional converted OData metadata for label resolution
320
+ * @param entitySetName - the entity set name for metadata lookup
321
+ * @returns the resolved FilterBarItem
322
+ */
323
+ function buildFilterBarItem(entry, customFilterFieldProperties, convertedMetadata, entitySetName) {
324
+ const custom = customFilterFieldProperties.has(entry.property);
325
+ let description = entry.description;
326
+ if (custom &&
327
+ typeof description === 'string' &&
328
+ description.startsWith('{i18n>') &&
329
+ convertedMetadata &&
330
+ entitySetName) {
331
+ const resolved = getPropertyLabelFromMetadata(convertedMetadata, entitySetName, entry.property);
332
+ if (resolved) {
333
+ description = resolved;
334
+ }
335
+ }
336
+ return { property: entry.property, description, custom };
337
+ }
338
+ /**
339
+ * Parses and converts OData metadata, extracting button visibility, semantic key properties, and toolbar actions.
340
+ *
341
+ * @param metadata - raw metadata XML string
342
+ * @param entitySetName - the entity set name
343
+ * @param toolbarActions - raw toolbar action names to resolve
344
+ * @param log - optional logger
345
+ * @param annotationXmls - annotation XML documents to merge
346
+ * @returns converted metadata and extracted features, or empty defaults if parsing fails
347
+ */
348
+ function convertMetadataFeatures(metadata, entitySetName, toolbarActions, log, annotationXmls) {
349
+ if (!metadata || !entitySetName) {
350
+ return {
351
+ convertedMetadata: undefined,
352
+ buttonVisibility: undefined,
353
+ semanticKeyProperties: undefined,
354
+ toolBarActions: []
355
+ };
356
+ }
357
+ try {
358
+ // Merge local annotation files with the service metadata before converting. Each source must be parsed
359
+ // with a distinct fileId; otherwise merge treats them as the same file and later `Annotations` blocks
360
+ // overwrite (rather than complement) the metadata's property-level annotations.
361
+ const parsedAnnotations = annotationXmls.map((xml, index) => parse(xml, `annotationFile${index}`));
362
+ const rawMetadata = parsedAnnotations.length
363
+ ? merge(parse(metadata, 'metadata'), ...parsedAnnotations)
364
+ : parse(metadata);
365
+ const convertedMetadata = convert(rawMetadata);
366
+ // IsActionCritical is an annotation-only term surfaced by the merge above; read it off the
367
+ // already-converted metadata rather than re-parsing.
368
+ const criticalActions = collectCriticalActionNames(convertedMetadata);
369
+ return {
370
+ convertedMetadata,
371
+ buttonVisibility: safeCheckButtonVisibilityFromMetadata(convertedMetadata, entitySetName, log),
372
+ semanticKeyProperties: safeGetSemanticKeyProperties(convertedMetadata, entitySetName, log),
373
+ toolBarActions: safeCheckActionButtonStates(convertedMetadata, entitySetName, toolbarActions, log, criticalActions)
374
+ };
375
+ }
376
+ catch (error) {
377
+ log?.debug(`Failed to parse metadata: ${error instanceof Error ? error.message : String(error)}`);
378
+ return {
379
+ convertedMetadata: undefined,
380
+ buttonVisibility: undefined,
381
+ semanticKeyProperties: undefined,
382
+ toolBarActions: []
383
+ };
384
+ }
385
+ }
148
386
  /**
149
387
  * Gets List Report features from the page model using ux-specification.
150
388
  *
@@ -160,55 +398,12 @@ export function getListReportFeatures(listReportPage, log, metadata, manifest, r
160
398
  const toolbarActions = getToolBarActionNames(listReportPage.model, log);
161
399
  const filterFieldEntries = getFilterFieldItems(listReportPage.model, log);
162
400
  const customFilterFieldProperties = getCustomFilterFieldProperties(manifest, listReportPage.name);
163
- let buttonVisibility;
164
- let semanticKeyProperties;
165
- let toolBarActions = [];
166
- let convertedMetadata;
167
- if (metadata && listReportPage.entitySet) {
168
- const entitySetName = listReportPage.entitySet;
169
- try {
170
- // Merge local annotation files (e.g. UI.TextArrangement defined only in annotation.xml)
171
- // with the service metadata before converting. Each source must be parsed with a distinct
172
- // fileId; otherwise merge treats them as the same file and later `Annotations` blocks
173
- // overwrite (rather than complement) the metadata's property-level annotations.
174
- const parsedAnnotations = annotationXmls.map((xml, index) => parse(xml, `annotationFile${index}`));
175
- const rawMetadata = parsedAnnotations.length
176
- ? merge(parse(metadata, 'metadata'), ...parsedAnnotations)
177
- : parse(metadata);
178
- convertedMetadata = convert(rawMetadata);
179
- // IsActionCritical is an annotation-only term surfaced by the merge above; read it off the
180
- // already-converted metadata rather than re-parsing.
181
- const criticalActions = collectCriticalActionNames(convertedMetadata);
182
- buttonVisibility = safeCheckButtonVisibilityFromMetadata(convertedMetadata, entitySetName, log);
183
- semanticKeyProperties = safeGetSemanticKeyProperties(convertedMetadata, entitySetName, log);
184
- toolBarActions = safeCheckActionButtonStates(convertedMetadata, entitySetName, toolbarActions, log, criticalActions);
185
- }
186
- catch (error) {
187
- log?.debug(`Failed to parse metadata: ${error instanceof Error ? error.message : String(error)}`);
188
- }
189
- }
190
- // Custom (manifest-declared) and menu (drop-down) toolbar actions have no OData counterpart in
191
- // `safeCheckActionButtonStates` (which matches annotation actions by name). extractCustomToolBarActions
192
- // adds custom actions (matched by label) and menu buttons with their child actions, without
193
- // duplicating the annotation-backed actions already captured above.
401
+ const { convertedMetadata, buttonVisibility, semanticKeyProperties, toolBarActions: metadataActions } = convertMetadataFeatures(metadata, listReportPage.entitySet, toolbarActions, log, annotationXmls);
402
+ let toolBarActions = metadataActions;
194
403
  toolBarActions = toolBarActions.concat(extractCustomToolBarActions(listReportPage.model, resolveLabel, convertedMetadata));
195
404
  // Custom filter fields are matched by rendered label, so resolve unresolved i18n
196
405
  // placeholders via the property's OData `@Common.Label`.
197
- const filterBarItems = filterFieldEntries.map((entry) => {
198
- const custom = customFilterFieldProperties.has(entry.property);
199
- let description = entry.description;
200
- if (custom &&
201
- typeof description === 'string' &&
202
- description.startsWith('{i18n>') &&
203
- convertedMetadata &&
204
- listReportPage.entitySet) {
205
- const resolved = getPropertyLabelFromMetadata(convertedMetadata, listReportPage.entitySet, entry.property);
206
- if (resolved) {
207
- description = resolved;
208
- }
209
- }
210
- return { property: entry.property, description, custom };
211
- });
406
+ const filterBarItems = filterFieldEntries.map((entry) => buildFilterBarItem(entry, customFilterFieldProperties, convertedMetadata, listReportPage.entitySet));
212
407
  const filterBarProperties = filterBarItems.map((item) => item.property);
213
408
  const missingKeys = semanticKeyProperties?.length && filterBarProperties.length
214
409
  ? semanticKeyProperties
@@ -222,6 +417,17 @@ export function getListReportFeatures(listReportPage, log, metadata, manifest, r
222
417
  const textAnnotationColumns = meta
223
418
  ? buildTextAnnotationColumns(extractTextAnnotationColumnsFromNode(listReportPage.model.root), isAnalyticalTable)
224
419
  : [];
420
+ const tabs = getListReportTabs(listReportPage, convertedMetadata, manifest, resolveLabel, log);
421
+ const entitySet = listReportPage.entitySet ?? '';
422
+ const singleTableAnnotationPath = !tabs.length
423
+ ? getDefaultTemplateAnnotationPath(manifest, listReportPage.name)
424
+ : undefined;
425
+ const defaultSortOrder = convertedMetadata && !tabs.length
426
+ ? getDefaultSortOrder(convertedMetadata, entitySet, singleTableAnnotationPath)
427
+ : [];
428
+ const defaultFilterValues = convertedMetadata && !tabs.length
429
+ ? getDefaultFilterValues(convertedMetadata, entitySet, singleTableAnnotationPath)
430
+ : [];
225
431
  return {
226
432
  name: listReportPage.name,
227
433
  createButton: buildButtonState(buttonVisibility?.create),
@@ -234,11 +440,13 @@ export function getListReportFeatures(listReportPage, log, metadata, manifest, r
234
440
  columnPersonalizationSupported: isColumnPersonalizationEnabled(manifest, listReportPage.name, listReportPage.contextPath),
235
441
  isALP: manifest ? isALPFromManifest(manifest, listReportPage.name) : false,
236
442
  tableIdentifiers: getTableIdentifiers(manifest, listReportPage.name),
237
- tabs: getListReportTabs(listReportPage, convertedMetadata, manifest, resolveLabel, log),
443
+ tabs,
238
444
  semanticKey: {
239
445
  semanticKeyProperties,
240
446
  missingFromFilterBar: missingKeys?.length ? missingKeys : undefined
241
- }
447
+ },
448
+ ...(defaultSortOrder.length && { defaultSortOrder }),
449
+ ...(defaultFilterValues.length && { defaultFilterValues })
242
450
  };
243
451
  }
244
452
  /**
@@ -374,6 +582,9 @@ export function getListReportTabs(listReportPage, convertedMetadata, manifest, r
374
582
  const isAnalyticalTable = getViewTableType(manifest, listReportPage.name, view.annotationPath) === 'AnalyticalTable';
375
583
  textAnnotationColumns = buildTextAnnotationColumns(candidates, isAnalyticalTable);
376
584
  }
585
+ const defaultSortOrder = convertedMetadata && entitySet
586
+ ? getDefaultSortOrder(convertedMetadata, entitySet, view.annotationPath)
587
+ : [];
377
588
  tabs.push({
378
589
  key: view.key,
379
590
  entitySet,
@@ -383,7 +594,8 @@ export function getListReportTabs(listReportPage, convertedMetadata, manifest, r
383
594
  createButton,
384
595
  deleteButton,
385
596
  textAnnotationColumns,
386
- columnPersonalizationSupported: isViewColumnPersonalizationEnabled(manifest, listReportPage.name, view.annotationPath)
597
+ columnPersonalizationSupported: isViewColumnPersonalizationEnabled(manifest, listReportPage.name, view.annotationPath),
598
+ ...(defaultSortOrder.length && { defaultSortOrder })
387
599
  });
388
600
  });
389
601
  return tabs;
@@ -555,7 +767,7 @@ export function isViewColumnPersonalizationEnabled(manifest, targetKey, annotati
555
767
  const lineItemTerm = '@com.sap.vocabularies.UI.v1.LineItem';
556
768
  const hashIndex = annotationPath?.indexOf('#') ?? -1;
557
769
  const qualifier = hashIndex >= 0 ? annotationPath?.slice(hashIndex + 1) : undefined;
558
- const entry = (qualifier && controlConfiguration[`${lineItemTerm}#${qualifier}`]) || controlConfiguration[lineItemTerm];
770
+ const entry = (qualifier && controlConfiguration[`${lineItemTerm}#${qualifier}`]) ?? controlConfiguration[lineItemTerm];
559
771
  const tableSettings = entry
560
772
  ?.tableSettings;
561
773
  return interpretColumnPersonalization(tableSettings?.personalization);
@@ -581,7 +793,7 @@ export function getViewTableType(manifest, targetKey, annotationPath) {
581
793
  const lineItemTerm = '@com.sap.vocabularies.UI.v1.LineItem';
582
794
  const hashIndex = annotationPath?.indexOf('#') ?? -1;
583
795
  const qualifier = hashIndex >= 0 ? annotationPath?.slice(hashIndex + 1) : undefined;
584
- const entry = (qualifier && controlConfiguration[`${lineItemTerm}#${qualifier}`]) || controlConfiguration[lineItemTerm];
796
+ const entry = (qualifier && controlConfiguration[`${lineItemTerm}#${qualifier}`]) ?? controlConfiguration[lineItemTerm];
585
797
  const type = entry?.tableSettings?.type;
586
798
  return typeof type === 'string' ? type : undefined;
587
799
  }
@@ -487,8 +487,10 @@ function extractFormFields(subSection, convertedMetadata, entitySetName) {
487
487
  });
488
488
  }
489
489
  else if (annotationParts.property === 'FieldGroup' && entityType) {
490
- resolveFieldGroupInnerProperties(entityType, qualifier).forEach((property) => {
491
- fields.push({ property, fieldGroup: qualifier });
490
+ const innerProperties = resolveFieldGroupInnerProperties(entityType, qualifier);
491
+ const checkBoxGroup = isCheckBoxGroup(entityType, innerProperties);
492
+ innerProperties.forEach((property) => {
493
+ fields.push({ property, fieldGroup: qualifier, ...(checkBoxGroup && { checkBoxGroup }) });
492
494
  });
493
495
  }
494
496
  // ConnectedFields/FieldGroup without metadata: skip
@@ -537,6 +539,21 @@ function resolveFieldGroupInnerProperties(entityType, qualifier) {
537
539
  const dataFields = annotation?.Data ?? [];
538
540
  return dataFields.map((dataField) => dataField?.Value?.path).filter((path) => Boolean(path));
539
541
  }
542
+ /**
543
+ * Determines whether a FieldGroup's inner properties render as a group of checkboxes.
544
+ *
545
+ * Fiori Elements renders a nested FieldGroup as a checkbox group when every inner field is boolean.
546
+ * Such members live inside a single FormElement and are not addressable by the sap.fe.test.api form API,
547
+ * so the generator must flag them to avoid emitting unpassable `iCheckField` steps.
548
+ *
549
+ * @param entityType - the entity type carrying the properties
550
+ * @param properties - the FieldGroup inner property paths
551
+ * @returns true when the group is non-empty and all inner properties are `Edm.Boolean`
552
+ */
553
+ function isCheckBoxGroup(entityType, properties) {
554
+ return (properties.length > 0 &&
555
+ properties.every((property) => entityType.entityProperties.find((p) => p.name === property)?.type === 'Edm.Boolean'));
556
+ }
540
557
  /**
541
558
  * Looks up the entity type for the given entity set name in the converted metadata.
542
559
  *
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.18.3",
4
+ "version": "1.19.1",
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/ui5-application-writer": "2.1.6",
31
32
  "@sap-ux/logger": "1.0.3",
32
- "@sap-ux/fiori-generator-shared": "1.2.22",
33
+ "@sap-ux/fiori-generator-shared": "1.2.23",
33
34
  "@sap-ux/project-access": "2.3.1",
34
- "@sap-ux/ui5-application-writer": "2.1.6",
35
- "@sap-ux/preview-middleware": "1.2.27"
35
+ "@sap-ux/preview-middleware": "1.2.28"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@jest/globals": "30.4.1",
@@ -15,10 +15,12 @@
15
15
  * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
16
  ******************************************************************************/
17
17
 
18
+ <%_ const needsSortOrder = startLR && ((defaultSortOrder && defaultSortOrder.length > 0) || (tabs && tabs.some(function(tab) { return tab.defaultSortOrder && tab.defaultSortOrder.length > 0; }))); -%>
18
19
  sap.ui.define([
19
20
  "sap/ui/test/opaQunit",
20
- "./pages/JourneyRunner"
21
- ], function (opaTest, runner) {
21
+ "./pages/JourneyRunner"<% if (needsSortOrder) { %>,
22
+ "sap/ui/core/library"<% } %>
23
+ ], function (opaTest, runner<% if (needsSortOrder) { %>, coreLibrary<% } %>) {
22
24
  "use strict";
23
25
 
24
26
  function journey() {
@@ -127,6 +129,15 @@ sap.ui.define([
127
129
  Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckColumns(undefined, <%- JSON.stringify(tab.tableColumns) %>);
128
130
  });
129
131
 
132
+ <%_ } -%>
133
+ <%_ if (tab.defaultSortOrder && tab.defaultSortOrder.length > 0) { -%>
134
+ opaTest(<%- JSON.stringify("Check default sort order from PresentationVariant in view " + tab.key) %>, function (Given, When, Then) {
135
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
136
+ <%_ tab.defaultSortOrder.forEach(function(sort) { _%>
137
+ Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckSortOrder({ name: "<%- sort.property %>" }, coreLibrary.SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
138
+ <%_ }); -%>
139
+ });
140
+
130
141
  <%_ } -%>
131
142
  opaTest(<%- JSON.stringify("Check table rows in view " + tab.key) %>, function (Given, When, Then) {
132
143
  When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
@@ -185,6 +196,22 @@ sap.ui.define([
185
196
  });
186
197
 
187
198
  <%_ } -%>
199
+ <%_ } -%>
200
+ <%_ if (startLR && defaultSortOrder && defaultSortOrder.length > 0) { -%>
201
+ opaTest("Check default sort order from PresentationVariant", function (Given, When, Then) {
202
+ <%_ defaultSortOrder.forEach(function(sort) { _%>
203
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- sort.property %>" }, coreLibrary.SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
204
+ <%_ }); -%>
205
+ });
206
+
207
+ <%_ } -%>
208
+ <%_ if (startLR && defaultFilterValues && defaultFilterValues.length > 0) { -%>
209
+ opaTest("Check default filter values from SelectionVariant", function (Given, When, Then) {
210
+ <%_ defaultFilterValues.forEach(function(filter) { _%>
211
+ Then.onThe<%- startLR %>Generated.onFilterBar().iCheckFilterField({ property: <%- JSON.stringify(filter.property) %> }, <%- filter.value2 !== undefined ? JSON.stringify([filter.value, filter.value2]) : JSON.stringify(filter.value) %><%- filter.operator ? ', ' + JSON.stringify(filter.operator) : '' %>);
212
+ <%_ }); -%>
213
+ });
214
+
188
215
  <%_ } -%>
189
216
  <%_ if (startLR) { -%>
190
217
  opaTest("Navigate to ObjectPage", function (Given, When, Then) {
@@ -25,6 +25,10 @@ const usesFilterFieldIdentifier =
25
25
  import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
26
26
  <% } -%>
27
27
  import runner from "./pages/JourneyRunner";
28
+ <%_ const needsSortOrder = startLR && ((defaultSortOrder && defaultSortOrder.length > 0) || (tabs && tabs.some(function(tab) { return tab.defaultSortOrder && tab.defaultSortOrder.length > 0; }))); -%>
29
+ <%_ if (needsSortOrder) { -%>
30
+ import { SortOrder } from "sap/ui/core/library";
31
+ <%_ } -%>
28
32
 
29
33
  function journey() {
30
34
  QUnit.module("<%- name%>ListReport journey");
@@ -132,6 +136,15 @@ function journey() {
132
136
  Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckColumns(undefined, <%- JSON.stringify(tab.tableColumns) %>);
133
137
  });
134
138
 
139
+ <%_ } -%>
140
+ <%_ if (tab.defaultSortOrder && tab.defaultSortOrder.length > 0) { -%>
141
+ opaTest(<%- JSON.stringify("Check default sort order from PresentationVariant in view " + tab.key) %>, function (_Given: Given, _When: When, Then: Then) {
142
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
143
+ <%_ tab.defaultSortOrder.forEach(function(sort) { _%>
144
+ Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckSortOrder({ name: "<%- sort.property %>" }, SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
145
+ <%_ }); -%>
146
+ });
147
+
135
148
  <%_ } -%>
136
149
  opaTest(<%- JSON.stringify("Check table rows in view " + tab.key) %>, function (_Given: Given, When: When, Then: Then) {
137
150
  When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
@@ -191,6 +204,22 @@ function journey() {
191
204
  });
192
205
 
193
206
  <%_ } -%>
207
+ <%_ } -%>
208
+ <%_ if (startLR && defaultSortOrder && defaultSortOrder.length > 0) { -%>
209
+ opaTest("Check default sort order from PresentationVariant", function (_Given: Given, _When: When, Then: Then) {
210
+ <%_ defaultSortOrder.forEach(function(sort) { _%>
211
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- sort.property %>" }, SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
212
+ <%_ }); -%>
213
+ });
214
+
215
+ <%_ } -%>
216
+ <%_ if (startLR && defaultFilterValues && defaultFilterValues.length > 0) { -%>
217
+ opaTest("Check default filter values from SelectionVariant", function (_Given: Given, _When: When, Then: Then) {
218
+ <%_ defaultFilterValues.forEach(function(filter) { _%>
219
+ Then.onThe<%- startLR %>Generated.onFilterBar().iCheckFilterField({ property: <%- JSON.stringify(filter.property) %> }, <%- filter.value2 !== undefined ? JSON.stringify([filter.value, filter.value2]) : JSON.stringify(filter.value) %><%- filter.operator ? ', ' + JSON.stringify(filter.operator) : '' %>);
220
+ <%_ }); -%>
221
+ });
222
+
194
223
  <%_ } -%>
195
224
  <%_ if (startLR) { -%>
196
225
  opaTest("Navigate to ObjectPage", function (_Given: Given, When: When, Then: Then) {
@@ -187,8 +187,15 @@ sap.ui.define([
187
187
  Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" });
188
188
  <% } -%>
189
189
  <% if (subSection.fields && subSection.fields.length > 0) { -%>
190
- <% subSection.fields.forEach(function(field) { -%>
190
+ <% subSection.fields.forEach(function(field, fieldIndex) { -%>
191
+ <% if (field.checkBoxGroup) { -%>
192
+ <% if (fieldIndex === 0 || !subSection.fields[fieldIndex - 1].checkBoxGroup) { -%>
193
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
194
+ <% } -%>
195
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
196
+ <% } else { -%>
191
197
  Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
198
+ <% } -%>
192
199
  <% }) -%>
193
200
  <% } -%>
194
201
  <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
@@ -197,8 +204,15 @@ sap.ui.define([
197
204
  <% }) -%>
198
205
  <% } else { -%>
199
206
  <% if (section.fields && section.fields.length > 0) { -%>
200
- <% section.fields.forEach(function(field) { -%>
207
+ <% section.fields.forEach(function(field, fieldIndex) { -%>
208
+ <% if (field.checkBoxGroup) { -%>
209
+ <% if (fieldIndex === 0 || !section.fields[fieldIndex - 1].checkBoxGroup) { -%>
210
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
211
+ <% } -%>
212
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
213
+ <% } else { -%>
201
214
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
215
+ <% } -%>
202
216
  <% }) -%>
203
217
  <% } -%>
204
218
  <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
@@ -23,9 +23,9 @@ const usesFieldIdentifier = (headerSections || []).some(function(section) {
23
23
  });
24
24
  const usesFormIdentifier = (bodySections || []).some(function(section) {
25
25
  const subSectionsHaveForm = (section.subSections || []).some(function(sub) {
26
- return sub.fields && sub.fields.length > 0;
26
+ return sub.fields && sub.fields.some(function(field) { return !field.checkBoxGroup; });
27
27
  });
28
- const sectionHasFormFields = !(section.subSections && section.subSections.length > 0) && section.fields && section.fields.length > 0;
28
+ const sectionHasFormFields = !(section.subSections && section.subSections.length > 0) && section.fields && section.fields.some(function(field) { return !field.checkBoxGroup; });
29
29
  const hasFormAction = (section.actions || []).some(function(action) {
30
30
  return action.visible && !(section.isTable && section.navigationProperty);
31
31
  });
@@ -208,8 +208,15 @@ function journey() {
208
208
  Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" }, {});
209
209
  <% } -%>
210
210
  <% if (subSection.fields && subSection.fields.length > 0) { -%>
211
- <% subSection.fields.forEach(function(field) { -%>
211
+ <% subSection.fields.forEach(function(field, fieldIndex) { -%>
212
+ <% if (field.checkBoxGroup) { -%>
213
+ <% if (fieldIndex === 0 || !subSection.fields[fieldIndex - 1].checkBoxGroup) { -%>
214
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
215
+ <% } -%>
216
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
217
+ <% } else { -%>
212
218
  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 %>"<% } %> });
219
+ <% } -%>
213
220
  <% }) -%>
214
221
  <% } -%>
215
222
  <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
@@ -218,8 +225,15 @@ function journey() {
218
225
  <% }) -%>
219
226
  <% } else { -%>
220
227
  <% if (section.fields && section.fields.length > 0) { -%>
221
- <% section.fields.forEach(function(field) { -%>
228
+ <% section.fields.forEach(function(field, fieldIndex) { -%>
229
+ <% if (field.checkBoxGroup) { -%>
230
+ <% if (fieldIndex === 0 || !section.fields[fieldIndex - 1].checkBoxGroup) { -%>
231
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
232
+ <% } -%>
233
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
234
+ <% } else { -%>
222
235
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
236
+ <% } -%>
223
237
  <% }) -%>
224
238
  <% } -%>
225
239
  <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
@@ -15,10 +15,12 @@
15
15
  * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
16
  ******************************************************************************/
17
17
 
18
+ <%_ const needsSortOrder = startLR && ((textAnnotationColumns && textAnnotationColumns.length > 0) || (defaultSortOrder && defaultSortOrder.length > 0) || (tabs && tabs.some(function(tab) { return (tab.textAnnotationColumns && tab.textAnnotationColumns.length > 0) || (tab.defaultSortOrder && tab.defaultSortOrder.length > 0); }))); -%>
18
19
  sap.ui.define([
19
20
  "sap/ui/test/opaQunit",
20
- "./pages/JourneyRunner"
21
- ], function (opaTest, runner) {
21
+ "./pages/JourneyRunner"<% if (needsSortOrder) { %>,
22
+ "sap/ui/core/library"<% } %>
23
+ ], function (opaTest, runner<% if (needsSortOrder) { %>, coreLibrary<% } %>) {
22
24
  "use strict";
23
25
 
24
26
  function journey() {
@@ -197,6 +199,15 @@ sap.ui.define([
197
199
  Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckColumns(undefined, <%- JSON.stringify(tab.tableColumns) %>);
198
200
  });
199
201
 
202
+ <%_ } -%>
203
+ <%_ if (tab.defaultSortOrder && tab.defaultSortOrder.length > 0) { -%>
204
+ opaTest(<%- JSON.stringify("Check default sort order from PresentationVariant in view " + tab.key) %>, function (Given, When, Then) {
205
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
206
+ <%_ tab.defaultSortOrder.forEach(function(sort) { _%>
207
+ Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckSortOrder({ name: "<%- sort.property %>" }, coreLibrary.SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
208
+ <%_ }); -%>
209
+ });
210
+
200
211
  <%_ } -%>
201
212
  <%_ if (tab.textAnnotationColumns && tab.textAnnotationColumns.length > 0) { -%>
202
213
  <%_ if (tab.columnPersonalizationSupported !== false) { -%>
@@ -350,6 +361,22 @@ sap.ui.define([
350
361
  Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
351
362
  });
352
363
 
364
+ <%_ } -%>
365
+ <%_ if (startLR && defaultSortOrder && defaultSortOrder.length > 0) { -%>
366
+ opaTest("Check default sort order from PresentationVariant", function (Given, When, Then) {
367
+ <%_ defaultSortOrder.forEach(function(sort) { _%>
368
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- sort.property %>" }, coreLibrary.SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
369
+ <%_ }); -%>
370
+ });
371
+
372
+ <%_ } -%>
373
+ <%_ if (startLR && defaultFilterValues && defaultFilterValues.length > 0) { -%>
374
+ opaTest("Check default filter values from SelectionVariant", function (Given, When, Then) {
375
+ <%_ defaultFilterValues.forEach(function(filter) { _%>
376
+ Then.onThe<%- startLR %>Generated.onFilterBar().iCheckFilterField({ property: <%- JSON.stringify(filter.property) %> }, <%- filter.value2 !== undefined ? JSON.stringify([filter.value, filter.value2]) : JSON.stringify(filter.value) %><%- filter.operator ? ', ' + JSON.stringify(filter.operator) : '' %>);
377
+ <%_ }); -%>
378
+ });
379
+
353
380
  <%_ } -%>
354
381
  <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0 && columnPersonalizationSupported !== false) { -%>
355
382
  opaTest("Check the presence of the text columns for columns with a Text annotation", function (Given, When, Then) {
@@ -25,6 +25,10 @@ const usesFilterFieldIdentifier =
25
25
  import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
26
26
  <% } -%>
27
27
  import runner from "./pages/JourneyRunner";
28
+ <%_ const needsSortOrder = startLR && ((textAnnotationColumns && textAnnotationColumns.length > 0) || (defaultSortOrder && defaultSortOrder.length > 0) || (tabs && tabs.some(function(tab) { return (tab.textAnnotationColumns && tab.textAnnotationColumns.length > 0) || (tab.defaultSortOrder && tab.defaultSortOrder.length > 0); }))); -%>
29
+ <%_ if (needsSortOrder) { -%>
30
+ import { SortOrder } from "sap/ui/core/library";
31
+ <%_ } -%>
28
32
 
29
33
  function journey() {
30
34
  QUnit.module("<%- name%>ListReport journey");
@@ -202,6 +206,15 @@ function journey() {
202
206
  Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckColumns(undefined, <%- JSON.stringify(tab.tableColumns) %>);
203
207
  });
204
208
 
209
+ <%_ } -%>
210
+ <%_ if (tab.defaultSortOrder && tab.defaultSortOrder.length > 0) { -%>
211
+ opaTest(<%- JSON.stringify("Check default sort order from PresentationVariant in view " + tab.key) %>, function (_Given: Given, _When: When, Then: Then) {
212
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
213
+ <%_ tab.defaultSortOrder.forEach(function(sort) { _%>
214
+ Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckSortOrder({ name: "<%- sort.property %>" }, SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
215
+ <%_ }); -%>
216
+ });
217
+
205
218
  <%_ } -%>
206
219
  <%_ if (tab.textAnnotationColumns && tab.textAnnotationColumns.length > 0) { -%>
207
220
  <%_ if (tab.columnPersonalizationSupported !== false) { -%>
@@ -356,6 +369,22 @@ function journey() {
356
369
  Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
357
370
  });
358
371
 
372
+ <%_ } -%>
373
+ <%_ if (startLR && defaultSortOrder && defaultSortOrder.length > 0) { -%>
374
+ opaTest("Check default sort order from PresentationVariant", function (_Given: Given, _When: When, Then: Then) {
375
+ <%_ defaultSortOrder.forEach(function(sort) { _%>
376
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- sort.property %>" }, SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
377
+ <%_ }); -%>
378
+ });
379
+
380
+ <%_ } -%>
381
+ <%_ if (startLR && defaultFilterValues && defaultFilterValues.length > 0) { -%>
382
+ opaTest("Check default filter values from SelectionVariant", function (_Given: Given, _When: When, Then: Then) {
383
+ <%_ defaultFilterValues.forEach(function(filter) { _%>
384
+ Then.onThe<%- startLR %>Generated.onFilterBar().iCheckFilterField({ property: <%- JSON.stringify(filter.property) %> }, <%- filter.value2 !== undefined ? JSON.stringify([filter.value, filter.value2]) : JSON.stringify(filter.value) %><%- filter.operator ? ', ' + JSON.stringify(filter.operator) : '' %>);
385
+ <%_ }); -%>
386
+ });
387
+
359
388
  <%_ } -%>
360
389
  <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0 && columnPersonalizationSupported !== false) { -%>
361
390
  opaTest("Check the presence of the text columns for columns with a Text annotation", function (_Given: Given, When: When, Then: Then) {
@@ -255,8 +255,15 @@ sap.ui.define([
255
255
  Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" });
256
256
  <% } -%>
257
257
  <% if (subSection.fields && subSection.fields.length > 0) { -%>
258
- <% subSection.fields.forEach(function(field) { -%>
258
+ <% subSection.fields.forEach(function(field, fieldIndex) { -%>
259
+ <% if (field.checkBoxGroup) { -%>
260
+ <% if (fieldIndex === 0 || !subSection.fields[fieldIndex - 1].checkBoxGroup) { -%>
261
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
262
+ <% } -%>
263
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
264
+ <% } else { -%>
259
265
  Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
266
+ <% } -%>
260
267
  <% }) -%>
261
268
  <% } -%>
262
269
  <% subSection.contactCardFields.forEach(function(field) { -%>
@@ -275,8 +282,15 @@ sap.ui.define([
275
282
  <% }) -%>
276
283
  <% } else { -%>
277
284
  <% if (section.fields && section.fields.length > 0) { -%>
278
- <% section.fields.forEach(function(field) { -%>
285
+ <% section.fields.forEach(function(field, fieldIndex) { -%>
286
+ <% if (field.checkBoxGroup) { -%>
287
+ <% if (fieldIndex === 0 || !section.fields[fieldIndex - 1].checkBoxGroup) { -%>
288
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
289
+ <% } -%>
290
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
291
+ <% } else { -%>
279
292
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
293
+ <% } -%>
280
294
  <% }) -%>
281
295
  <% } -%>
282
296
  <% section.contactCardFields.forEach(function(field) { -%>
@@ -23,9 +23,9 @@ const usesFieldIdentifier = (headerSections || []).some(function(section) {
23
23
  });
24
24
  const usesFormIdentifier = (bodySections || []).some(function(section) {
25
25
  const subSectionsHaveForm = (section.subSections || []).some(function(sub) {
26
- return sub.fields && sub.fields.length > 0;
26
+ return sub.fields && sub.fields.some(function(field) { return !field.checkBoxGroup; });
27
27
  });
28
- const sectionHasFormFields = !(section.subSections && section.subSections.length > 0) && section.fields && section.fields.length > 0;
28
+ const sectionHasFormFields = !(section.subSections && section.subSections.length > 0) && section.fields && section.fields.some(function(field) { return !field.checkBoxGroup; });
29
29
  const hasFormAction = (section.actions || []).some(function(action) {
30
30
  return action.visible && !(section.isTable && section.navigationProperty);
31
31
  });
@@ -283,8 +283,15 @@ function journey() {
283
283
  Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" }, {});
284
284
  <% } -%>
285
285
  <% if (subSection.fields && subSection.fields.length > 0) { -%>
286
- <% subSection.fields.forEach(function(field) { -%>
286
+ <% subSection.fields.forEach(function(field, fieldIndex) { -%>
287
+ <% if (field.checkBoxGroup) { -%>
288
+ <% if (fieldIndex === 0 || !subSection.fields[fieldIndex - 1].checkBoxGroup) { -%>
289
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
290
+ <% } -%>
291
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
292
+ <% } else { -%>
287
293
  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 %>"<% } %> });
294
+ <% } -%>
288
295
  <% }) -%>
289
296
  <% } -%>
290
297
  <% subSection.contactCardFields.forEach(function(field) { -%>
@@ -303,8 +310,15 @@ function journey() {
303
310
  <% }) -%>
304
311
  <% } else { -%>
305
312
  <% if (section.fields && section.fields.length > 0) { -%>
306
- <% section.fields.forEach(function(field) { -%>
313
+ <% section.fields.forEach(function(field, fieldIndex) { -%>
314
+ <% if (field.checkBoxGroup) { -%>
315
+ <% if (fieldIndex === 0 || !section.fields[fieldIndex - 1].checkBoxGroup) { -%>
316
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
317
+ <% } -%>
318
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
319
+ <% } else { -%>
307
320
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
321
+ <% } -%>
308
322
  <% }) -%>
309
323
  <% } -%>
310
324
  <% section.contactCardFields.forEach(function(field) { -%>
@@ -15,10 +15,12 @@
15
15
  * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
16
  ******************************************************************************/
17
17
 
18
+ <%_ const needsSortOrder = startLR && (defaultSortOrder && defaultSortOrder.length > 0); -%>
18
19
  sap.ui.define([
19
20
  "sap/ui/test/opaQunit",
20
- "./pages/JourneyRunner"
21
- ], function (opaTest, runner) {
21
+ "./pages/JourneyRunner"<% if (needsSortOrder) { %>,
22
+ "sap/ui/core/library"<% } %>
23
+ ], function (opaTest, runner<% if (needsSortOrder) { %>, coreLibrary<% } %>) {
22
24
  "use strict";
23
25
 
24
26
  function journey() {
@@ -103,6 +105,22 @@ sap.ui.define([
103
105
  Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
104
106
  });
105
107
 
108
+ <%_ } -%>
109
+ <%_ if (startLR && defaultSortOrder && defaultSortOrder.length > 0) { -%>
110
+ opaTest("Check default sort order from PresentationVariant", function (Given, When, Then) {
111
+ <%_ defaultSortOrder.forEach(function(sort) { _%>
112
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- sort.property %>" }, coreLibrary.SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
113
+ <%_ }); -%>
114
+ });
115
+
116
+ <%_ } -%>
117
+ <%_ if (startLR && defaultFilterValues && defaultFilterValues.length > 0) { -%>
118
+ opaTest("Check default filter values from SelectionVariant", function (Given, When, Then) {
119
+ <%_ defaultFilterValues.forEach(function(filter) { _%>
120
+ Then.onThe<%- startLR %>Generated.onFilterBar().iCheckFilterField({ property: <%- JSON.stringify(filter.property) %> }, <%- filter.value2 !== undefined ? JSON.stringify([filter.value, filter.value2]) : JSON.stringify(filter.value) %><%- filter.operator ? ', ' + JSON.stringify(filter.operator) : '' %>);
121
+ <%_ }); -%>
122
+ });
123
+
106
124
  <%_ } -%>
107
125
  <%_ if (startLR) { -%>
108
126
  opaTest("Navigate to ObjectPage", function (Given, When, Then) {
@@ -25,6 +25,10 @@ const usesFilterFieldIdentifier =
25
25
  import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
26
26
  <% } -%>
27
27
  import runner from "./pages/JourneyRunner";
28
+ <%_ const needsSortOrder = startLR && ((defaultSortOrder && defaultSortOrder.length > 0)); -%>
29
+ <%_ if (needsSortOrder) { -%>
30
+ import { SortOrder } from "sap/ui/core/library";
31
+ <%_ } -%>
28
32
 
29
33
  function journey() {
30
34
  QUnit.module("<%- name%>ListReport journey");
@@ -108,6 +112,22 @@ function journey() {
108
112
  Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
109
113
  });
110
114
 
115
+ <%_ } -%>
116
+ <%_ if (startLR && defaultSortOrder && defaultSortOrder.length > 0) { -%>
117
+ opaTest("Check default sort order from PresentationVariant", function (_Given: Given, _When: When, Then: Then) {
118
+ <%_ defaultSortOrder.forEach(function(sort) { _%>
119
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- sort.property %>" }, SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
120
+ <%_ }); -%>
121
+ });
122
+
123
+ <%_ } -%>
124
+ <%_ if (startLR && defaultFilterValues && defaultFilterValues.length > 0) { -%>
125
+ opaTest("Check default filter values from SelectionVariant", function (_Given: Given, _When: When, Then: Then) {
126
+ <%_ defaultFilterValues.forEach(function(filter) { _%>
127
+ Then.onThe<%- startLR %>Generated.onFilterBar().iCheckFilterField({ property: <%- JSON.stringify(filter.property) %> }, <%- filter.value2 !== undefined ? JSON.stringify([filter.value, filter.value2]) : JSON.stringify(filter.value) %><%- filter.operator ? ', ' + JSON.stringify(filter.operator) : '' %>);
128
+ <%_ }); -%>
129
+ });
130
+
111
131
  <%_ } -%>
112
132
  <%_ if (startLR) { -%>
113
133
  opaTest("Navigate to ObjectPage", function (_Given: Given, When: When, Then: Then) {
@@ -139,8 +139,15 @@ sap.ui.define([
139
139
  Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" });
140
140
  <% } -%>
141
141
  <% if (subSection.fields && subSection.fields.length > 0) { -%>
142
- <% subSection.fields.forEach(function(field) { -%>
142
+ <% subSection.fields.forEach(function(field, fieldIndex) { -%>
143
+ <% if (field.checkBoxGroup) { -%>
144
+ <% if (fieldIndex === 0 || !subSection.fields[fieldIndex - 1].checkBoxGroup) { -%>
145
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
146
+ <% } -%>
147
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
148
+ <% } else { -%>
143
149
  Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
150
+ <% } -%>
144
151
  <% }) -%>
145
152
  <% } -%>
146
153
  <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
@@ -149,8 +156,15 @@ sap.ui.define([
149
156
  <% }) -%>
150
157
  <% } else { -%>
151
158
  <% if (section.fields && section.fields.length > 0) { -%>
152
- <% section.fields.forEach(function(field) { -%>
159
+ <% section.fields.forEach(function(field, fieldIndex) { -%>
160
+ <% if (field.checkBoxGroup) { -%>
161
+ <% if (fieldIndex === 0 || !section.fields[fieldIndex - 1].checkBoxGroup) { -%>
162
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
163
+ <% } -%>
164
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
165
+ <% } else { -%>
153
166
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
167
+ <% } -%>
154
168
  <% }) -%>
155
169
  <% } -%>
156
170
  <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
@@ -23,9 +23,9 @@ const usesFieldIdentifier = (headerSections || []).some(function(section) {
23
23
  });
24
24
  const usesFormIdentifier = (bodySections || []).some(function(section) {
25
25
  const subSectionsHaveForm = (section.subSections || []).some(function(sub) {
26
- return sub.fields && sub.fields.length > 0;
26
+ return sub.fields && sub.fields.some(function(field) { return !field.checkBoxGroup; });
27
27
  });
28
- const sectionHasFormFields = !(section.subSections && section.subSections.length > 0) && section.fields && section.fields.length > 0;
28
+ const sectionHasFormFields = !(section.subSections && section.subSections.length > 0) && section.fields && section.fields.some(function(field) { return !field.checkBoxGroup; });
29
29
  const hasFormAction = (section.actions || []).some(function(action) {
30
30
  return action.visible && !(section.isTable && section.navigationProperty);
31
31
  });
@@ -158,8 +158,15 @@ function journey() {
158
158
  Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" }, {});
159
159
  <% } -%>
160
160
  <% if (subSection.fields && subSection.fields.length > 0) { -%>
161
- <% subSection.fields.forEach(function(field) { -%>
161
+ <% subSection.fields.forEach(function(field, fieldIndex) { -%>
162
+ <% if (field.checkBoxGroup) { -%>
163
+ <% if (fieldIndex === 0 || !subSection.fields[fieldIndex - 1].checkBoxGroup) { -%>
164
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
165
+ <% } -%>
166
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
167
+ <% } else { -%>
162
168
  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 %>"<% } %> });
169
+ <% } -%>
163
170
  <% }) -%>
164
171
  <% } -%>
165
172
  <% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
@@ -168,8 +175,15 @@ function journey() {
168
175
  <% }) -%>
169
176
  <% } else { -%>
170
177
  <% if (section.fields && section.fields.length > 0) { -%>
171
- <% section.fields.forEach(function(field) { -%>
178
+ <% section.fields.forEach(function(field, fieldIndex) { -%>
179
+ <% if (field.checkBoxGroup) { -%>
180
+ <% if (fieldIndex === 0 || !section.fields[fieldIndex - 1].checkBoxGroup) { -%>
181
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
182
+ <% } -%>
183
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
184
+ <% } else { -%>
172
185
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
186
+ <% } -%>
173
187
  <% }) -%>
174
188
  <% } -%>
175
189
  <% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
@@ -15,7 +15,7 @@
15
15
  * ╚═══════════════════════════════════════════════════════════════════════╝ *
16
16
  ******************************************************************************/
17
17
 
18
- <%_ const needsSortOrder = startLR && ((textAnnotationColumns && textAnnotationColumns.length > 0) || (tabs && tabs.some(function(tab) { return tab.textAnnotationColumns && tab.textAnnotationColumns.length > 0; }))); -%>
18
+ <%_ const needsSortOrder = startLR && ((textAnnotationColumns && textAnnotationColumns.length > 0) || (defaultSortOrder && defaultSortOrder.length > 0) || (tabs && tabs.some(function(tab) { return (tab.textAnnotationColumns && tab.textAnnotationColumns.length > 0) || (tab.defaultSortOrder && tab.defaultSortOrder.length > 0); }))); -%>
19
19
  sap.ui.define([
20
20
  "sap/ui/test/opaQunit",
21
21
  "./pages/JourneyRunner"<% if (needsSortOrder) { %>,
@@ -199,6 +199,15 @@ sap.ui.define([
199
199
  Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckColumns(undefined, <%- JSON.stringify(tab.tableColumns) %>);
200
200
  });
201
201
 
202
+ <%_ } -%>
203
+ <%_ if (tab.defaultSortOrder && tab.defaultSortOrder.length > 0) { -%>
204
+ opaTest(<%- JSON.stringify("Check default sort order from PresentationVariant in view " + tab.key) %>, function (Given, When, Then) {
205
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
206
+ <%_ tab.defaultSortOrder.forEach(function(sort) { _%>
207
+ Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckSortOrder({ name: "<%- sort.property %>" }, coreLibrary.SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
208
+ <%_ }); -%>
209
+ });
210
+
202
211
  <%_ } -%>
203
212
  <%_ if (tab.textAnnotationColumns && tab.textAnnotationColumns.length > 0) { -%>
204
213
  opaTest(<%- JSON.stringify("Check the Sort options for columns with a Text annotation in view " + tab.key) %>, function (Given, When, Then) {
@@ -368,6 +377,22 @@ sap.ui.define([
368
377
  Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
369
378
  });
370
379
 
380
+ <%_ } -%>
381
+ <%_ if (startLR && defaultSortOrder && defaultSortOrder.length > 0) { -%>
382
+ opaTest("Check default sort order from PresentationVariant", function (Given, When, Then) {
383
+ <%_ defaultSortOrder.forEach(function(sort) { _%>
384
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- sort.property %>" }, coreLibrary.SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
385
+ <%_ }); -%>
386
+ });
387
+
388
+ <%_ } -%>
389
+ <%_ if (startLR && defaultFilterValues && defaultFilterValues.length > 0) { -%>
390
+ opaTest("Check default filter values from SelectionVariant", function (Given, When, Then) {
391
+ <%_ defaultFilterValues.forEach(function(filter) { _%>
392
+ Then.onThe<%- startLR %>Generated.onFilterBar().iCheckFilterField({ property: <%- JSON.stringify(filter.property) %> }, <%- filter.value2 !== undefined ? JSON.stringify([filter.value, filter.value2]) : JSON.stringify(filter.value) %><%- filter.operator ? ', ' + JSON.stringify(filter.operator) : '' %>);
393
+ <%_ }); -%>
394
+ });
395
+
371
396
  <%_ } -%>
372
397
  <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
373
398
  opaTest("Check the Sort options for columns with a Text annotation", function (Given, When, Then) {
@@ -25,7 +25,7 @@ const usesFilterFieldIdentifier =
25
25
  import type { FilterFieldIdentifier } from "sap/fe/test/api/FilterBarAPI";
26
26
  <% } -%>
27
27
  import runner from "./pages/JourneyRunner";
28
- <%_ const needsSortOrder = startLR && ((textAnnotationColumns && textAnnotationColumns.length > 0) || (tabs && tabs.some(function(tab) { return tab.textAnnotationColumns && tab.textAnnotationColumns.length > 0; }))); -%>
28
+ <%_ const needsSortOrder = startLR && ((textAnnotationColumns && textAnnotationColumns.length > 0) || (defaultSortOrder && defaultSortOrder.length > 0) || (tabs && tabs.some(function(tab) { return (tab.textAnnotationColumns && tab.textAnnotationColumns.length > 0) || (tab.defaultSortOrder && tab.defaultSortOrder.length > 0); }))); -%>
29
29
  <%_ if (needsSortOrder) { -%>
30
30
  import { SortOrder } from "sap/ui/core/library";
31
31
  <%_ } -%>
@@ -206,6 +206,15 @@ function journey() {
206
206
  Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckColumns(undefined, <%- JSON.stringify(tab.tableColumns) %>);
207
207
  });
208
208
 
209
+ <%_ } -%>
210
+ <%_ if (tab.defaultSortOrder && tab.defaultSortOrder.length > 0) { -%>
211
+ opaTest(<%- JSON.stringify("Check default sort order from PresentationVariant in view " + tab.key) %>, function (_Given: Given, _When: When, Then: Then) {
212
+ When.onThe<%- startLR%>Generated.iGoToView({ key: "<%- tab.key %>" });
213
+ <%_ tab.defaultSortOrder.forEach(function(sort) { _%>
214
+ Then.onThe<%- startLR %>Generated.onTable("<%- tab.key %>").iCheckSortOrder({ name: "<%- sort.property %>" }, SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
215
+ <%_ }); -%>
216
+ });
217
+
209
218
  <%_ } -%>
210
219
  <%_ if (tab.textAnnotationColumns && tab.textAnnotationColumns.length > 0) { -%>
211
220
  opaTest(<%- JSON.stringify("Check the Sort options for columns with a Text annotation in view " + tab.key) %>, function (_Given: Given, When: When, Then: Then) {
@@ -376,6 +385,22 @@ function journey() {
376
385
  Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckColumns(undefined, <%- JSON.stringify(tableColumns) %>);
377
386
  });
378
387
 
388
+ <%_ } -%>
389
+ <%_ if (startLR && defaultSortOrder && defaultSortOrder.length > 0) { -%>
390
+ opaTest("Check default sort order from PresentationVariant", function (_Given: Given, _When: When, Then: Then) {
391
+ <%_ defaultSortOrder.forEach(function(sort) { _%>
392
+ Then.onThe<%- startLR %>Generated.onTable(defaultTableId).iCheckSortOrder({ name: "<%- sort.property %>" }, SortOrder.<%- sort.descending ? 'Descending' : 'Ascending' %>, true);
393
+ <%_ }); -%>
394
+ });
395
+
396
+ <%_ } -%>
397
+ <%_ if (startLR && defaultFilterValues && defaultFilterValues.length > 0) { -%>
398
+ opaTest("Check default filter values from SelectionVariant", function (_Given: Given, _When: When, Then: Then) {
399
+ <%_ defaultFilterValues.forEach(function(filter) { _%>
400
+ Then.onThe<%- startLR %>Generated.onFilterBar().iCheckFilterField({ property: <%- JSON.stringify(filter.property) %> }, <%- filter.value2 !== undefined ? JSON.stringify([filter.value, filter.value2]) : JSON.stringify(filter.value) %><%- filter.operator ? ', ' + JSON.stringify(filter.operator) : '' %>);
401
+ <%_ }); -%>
402
+ });
403
+
379
404
  <%_ } -%>
380
405
  <%_ if (startLR && textAnnotationColumns && textAnnotationColumns.length > 0) { -%>
381
406
  opaTest("Check the Sort options for columns with a Text annotation", function (_Given: Given, When: When, Then: Then) {
@@ -255,8 +255,15 @@ sap.ui.define([
255
255
  Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" });
256
256
  <% } -%>
257
257
  <% if (subSection.fields && subSection.fields.length > 0) { -%>
258
- <% subSection.fields.forEach(function(field) { -%>
258
+ <% subSection.fields.forEach(function(field, fieldIndex) { -%>
259
+ <% if (field.checkBoxGroup) { -%>
260
+ <% if (fieldIndex === 0 || !subSection.fields[fieldIndex - 1].checkBoxGroup) { -%>
261
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
262
+ <% } -%>
263
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
264
+ <% } else { -%>
259
265
  Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
266
+ <% } -%>
260
267
  <% }) -%>
261
268
  <% } -%>
262
269
  <% subSection.contactCardFields.forEach(function(field) { -%>
@@ -275,8 +282,15 @@ sap.ui.define([
275
282
  <% }) -%>
276
283
  <% } else { -%>
277
284
  <% if (section.fields && section.fields.length > 0) { -%>
278
- <% section.fields.forEach(function(field) { -%>
285
+ <% section.fields.forEach(function(field, fieldIndex) { -%>
286
+ <% if (field.checkBoxGroup) { -%>
287
+ <% if (fieldIndex === 0 || !section.fields[fieldIndex - 1].checkBoxGroup) { -%>
288
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
289
+ <% } -%>
290
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
291
+ <% } else { -%>
279
292
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
293
+ <% } -%>
280
294
  <% }) -%>
281
295
  <% } -%>
282
296
  <% section.contactCardFields.forEach(function(field) { -%>
@@ -23,9 +23,9 @@ const usesFieldIdentifier = (headerSections || []).some(function(section) {
23
23
  });
24
24
  const usesFormIdentifier = (bodySections || []).some(function(section) {
25
25
  const subSectionsHaveForm = (section.subSections || []).some(function(sub) {
26
- return sub.fields && sub.fields.length > 0;
26
+ return sub.fields && sub.fields.some(function(field) { return !field.checkBoxGroup; });
27
27
  });
28
- const sectionHasFormFields = !(section.subSections && section.subSections.length > 0) && section.fields && section.fields.length > 0;
28
+ const sectionHasFormFields = !(section.subSections && section.subSections.length > 0) && section.fields && section.fields.some(function(field) { return !field.checkBoxGroup; });
29
29
  const hasFormAction = (section.actions || []).some(function(action) {
30
30
  return action.visible && !(section.isTable && section.navigationProperty);
31
31
  });
@@ -283,8 +283,15 @@ function journey() {
283
283
  Then.onThe<%- name%>Generated.iCheckSubSection({ section: "<%- subSection.id %>" }, {});
284
284
  <% } -%>
285
285
  <% if (subSection.fields && subSection.fields.length > 0) { -%>
286
- <% subSection.fields.forEach(function(field) { -%>
286
+ <% subSection.fields.forEach(function(field, fieldIndex) { -%>
287
+ <% if (field.checkBoxGroup) { -%>
288
+ <% if (fieldIndex === 0 || !subSection.fields[fieldIndex - 1].checkBoxGroup) { -%>
289
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
290
+ <% } -%>
291
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
292
+ <% } else { -%>
287
293
  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 %>"<% } %> });
294
+ <% } -%>
288
295
  <% }) -%>
289
296
  <% } -%>
290
297
  <% subSection.contactCardFields.forEach(function(field) { -%>
@@ -303,8 +310,15 @@ function journey() {
303
310
  <% }) -%>
304
311
  <% } else { -%>
305
312
  <% if (section.fields && section.fields.length > 0) { -%>
306
- <% section.fields.forEach(function(field) { -%>
313
+ <% section.fields.forEach(function(field, fieldIndex) { -%>
314
+ <% if (field.checkBoxGroup) { -%>
315
+ <% if (fieldIndex === 0 || !section.fields[fieldIndex - 1].checkBoxGroup) { -%>
316
+ // Checkbox-group members cannot be addressed by sap.fe.test.api
317
+ <% } -%>
318
+ // Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>", fieldGroup: "<%- field.fieldGroup %>" });
319
+ <% } else { -%>
307
320
  Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
321
+ <% } -%>
308
322
  <% }) -%>
309
323
  <% } -%>
310
324
  <% section.contactCardFields.forEach(function(field) { -%>