@sap-ux/ui5-test-writer 1.4.4 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types.d.ts +10 -0
- package/dist/utils/listReportUtils.js +2 -0
- package/dist/utils/modelUtils.d.ts +11 -0
- package/dist/utils/modelUtils.js +3 -0
- package/dist/utils/objectPageUtils.js +70 -9
- package/dist/utils/tableUtils.d.ts +20 -6
- package/dist/utils/tableUtils.js +51 -10
- package/package.json +2 -2
- package/templates/v4/1.150/integration/ListReportJourney.js +9 -0
- package/templates/v4/1.150/integration/ListReportJourney.ts +9 -0
- package/templates/v4/1.150/integration/ObjectPageJourney.js +22 -0
- package/templates/v4/1.150/integration/ObjectPageJourney.ts +23 -1
package/dist/types.d.ts
CHANGED
|
@@ -116,11 +116,15 @@ export type SectionFormField = {
|
|
|
116
116
|
property: string;
|
|
117
117
|
connectedFields?: string;
|
|
118
118
|
fieldGroup?: string;
|
|
119
|
+
targetAnnotation?: string;
|
|
119
120
|
};
|
|
120
121
|
export type TableColumn = {
|
|
121
122
|
header?: string;
|
|
122
123
|
};
|
|
123
124
|
export type TableColumnFeatureData = Record<string, TableColumn>;
|
|
125
|
+
export type ContactCardField = {
|
|
126
|
+
property: string;
|
|
127
|
+
};
|
|
124
128
|
export type BodySubSectionFeatureData = {
|
|
125
129
|
id: string;
|
|
126
130
|
navigationProperty?: string;
|
|
@@ -128,7 +132,9 @@ export type BodySubSectionFeatureData = {
|
|
|
128
132
|
custom: boolean;
|
|
129
133
|
order: number;
|
|
130
134
|
fields: SectionFormField[];
|
|
135
|
+
contactCardFields: ContactCardField[];
|
|
131
136
|
tableColumns: TableColumnFeatureData;
|
|
137
|
+
contactCardColumns: ContactCardField[];
|
|
132
138
|
};
|
|
133
139
|
export type BodySectionFeatureData = {
|
|
134
140
|
id: string;
|
|
@@ -137,7 +143,9 @@ export type BodySectionFeatureData = {
|
|
|
137
143
|
custom: boolean;
|
|
138
144
|
order: number;
|
|
139
145
|
fields: SectionFormField[];
|
|
146
|
+
contactCardFields: ContactCardField[];
|
|
140
147
|
tableColumns: TableColumnFeatureData;
|
|
148
|
+
contactCardColumns: ContactCardField[];
|
|
141
149
|
subSections: BodySubSectionFeatureData[];
|
|
142
150
|
actions?: ActionButtonState[];
|
|
143
151
|
createButton?: ButtonState;
|
|
@@ -176,6 +184,7 @@ export type ListReportFeatures = {
|
|
|
176
184
|
};
|
|
177
185
|
filterBarItems?: FilterBarItem[];
|
|
178
186
|
tableColumns?: Record<string, Record<string, string | number | boolean>>;
|
|
187
|
+
contactCardColumns: ContactCardField[];
|
|
179
188
|
toolBarActions?: ActionButtonState[];
|
|
180
189
|
isALP?: boolean;
|
|
181
190
|
/**
|
|
@@ -269,6 +278,7 @@ export type HeaderSectionFeatureData = {
|
|
|
269
278
|
form?: boolean;
|
|
270
279
|
stashed?: boolean | string;
|
|
271
280
|
fields?: FormField[];
|
|
281
|
+
contactCardFields: ContactCardField[];
|
|
272
282
|
};
|
|
273
283
|
export interface ButtonState {
|
|
274
284
|
visible: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getFilterFields, getSelectionFieldItems, getSelectionFieldItemsWithLabels, getTableColumnData, getAggregations } from './modelUtils.js';
|
|
2
|
+
import { extractContactCardColumnsFromNode } from './tableUtils.js';
|
|
2
3
|
import { parse } from '@sap-ux/edmx-parser';
|
|
3
4
|
import { convert } from '@sap-ux/annotation-converter';
|
|
4
5
|
import { extractActionMethodName, buildActionButtonState, safeCheckButtonVisibility, safeCheckButtonVisibilityFromMetadata } from './actionUtils.js';
|
|
@@ -141,6 +142,7 @@ export function getListReportFeatures(listReportPage, log, metadata, manifest) {
|
|
|
141
142
|
deleteButton: buildButtonState(buttonVisibility?.delete),
|
|
142
143
|
filterBarItems,
|
|
143
144
|
tableColumns: getTableColumnData(listReportPage.model, log),
|
|
145
|
+
contactCardColumns: extractContactCardColumnsFromNode(listReportPage.model.root),
|
|
144
146
|
toolBarActions,
|
|
145
147
|
isALP: manifest ? isALPFromManifest(manifest, listReportPage.name) : false,
|
|
146
148
|
tableIdentifiers: getTableIdentifiers(manifest, listReportPage.name),
|
|
@@ -22,6 +22,17 @@ export interface SectionItem extends AggregationItem {
|
|
|
22
22
|
custom?: boolean;
|
|
23
23
|
name?: string;
|
|
24
24
|
order?: number;
|
|
25
|
+
properties?: {
|
|
26
|
+
stashed?: {
|
|
27
|
+
freeText: string | boolean;
|
|
28
|
+
};
|
|
29
|
+
hidden?: {
|
|
30
|
+
value: boolean;
|
|
31
|
+
};
|
|
32
|
+
hideByProperty?: {
|
|
33
|
+
value: string | boolean;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
25
36
|
schema: {
|
|
26
37
|
keys: {
|
|
27
38
|
name: string;
|
package/dist/utils/modelUtils.js
CHANGED
|
@@ -25,6 +25,9 @@ export async function getAppFeatures(basePath, fs, log, metadata, manifest) {
|
|
|
25
25
|
// readApp calls createApplicationAccess internally if given a path, but it uses the "live" version of project-access without fs enhancement
|
|
26
26
|
const appAccess = await createApplicationAccess(basePath, { fs: fs });
|
|
27
27
|
const specification = await appAccess.getSpecification();
|
|
28
|
+
// `includeAnnotationProperties` only becomes available with ux-specification 1.144.8, but updating
|
|
29
|
+
// the dependency causes imports to break, due to a change in export mechanism
|
|
30
|
+
// TODO: Remove workaround when ux-specification is updated to 1.144.8 or later
|
|
28
31
|
const readAppOptions = {
|
|
29
32
|
app: appAccess,
|
|
30
33
|
fs: fs,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAggregations, parseDataFieldForAnnotationName } from './modelUtils.js';
|
|
2
|
-
import { extractTableColumnsFromNode } from './tableUtils.js';
|
|
2
|
+
import { extractContactCardColumnsFromNode, extractTableColumnsFromNode } from './tableUtils.js';
|
|
3
3
|
import { PageTypeV4 } from '@sap/ux-specification/dist/types/src/common/page.js';
|
|
4
4
|
import { parse } from '@sap-ux/edmx-parser';
|
|
5
5
|
import { convert } from '@sap-ux/annotation-converter';
|
|
@@ -135,6 +135,9 @@ function extractObjectPageHeaderSectionsData(objectPage) {
|
|
|
135
135
|
const sectionsAggregation = getAggregations(headerAggregation)['sections'];
|
|
136
136
|
const sections = getAggregations(sectionsAggregation);
|
|
137
137
|
Object.values(sections).forEach((section) => {
|
|
138
|
+
if (isSectionHidden(section)) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
138
141
|
const facetId = getSectionIdentifier(section);
|
|
139
142
|
if (!facetId) {
|
|
140
143
|
// if no identifier can be found for the section, it is not possible to reliably identify it in tests, so skip it
|
|
@@ -147,10 +150,12 @@ function extractObjectPageHeaderSectionsData(objectPage) {
|
|
|
147
150
|
microChart: isSectionMicroChart(section),
|
|
148
151
|
form: isFormSection(section),
|
|
149
152
|
// collection: false // TODO: find out how to identify collection facets
|
|
150
|
-
title: section.title
|
|
153
|
+
title: section.title,
|
|
154
|
+
contactCardFields: []
|
|
151
155
|
};
|
|
152
156
|
if (sectionData.form) {
|
|
153
157
|
sectionData.fields = getHeaderSectionFormFields(section);
|
|
158
|
+
sectionData.contactCardFields = pickContactCardFieldsFromHeader(sectionData.fields);
|
|
154
159
|
}
|
|
155
160
|
headerSections.push(sectionData);
|
|
156
161
|
});
|
|
@@ -173,20 +178,26 @@ function extractObjectPageBodySectionsData(objectPage, convertedMetadata, schema
|
|
|
173
178
|
const sectionsAggregation = getAggregations(objectPage.model.root)['sections'];
|
|
174
179
|
const sections = getAggregations(sectionsAggregation);
|
|
175
180
|
Object.entries(sections).forEach(([sectionKey, section]) => {
|
|
181
|
+
if (isSectionHidden(section)) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
176
184
|
const sectionId = getSectionIdentifier(section) ?? sectionKey;
|
|
177
185
|
const subSections = extractBodySubSectionsData(section, sectionId, convertedMetadata, objectPage.entitySet);
|
|
178
186
|
const navigationProperty = getNavigationPropertyFromKey(sectionKey);
|
|
179
187
|
const isTable = isTableSection(section);
|
|
188
|
+
const fields = section.custom || isTable ? [] : extractFormFields(section, convertedMetadata, objectPage.entitySet);
|
|
189
|
+
const tableColumns = section.custom || !isTable ? {} : extractTableColumnsFromNode(section);
|
|
190
|
+
const contactCardColumns = section.custom || !isTable ? [] : extractContactCardColumnsFromNode(section);
|
|
180
191
|
const sectionData = {
|
|
181
192
|
id: sectionId,
|
|
182
193
|
navigationProperty,
|
|
183
194
|
isTable,
|
|
184
195
|
custom: !!section.custom,
|
|
185
196
|
order: section?.order ?? -1,
|
|
186
|
-
fields
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
197
|
+
fields,
|
|
198
|
+
tableColumns,
|
|
199
|
+
contactCardFields: pickContactCardFields(fields),
|
|
200
|
+
contactCardColumns,
|
|
190
201
|
subSections,
|
|
191
202
|
actions: !section.custom && convertedMetadata && schemaNamespace
|
|
192
203
|
? extractSectionActions(section, convertedMetadata, schemaNamespace)
|
|
@@ -264,7 +275,7 @@ function extractSectionActions(section, convertedMetadata, schemaNamespace) {
|
|
|
264
275
|
*/
|
|
265
276
|
function extractBodySubSectionsData(section, parentSectionId, convertedMetadata, entitySetName) {
|
|
266
277
|
const subSectionItems = getAggregations(getAggregations(section)['subsections']);
|
|
267
|
-
const childEntries = Object.entries(subSectionItems);
|
|
278
|
+
const childEntries = Object.entries(subSectionItems).filter(([, child]) => !isSectionHidden(child));
|
|
268
279
|
// all-FieldGroup CollectionFacet is collapsed into one sub-section with inherited id from parent
|
|
269
280
|
// Table or nested CollectionFacet sub-sections are kept as distinct sub-sections with their own ids
|
|
270
281
|
return isFormOnlyCollectionFacet(childEntries)
|
|
@@ -301,6 +312,8 @@ function buildMergedFormSubSection(childEntries, parentSectionId, sectionOrder,
|
|
|
301
312
|
custom: false,
|
|
302
313
|
order: sectionOrder ?? -1,
|
|
303
314
|
fields,
|
|
315
|
+
contactCardFields: pickContactCardFields(fields),
|
|
316
|
+
contactCardColumns: [],
|
|
304
317
|
tableColumns: {}
|
|
305
318
|
};
|
|
306
319
|
}
|
|
@@ -316,16 +329,47 @@ function buildMergedFormSubSection(childEntries, parentSectionId, sectionOrder,
|
|
|
316
329
|
*/
|
|
317
330
|
function buildSubSection(subSectionKey, subSection, parentSectionId, convertedMetadata, entitySetName) {
|
|
318
331
|
const isTable = isTableSection(subSection);
|
|
332
|
+
const fields = subSection.custom || isTable ? [] : extractFormFields(subSection, convertedMetadata, entitySetName);
|
|
333
|
+
const contactCardColumns = subSection.custom || !isTable ? [] : extractContactCardColumnsFromNode(subSection);
|
|
319
334
|
return {
|
|
320
335
|
id: getSectionIdentifier(subSection) ?? `${parentSectionId}_${subSectionKey}`,
|
|
321
336
|
navigationProperty: getNavigationPropertyFromKey(subSectionKey),
|
|
322
337
|
isTable,
|
|
323
338
|
custom: !!subSection.custom,
|
|
324
339
|
order: subSection?.order ?? -1, // put a negative order number to signal that order was not in spec
|
|
325
|
-
fields
|
|
340
|
+
fields,
|
|
341
|
+
// Contact-card fields are kept in `fields` too so the test also asserts `iCheckField` alongside `iClickLink` / `iCheckContactDialog` (dual diagnostic).
|
|
342
|
+
contactCardFields: pickContactCardFields(fields),
|
|
343
|
+
contactCardColumns,
|
|
326
344
|
tableColumns: subSection.custom || !isTable ? {} : extractTableColumnsFromNode(subSection)
|
|
327
345
|
};
|
|
328
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Filters form fields down to those rendered as Contact-card links (`@Communication.Contact`).
|
|
349
|
+
*
|
|
350
|
+
* @param fields - all form fields of a (sub-)section
|
|
351
|
+
* @returns Contact-card fields, addressed via the qualified `<property>/<targetAnnotation>` form
|
|
352
|
+
*/
|
|
353
|
+
function pickContactCardFields(fields) {
|
|
354
|
+
return fields
|
|
355
|
+
.filter((field) => field.targetAnnotation === 'Contact')
|
|
356
|
+
.map((field) => ({ property: field.property }));
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Filters header field-group fields down to Contact-card entries and projects them to
|
|
360
|
+
* the `<property>/Contact` form expected by `onHeader().iClickLink({ property })`.
|
|
361
|
+
*
|
|
362
|
+
* @param fields - header field-group fields with optional `field` and `targetAnnotation`
|
|
363
|
+
* @returns Contact-card descriptors usable as `iClickLink` / `iCheckLink` arguments
|
|
364
|
+
*/
|
|
365
|
+
function pickContactCardFieldsFromHeader(fields) {
|
|
366
|
+
if (!fields) {
|
|
367
|
+
return [];
|
|
368
|
+
}
|
|
369
|
+
return fields
|
|
370
|
+
.filter((field) => field.targetAnnotation === 'Contact' && field.field)
|
|
371
|
+
.map((field) => ({ property: `${field.field}/${field.targetAnnotation}` }));
|
|
372
|
+
}
|
|
329
373
|
/**
|
|
330
374
|
* Extracts form field property paths from a body sub-section's form aggregation.
|
|
331
375
|
*
|
|
@@ -352,7 +396,13 @@ function extractFormFields(subSection, convertedMetadata, entitySetName) {
|
|
|
352
396
|
}
|
|
353
397
|
if (annotationParts) {
|
|
354
398
|
const qualifier = annotationParts.targetAnnotation;
|
|
355
|
-
if (
|
|
399
|
+
if (qualifier === 'Contact') {
|
|
400
|
+
fields.push({
|
|
401
|
+
property: `${baseProperty}/${qualifier}`,
|
|
402
|
+
targetAnnotation: qualifier
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
else if (annotationParts.property === 'ConnectedFields' && entityType) {
|
|
356
406
|
resolveConnectedFieldsInnerProperties(entityType, qualifier).forEach((property) => {
|
|
357
407
|
fields.push({ property, connectedFields: qualifier });
|
|
358
408
|
});
|
|
@@ -566,6 +616,17 @@ function isSectionMicroChart(section) {
|
|
|
566
616
|
function isTableSection(section) {
|
|
567
617
|
return !!section.isTable || !!getAggregations(section).table;
|
|
568
618
|
}
|
|
619
|
+
/**
|
|
620
|
+
* Checks whether a section is hidden by a UI.Hidden annotation and should be skipped.
|
|
621
|
+
*
|
|
622
|
+
* @param section - section entry from ux specification
|
|
623
|
+
* @returns true if the section is marked hidden
|
|
624
|
+
*/
|
|
625
|
+
function isSectionHidden(section) {
|
|
626
|
+
// hideByProperty holds a dynamic hide expression; skip unless it is a static `false` (always visible).
|
|
627
|
+
return (section.properties?.hidden?.value === true ||
|
|
628
|
+
(section.properties?.hideByProperty !== undefined && section.properties.hideByProperty.value !== false));
|
|
629
|
+
}
|
|
569
630
|
/**
|
|
570
631
|
* Checks if the section contains a form based on it's aggregations.
|
|
571
632
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TreeAggregation, TreeAggregations } from '@sap/ux-specification/dist/types/src/parser/index.js';
|
|
2
|
-
import type { TableColumnFeatureData } from '../types.js';
|
|
2
|
+
import type { ContactCardField, TableColumnFeatureData } from '../types.js';
|
|
3
3
|
type ColumnModelItem = {
|
|
4
4
|
custom?: boolean;
|
|
5
5
|
description?: string;
|
|
@@ -9,21 +9,28 @@ type ColumnModelItem = {
|
|
|
9
9
|
value: string;
|
|
10
10
|
}[];
|
|
11
11
|
};
|
|
12
|
+
properties?: {
|
|
13
|
+
availability?: {
|
|
14
|
+
value?: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
12
17
|
};
|
|
13
18
|
export type ColumnAggregations = TreeAggregations & {
|
|
14
19
|
[key: string]: ColumnModelItem;
|
|
15
20
|
};
|
|
16
21
|
/**
|
|
17
|
-
* Gets the identifier of a column for OPA5 tests
|
|
18
|
-
* Custom columns use the
|
|
22
|
+
* Gets the identifier of a column for OPA5 tests, matching the rendered MDC column's `propertyKey`.
|
|
23
|
+
* Custom columns use the `Key` schema entry; standard columns use the `Value` schema entry; for
|
|
24
|
+
* annotation-driven entries that carry no `Value` (e.g. Contact-card columns), the column aggregation
|
|
25
|
+
* key is used.
|
|
19
26
|
*
|
|
20
27
|
* @param column - column item from ux specification
|
|
21
|
-
* @
|
|
28
|
+
* @param columnKey - aggregation key of the column in its parent `columns` aggregation
|
|
29
|
+
* @returns identifier of the column for OPA5 tests; undefined if no identifier can be determined
|
|
22
30
|
*/
|
|
23
|
-
export declare function getColumnIdentifier(column: ColumnModelItem): string | undefined;
|
|
31
|
+
export declare function getColumnIdentifier(column: ColumnModelItem, columnKey?: string): string | undefined;
|
|
24
32
|
/**
|
|
25
33
|
* Transforms column aggregations from the ux specification model into a map of columns for OPA5 tests.
|
|
26
|
-
* Each column entry includes the column header label for display verification.
|
|
27
34
|
*
|
|
28
35
|
* @param columnAggregations - column aggregations from the ux specification model
|
|
29
36
|
* @returns a map of column identifiers to column state objects for use with iCheckColumns()
|
|
@@ -38,5 +45,12 @@ export declare function transformTableColumns(columnAggregations: ColumnAggregat
|
|
|
38
45
|
* @returns a map of column identifiers to column state objects for use with iCheckColumns()
|
|
39
46
|
*/
|
|
40
47
|
export declare function extractTableColumnsFromNode(node: TreeAggregation): TableColumnFeatureData;
|
|
48
|
+
/**
|
|
49
|
+
* Extracts Contact-card columns from a spec model node that contains a 'table' aggregation.
|
|
50
|
+
*
|
|
51
|
+
* @param node - tree aggregation node that exposes a 'table' aggregation
|
|
52
|
+
* @returns array of Contact-card field descriptors for use with iClickLink/iCheckLink
|
|
53
|
+
*/
|
|
54
|
+
export declare function extractContactCardColumnsFromNode(node: TreeAggregation): ContactCardField[];
|
|
41
55
|
export {};
|
|
42
56
|
//# sourceMappingURL=tableUtils.d.ts.map
|
package/dist/utils/tableUtils.js
CHANGED
|
@@ -1,26 +1,42 @@
|
|
|
1
|
-
import { getAggregations } from './modelUtils.js';
|
|
1
|
+
import { getAggregations, parseDataFieldForAnnotationName } from './modelUtils.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Returns true when the column is rendered in the table by default. Columns flagged as `Adaptation`
|
|
4
|
+
* (only reachable via end-user table settings) or `Hidden` are excluded from generated assertions.
|
|
5
5
|
*
|
|
6
6
|
* @param column - column item from ux specification
|
|
7
|
-
* @returns
|
|
7
|
+
* @returns true if the column is shown by default; false for Adaptation/Hidden columns
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
return
|
|
9
|
+
function isDefaultAvailableColumn(column) {
|
|
10
|
+
const availability = column.properties?.availability?.value;
|
|
11
|
+
return availability === undefined || availability === 'Default';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Gets the identifier of a column for OPA5 tests, matching the rendered MDC column's `propertyKey`.
|
|
15
|
+
* Custom columns use the `Key` schema entry; standard columns use the `Value` schema entry; for
|
|
16
|
+
* annotation-driven entries that carry no `Value` (e.g. Contact-card columns), the column aggregation
|
|
17
|
+
* key is used.
|
|
18
|
+
*
|
|
19
|
+
* @param column - column item from ux specification
|
|
20
|
+
* @param columnKey - aggregation key of the column in its parent `columns` aggregation
|
|
21
|
+
* @returns identifier of the column for OPA5 tests; undefined if no identifier can be determined
|
|
22
|
+
*/
|
|
23
|
+
export function getColumnIdentifier(column, columnKey) {
|
|
24
|
+
const schemaKeyName = column.custom ? 'Key' : 'Value';
|
|
25
|
+
return column.schema.keys.find((k) => k.name === schemaKeyName)?.value ?? (column.custom ? undefined : columnKey);
|
|
12
26
|
}
|
|
13
27
|
/**
|
|
14
28
|
* Transforms column aggregations from the ux specification model into a map of columns for OPA5 tests.
|
|
15
|
-
* Each column entry includes the column header label for display verification.
|
|
16
29
|
*
|
|
17
30
|
* @param columnAggregations - column aggregations from the ux specification model
|
|
18
31
|
* @returns a map of column identifiers to column state objects for use with iCheckColumns()
|
|
19
32
|
*/
|
|
20
33
|
export function transformTableColumns(columnAggregations) {
|
|
21
34
|
const columns = {};
|
|
22
|
-
Object.
|
|
23
|
-
|
|
35
|
+
Object.entries(columnAggregations).forEach(([columnKey, column], index) => {
|
|
36
|
+
if (!isDefaultAvailableColumn(column)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const id = getColumnIdentifier(column, columnKey) ?? String(index);
|
|
24
40
|
const state = {};
|
|
25
41
|
if (column.description) {
|
|
26
42
|
state['header'] = column.description;
|
|
@@ -49,4 +65,29 @@ export function extractTableColumnsFromNode(node) {
|
|
|
49
65
|
const columnItems = getAggregations(columnsAggregation);
|
|
50
66
|
return transformTableColumns(columnItems);
|
|
51
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Extracts Contact-card columns from a spec model node that contains a 'table' aggregation.
|
|
70
|
+
*
|
|
71
|
+
* @param node - tree aggregation node that exposes a 'table' aggregation
|
|
72
|
+
* @returns array of Contact-card field descriptors for use with iClickLink/iCheckLink
|
|
73
|
+
*/
|
|
74
|
+
export function extractContactCardColumnsFromNode(node) {
|
|
75
|
+
const tableAggregation = getAggregations(node)['table'];
|
|
76
|
+
if (!tableAggregation) {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
const columnsAggregation = getAggregations(tableAggregation)['columns'];
|
|
80
|
+
if (!columnsAggregation) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
const columnItems = getAggregations(columnsAggregation);
|
|
84
|
+
const contactColumns = [];
|
|
85
|
+
Object.entries(columnItems).forEach(([columnKey, column]) => {
|
|
86
|
+
const parsed = parseDataFieldForAnnotationName(columnKey);
|
|
87
|
+
if (parsed?.targetAnnotation === 'Contact' && isDefaultAvailableColumn(column)) {
|
|
88
|
+
contactColumns.push({ property: columnKey });
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return contactColumns;
|
|
92
|
+
}
|
|
52
93
|
//# sourceMappingURL=tableUtils.js.map
|
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.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"@sap-ux/edmx-parser": "0.10.0",
|
|
30
30
|
"@sap-ux/annotation-converter": "0.10.21",
|
|
31
31
|
"@sap-ux/ui5-application-writer": "2.1.3",
|
|
32
|
-
"@sap-ux/logger": "1.0.3",
|
|
33
32
|
"@sap-ux/fiori-generator-shared": "1.2.6",
|
|
34
33
|
"@sap-ux/project-access": "2.1.10",
|
|
34
|
+
"@sap-ux/logger": "1.0.3",
|
|
35
35
|
"@sap-ux/preview-middleware": "1.1.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
@@ -95,6 +95,15 @@ sap.ui.define([
|
|
|
95
95
|
});
|
|
96
96
|
<%_ } -%>
|
|
97
97
|
|
|
98
|
+
<%_ if (contactCardColumns.length > 0) { -%>
|
|
99
|
+
opaTest("Check contact card links", function (Given, When, Then) {
|
|
100
|
+
<%_ contactCardColumns.forEach(function(column) { _%>
|
|
101
|
+
// May fail if the mock data has no row at index 0 or that row does not render the contact link; adjust the row selector if needed.
|
|
102
|
+
When.onThe<%- startLR %>Generated.onTable().iClickLink(0, "<%- column.property %>");
|
|
103
|
+
Then.onThe<%- startLR %>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
104
|
+
<%_ }); -%>
|
|
105
|
+
});
|
|
106
|
+
<%_ } -%>
|
|
98
107
|
<%_ if (startLR) { -%>
|
|
99
108
|
opaTest("Navigate to ObjectPage", function (Given, When, Then) {
|
|
100
109
|
// Note: this test will fail if the ListReport page doesn't show any data
|
|
@@ -100,6 +100,15 @@ function journey() {
|
|
|
100
100
|
});
|
|
101
101
|
<%_ } -%>
|
|
102
102
|
|
|
103
|
+
<%_ if (contactCardColumns.length > 0) { -%>
|
|
104
|
+
opaTest("Check contact card links", function (_Given: Given, When: When, Then: Then) {
|
|
105
|
+
<%_ contactCardColumns.forEach(function(column) { _%>
|
|
106
|
+
// May fail if the mock data has no row at index 0 or that row does not render the contact link; adjust the row selector if needed.
|
|
107
|
+
When.onThe<%- startLR %>Generated.onTable("").iClickLink(0, "<%- column.property %>");
|
|
108
|
+
Then.onThe<%- startLR %>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
109
|
+
<%_ }); -%>
|
|
110
|
+
});
|
|
111
|
+
<%_ } -%>
|
|
103
112
|
<%_ if (startLR) { -%>
|
|
104
113
|
opaTest("Navigate to ObjectPage", function (_Given: Given, When: When, Then: Then) {
|
|
105
114
|
// Note: this test will fail if the ListReport page doesn't show any data
|
|
@@ -82,6 +82,10 @@ sap.ui.define([
|
|
|
82
82
|
targetAnnotation: "<%- field.targetAnnotation %>"
|
|
83
83
|
});
|
|
84
84
|
<% }) -%>
|
|
85
|
+
<% section.contactCardFields.forEach(function(field) { -%>
|
|
86
|
+
When.onThe<%- name%>Generated.onHeader().iClickLink({ property: "<%- field.property %>" });
|
|
87
|
+
Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
88
|
+
<% }) -%>
|
|
85
89
|
<% } -%>
|
|
86
90
|
<% } -%>
|
|
87
91
|
<% }) -%>
|
|
@@ -131,6 +135,10 @@ sap.ui.define([
|
|
|
131
135
|
Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckDelete({ visible: true });
|
|
132
136
|
// When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressDelete();
|
|
133
137
|
<% } -%>
|
|
138
|
+
<% section.contactCardColumns.forEach(function(column) { -%>
|
|
139
|
+
When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iClickLink(0, "<%- column.property %>");
|
|
140
|
+
Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
141
|
+
<% }) -%>
|
|
134
142
|
<% } -%>
|
|
135
143
|
<% if (section?.subSections?.length > 0) { -%>
|
|
136
144
|
<% section.subSections.forEach(function(subSection) { -%>
|
|
@@ -141,9 +149,19 @@ sap.ui.define([
|
|
|
141
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 %>"<% } %> });
|
|
142
150
|
<% }) -%>
|
|
143
151
|
<% } -%>
|
|
152
|
+
<% subSection.contactCardFields.forEach(function(field) { -%>
|
|
153
|
+
When.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" }).iClickLink({ property: "<%- field.property %>" });
|
|
154
|
+
Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
155
|
+
<% }) -%>
|
|
144
156
|
<% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
|
|
145
157
|
Then.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(subSection.tableColumns) %>);
|
|
146
158
|
<% } -%>
|
|
159
|
+
<% if (subSection.navigationProperty) { -%>
|
|
160
|
+
<% subSection.contactCardColumns.forEach(function(column) { -%>
|
|
161
|
+
When.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iClickLink(0, "<%- column.property %>");
|
|
162
|
+
Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
163
|
+
<% }) -%>
|
|
164
|
+
<% } -%>
|
|
147
165
|
<% }) -%>
|
|
148
166
|
<% } else { -%>
|
|
149
167
|
<% if (section.fields && section.fields.length > 0) { -%>
|
|
@@ -151,6 +169,10 @@ sap.ui.define([
|
|
|
151
169
|
Then.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iCheckField({ property: "<%- field.property %>"<% if (field.connectedFields) { %>, connectedFields: "<%- field.connectedFields %>"<% } %><% if (field.fieldGroup) { %>, fieldGroup: "<%- field.fieldGroup %>"<% } %> });
|
|
152
170
|
<% }) -%>
|
|
153
171
|
<% } -%>
|
|
172
|
+
<% section.contactCardFields.forEach(function(field) { -%>
|
|
173
|
+
When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" }).iClickLink({ property: "<%- field.property %>" });
|
|
174
|
+
Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
175
|
+
<% }) -%>
|
|
154
176
|
<% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
|
|
155
177
|
Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(section.tableColumns) %>);
|
|
156
178
|
<% } -%>
|
|
@@ -90,7 +90,7 @@ function journey() {
|
|
|
90
90
|
|
|
91
91
|
<% } -%>
|
|
92
92
|
<% if (headerSections?.length > 0) { -%>
|
|
93
|
-
opaTest("Check header facets of the Object Page", function (_Given: Given, _When: When
|
|
93
|
+
opaTest("Check header facets of the Object Page", function (_Given: Given, <% if (headerSections.some(function(section) { return section.contactCardFields?.length > 0; })) { %>When: When<% } else { %>_When: When<% } %>, Then: Then) {
|
|
94
94
|
<% headerSections.forEach(function(section) { -%>
|
|
95
95
|
<% if (section.microChart) { -%>
|
|
96
96
|
Then.onThe<%- name%>Generated.onHeader().iCheckMicroChart("<%- section.title %>", "");
|
|
@@ -104,6 +104,10 @@ function journey() {
|
|
|
104
104
|
targetAnnotation: "<%- field.targetAnnotation %>"
|
|
105
105
|
} as unknown as FieldIdentifier);
|
|
106
106
|
<% }) -%>
|
|
107
|
+
<% section.contactCardFields.forEach(function(field) { -%>
|
|
108
|
+
When.onThe<%- name%>Generated.onHeader().iClickLink({ property: "<%- field.property %>" } as unknown as FieldIdentifier);
|
|
109
|
+
Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
110
|
+
<% }) -%>
|
|
107
111
|
<% } -%>
|
|
108
112
|
<% } -%>
|
|
109
113
|
<% }) -%>
|
|
@@ -153,6 +157,10 @@ function journey() {
|
|
|
153
157
|
Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckDelete({ visible: true });
|
|
154
158
|
// When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iPressDelete();
|
|
155
159
|
<% } -%>
|
|
160
|
+
<% section.contactCardColumns.forEach(function(column) { -%>
|
|
161
|
+
When.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iClickLink(0, "<%- column.property %>");
|
|
162
|
+
Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
163
|
+
<% }) -%>
|
|
156
164
|
<% } -%>
|
|
157
165
|
<% if (section?.subSections?.length > 0) { -%>
|
|
158
166
|
<% section.subSections.forEach(function(subSection) { -%>
|
|
@@ -163,9 +171,19 @@ function journey() {
|
|
|
163
171
|
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 %>"<% } %> });
|
|
164
172
|
<% }) -%>
|
|
165
173
|
<% } -%>
|
|
174
|
+
<% subSection.contactCardFields.forEach(function(field) { -%>
|
|
175
|
+
When.onThe<%- name%>Generated.onForm({ section: "<%- subSection.id %>" } as unknown as FormIdentifier).iClickLink({ property: "<%- field.property %>" });
|
|
176
|
+
Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
177
|
+
<% }) -%>
|
|
166
178
|
<% if (subSection.tableColumns && Object.keys(subSection.tableColumns).length > 0 && subSection.navigationProperty) { -%>
|
|
167
179
|
Then.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(subSection.tableColumns) %>);
|
|
168
180
|
<% } -%>
|
|
181
|
+
<% if (subSection.navigationProperty) { -%>
|
|
182
|
+
<% subSection.contactCardColumns.forEach(function(column) { -%>
|
|
183
|
+
When.onThe<%- name%>Generated.onTable({ property: "<%- subSection.navigationProperty %>" }).iClickLink(0, "<%- column.property %>");
|
|
184
|
+
Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
185
|
+
<% }) -%>
|
|
186
|
+
<% } -%>
|
|
169
187
|
<% }) -%>
|
|
170
188
|
<% } else { -%>
|
|
171
189
|
<% if (section.fields && section.fields.length > 0) { -%>
|
|
@@ -173,6 +191,10 @@ function journey() {
|
|
|
173
191
|
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 %>"<% } %> });
|
|
174
192
|
<% }) -%>
|
|
175
193
|
<% } -%>
|
|
194
|
+
<% section.contactCardFields.forEach(function(field) { -%>
|
|
195
|
+
When.onThe<%- name%>Generated.onForm({ section: "<%- section.id %>" } as unknown as FormIdentifier).iClickLink({ property: "<%- field.property %>" });
|
|
196
|
+
Then.onThe<%- name%>Generated.onDialog().iCheckContactDialog({ controlType: "sap.ui.mdc.link.Panel" });
|
|
197
|
+
<% }) -%>
|
|
176
198
|
<% if (section.tableColumns && Object.keys(section.tableColumns).length > 0 && section.navigationProperty) { -%>
|
|
177
199
|
Then.onThe<%- name%>Generated.onTable({ property: "<%- section.navigationProperty %>" }).iCheckColumns(undefined, <%- JSON.stringify(section.tableColumns) %>);
|
|
178
200
|
<% } -%>
|