@sap-ux/ui5-test-writer 1.18.2 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@ import { addPagesToJourneyRunner } from './utils/journeyRunnerUtils.js';
12
12
  import { hasVirtualOPA5, addVirtualTestConfig } from './utils/virtualOpaUtils.js';
13
13
  import { addJourneysToOpaJourneyTypes } from './utils/opaJourneyTypesUtils.js';
14
14
  import { getPackageScripts } from '@sap-ux/fiori-generator-shared';
15
- import { readHashFromFlpSandbox } from './utils/flpSandboxUtils.js';
15
+ import { resolveFlpSandboxHtmlTarget } from './utils/flpSandboxUtils.js';
16
16
  import { getListReportViews, isALPManifestTarget } from './utils/listReportUtils.js';
17
17
  import { resolveOriginatingView } from './utils/objectPageUtils.js';
18
18
  import { compareUI5VersionGte } from '@sap-ux/ui5-application-writer';
@@ -89,7 +89,12 @@ export async function generateOPAFiles(basePath, options, metadata, fs, log, sta
89
89
  const rootCommonTemplateDirPath = join(__dirname, '../templates/common');
90
90
  const templateUi5Version = getTemplateUi5Version(options.ui5Version);
91
91
  const rootV4TemplateDirPath = join(__dirname, `../templates/${applicationType}`, templateUi5Version);
92
- const testOutDirPath = join(await getWebappPath(basePath), 'test');
92
+ const webappPath = await getWebappPath(basePath);
93
+ const testOutDirPath = join(webappPath, 'test');
94
+ // use flpSandbox target if none is given by caller; if not resolvable, config.htmlTarget already contains "index.html"
95
+ if (!options.htmlTarget) {
96
+ config.htmlTarget = resolveFlpSandboxHtmlTarget(testOutDirPath, webappPath, editor) ?? config.htmlTarget;
97
+ }
93
98
  // Access ux-specification to get feature data for OPA test generation
94
99
  const appFeatures = await getAppFeatures(basePath, editor, log, metadata, manifest);
95
100
  // Drop action tests the target template bucket cannot render (custom actions: latest only;
@@ -256,7 +261,7 @@ function logModifiedFiles(log, modifiedFiles) {
256
261
  }
257
262
  /**
258
263
  * Resolve the standalone-mode write context: detect preexisting integration tests and an
259
- * incompatible legacy setup, and resolve the htmlTarget from flpSandbox.html if present.
264
+ * incompatible legacy setup, and preserve the htmlTarget from an existing opaTests.qunit.js if present.
260
265
  *
261
266
  * @param writeContext - shared write context to base the resolved context on
262
267
  * @returns a new WriteContext with the resolved values for the standalone generation
@@ -280,8 +285,8 @@ async function resolveStandaloneWriteContext(writeContext) {
280
285
  }
281
286
  /**
282
287
  * Resolve the standalone-mode write context for the case where the integration folder is
283
- * missing entirely: there are no OPA tests yet, the int-test package script may need to be
284
- * added, and the htmlTarget is resolved from flpSandbox.html if present.
288
+ * missing entirely: there are no OPA tests yet and the int-test package script may need to be
289
+ * added.
285
290
  *
286
291
  * @param writeContext - shared write context to base the resolved context on
287
292
  * @returns a new WriteContext with the resolved values for the standalone generation
@@ -295,17 +300,9 @@ async function resolveWriteContextForMissingIntegrationFolder(writeContext) {
295
300
  writeContext.modifiedFiles.push('package.json');
296
301
  }
297
302
  }
298
- let htmlTarget = writeContext.config.htmlTarget;
299
- if (existsSync(join(writeContext.testOutDirPath, 'flpSandbox.html'))) {
300
- const hashFromFlpSandbox = readHashFromFlpSandbox(join('test', 'flpSandbox.html'), await getWebappPath(writeContext.basePath), writeContext.editor);
301
- if (hashFromFlpSandbox) {
302
- htmlTarget = `test/flpSandbox.html#${hashFromFlpSandbox}`;
303
- }
304
- }
305
303
  return {
306
304
  ...writeContext,
307
- hasPreexistingTests: false,
308
- config: { ...writeContext.config, htmlTarget }
305
+ hasPreexistingTests: false
309
306
  };
310
307
  }
311
308
  /**
@@ -602,6 +599,8 @@ function writeJourneyFiles(appFeatures, writeContext) {
602
599
  editor.copyTpl(join(rootV4TemplateDirPath, 'integration', `ListReportJourney${dotFileExtension}`), join(testOutDirPath, 'integration', `${appFeatures.listReport.name}Journey.gen${dotFileExtension}`), {
603
600
  ...journeyParams,
604
601
  ...appFeatures.listReport,
602
+ defaultSortOrder: appFeatures.listReport.defaultSortOrder ?? [],
603
+ defaultFilterValues: appFeatures.listReport.defaultFilterValues ?? [],
605
604
  appPath: config.appPath
606
605
  }, undefined, {
607
606
  globOptions: { dot: true }
package/dist/types.d.ts CHANGED
@@ -13,7 +13,11 @@ export type OPAGenerationOptions = {
13
13
  scriptName?: string;
14
14
  /** The appID. If not specified, will be read from the manifest in sap.app/id. */
15
15
  appID?: string;
16
- /** The name of the html that will be used in OPA journey file. If not specified, 'index.html' will be used. */
16
+ /**
17
+ * The html target used for the launchUrl in the OPA journey file. If not specified, it is derived
18
+ * from the app's `test/flpSandbox.html` (e.g. `test/flpSandbox.html#<appIntent>`), falling back to
19
+ * `index.html` when no FLP sandbox is present.
20
+ */
17
21
  htmlTarget?: string;
18
22
  /** When true, OPA harness files are served virtually; skip writing them to disk. */
19
23
  useVirtualPreviewEndpoints?: boolean;
@@ -65,6 +69,7 @@ export type FEV4ManifestTarget = {
65
69
  entitySet?: string;
66
70
  contextPath?: string;
67
71
  hideFilterBar?: boolean;
72
+ defaultTemplateAnnotationPath?: string;
68
73
  navigation?: {
69
74
  [id: string]: {
70
75
  detail?: {
@@ -110,6 +115,19 @@ export interface FFOPAConfig {
110
115
  ui5Theme?: string;
111
116
  useVirtualPreviewEndpoints?: boolean;
112
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
+ };
113
131
  export type ObjectPageNavigationParent = {
114
132
  name: string;
115
133
  navigationProperty: string;
@@ -213,6 +231,7 @@ export type ListReportTab = {
213
231
  };
214
232
  textAnnotationColumns: TextAnnotationColumn[];
215
233
  columnPersonalizationSupported?: boolean;
234
+ defaultSortOrder?: SortOrderItem[];
216
235
  };
217
236
  export type ListReportFeatures = {
218
237
  name?: string;
@@ -255,6 +274,8 @@ export type ListReportFeatures = {
255
274
  semanticKeyProperties?: string[];
256
275
  missingFromFilterBar?: string[];
257
276
  };
277
+ defaultSortOrder?: SortOrderItem[];
278
+ defaultFilterValues?: FilterDefaultValue[];
258
279
  };
259
280
  export interface ActionButtonState {
260
281
  label: string;
@@ -14,4 +14,13 @@ import type { Editor } from 'mem-fs-editor';
14
14
  * @returns the application key (e.g. `fincashbankmanage-tile`), or undefined
15
15
  */
16
16
  export declare function readHashFromFlpSandbox(htmlRelativePath: string, webappPath: string, fs: Editor): string | undefined;
17
+ /**
18
+ * Resolves the JourneyRunner launchUrl html target from the app's FLP sandbox.
19
+ *
20
+ * @param testOutDirPath - path to the test output directory (`.../webapp/test`)
21
+ * @param webappPath - path to the webapp directory
22
+ * @param fs - mem-fs-editor instance (works against both disk and in-memory files)
23
+ * @returns the html target, or undefined if flpSandbox.html is missing or has no app key
24
+ */
25
+ export declare function resolveFlpSandboxHtmlTarget(testOutDirPath: string, webappPath: string, fs: Editor): string | undefined;
17
26
  //# sourceMappingURL=flpSandboxUtils.d.ts.map
@@ -34,4 +34,19 @@ export function readHashFromFlpSandbox(htmlRelativePath, webappPath, fs) {
34
34
  return undefined;
35
35
  }
36
36
  }
37
+ /**
38
+ * Resolves the JourneyRunner launchUrl html target from the app's FLP sandbox.
39
+ *
40
+ * @param testOutDirPath - path to the test output directory (`.../webapp/test`)
41
+ * @param webappPath - path to the webapp directory
42
+ * @param fs - mem-fs-editor instance (works against both disk and in-memory files)
43
+ * @returns the html target, or undefined if flpSandbox.html is missing or has no app key
44
+ */
45
+ export function resolveFlpSandboxHtmlTarget(testOutDirPath, webappPath, fs) {
46
+ if (!fs.exists(join(testOutDirPath, 'flpSandbox.html'))) {
47
+ return undefined;
48
+ }
49
+ const appKey = readHashFromFlpSandbox(join('test', 'flpSandbox.html'), webappPath, fs);
50
+ return appKey ? `test/flpSandbox.html#${appKey}` : undefined;
51
+ }
37
52
  //# sourceMappingURL=flpSandboxUtils.js.map
@@ -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
  }
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.2",
4
+ "version": "1.19.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -28,11 +28,11 @@
28
28
  "@sap/ux-specification": "1.144.5",
29
29
  "@sap-ux/edmx-parser": "0.10.0",
30
30
  "@sap-ux/annotation-converter": "0.10.22",
31
+ "@sap-ux/ui5-application-writer": "2.1.6",
31
32
  "@sap-ux/logger": "1.0.3",
32
33
  "@sap-ux/fiori-generator-shared": "1.2.22",
33
34
  "@sap-ux/project-access": "2.3.1",
34
- "@sap-ux/preview-middleware": "1.2.27",
35
- "@sap-ux/ui5-application-writer": "2.1.6"
35
+ "@sap-ux/preview-middleware": "1.2.27"
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) {
@@ -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) {
@@ -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) {
@@ -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) {