Skip to content

Commit d6bb158

Browse files
fix: fragment input for verify changes (#3913)
* fix: fragment input for verify changes * failing matcher and selector test --------- Co-authored-by: gernotkuhr <65963444+gernotkuhr@users.noreply.github.com>
1 parent 4fcd62a commit d6bb158

File tree

5 files changed

+237
-114
lines changed

5 files changed

+237
-114
lines changed

tests/integration/adaptation-editor/manual_test_description_generated/quick-actions/list-report-v2.md

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [7. Enable Variant Management in Tables and Charts](#7-enable-variant-management-in-tables-and-charts)
1212
- [8. Change table actions](#8-change-table-actions)
1313
- [9. Add New Annotation File](#9-add-new-annotation-file)
14+
- [10. Add Custom Page Action](#10-add-custom-page-action)
1415

1516
<a id="1-enabledisable-clear-filter-bar-button"></a>
1617
## 1. Enable/Disable clear filter bar button
@@ -131,7 +132,10 @@
131132
```xml
132133
<!-- Use stable and unique IDs!-->
133134
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
134-
<!-- add your xml here -->
135+
<!-- viewName: sap.suite.ui.generic.template.ListReport.view.ListReport -->
136+
<!-- controlType: sap.m.OverflowToolbar -->
137+
<!-- targetAggregation: content -->
138+
<!-- add your xml here -->
135139
<Button text="New Button" id="btn-<UNIQUE_ID>"></Button>
136140
</core:FragmentDefinition>
137141

@@ -176,7 +180,10 @@
176180
**table-cell.fragment.xml**
177181
```xml
178182
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
179-
<!-- add your xml here -->
183+
<!-- viewName: sap.suite.ui.generic.template.ListReport.view.ListReport -->
184+
<!-- controlType: sap.m.Table -->
185+
<!-- targetAggregation: cells -->
186+
<!-- add your xml here -->
180187
<Text id="cell-text-<UNIQUE_ID>" text="Sample data" />
181188
</core:FragmentDefinition>
182189
```
@@ -185,7 +192,10 @@
185192
```xml
186193
<!-- Use stable and unique IDs!-->
187194
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
188-
<!-- add your xml here -->
195+
<!-- viewName: sap.suite.ui.generic.template.ListReport.view.ListReport -->
196+
<!-- controlType: sap.m.Table -->
197+
<!-- targetAggregation: columns -->
198+
<!-- add your xml here -->
189199
<Column id="column-<UNIQUE_ID>"
190200
width="12em"
191201
hAlign="Left"
@@ -405,3 +415,48 @@
405415

406416
---
407417

418+
<a id="10-add-custom-page-action"></a>
419+
## 10. Add Custom Page Action
420+
421+
### Steps
422+
423+
1. Check `UIAdaptation` mode in the toolbar is enabled
424+
2. Click `Add Custom Page Action` button in the Quick Actions Panel
425+
3. Fill `Fragment Name` field with `page-action` in the dialog `Add Custom Page Action`
426+
4. Click on `Create` button in the dialog `Add Custom Page Action`
427+
5. Click `Save and Reload` button in the toolBar
428+
6. Check `Save` button in the toolbar is disabled
429+
7. Verify changes:
430+
431+
**Fragment(s)**
432+
433+
**page-action.fragment.xml**
434+
```xml
435+
<!-- Use stable and unique IDs!-->
436+
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
437+
<!-- viewName: sap.suite.ui.generic.template.ListReport.view.ListReport -->
438+
<!-- controlType: sap.f.DynamicPageTitle -->
439+
<!-- targetAggregation: actions -->
440+
<!-- add your xml here -->
441+
<Button text="New Button" id="btn-<UNIQUE_ID>"></Button>
442+
</core:FragmentDefinition>
443+
444+
```
445+
446+
**Change(s)**
447+
448+
```json
449+
{
450+
"fileType": "change",
451+
"changeType": "addXML",
452+
"content": {
453+
"targetAggregation": "actions",
454+
"fragmentPath": "fragments/page-action.fragment.xml"
455+
}
456+
}
457+
```
458+
459+
460+
461+
---
462+

tests/integration/adaptation-editor/manual_test_description_generated/quick-actions/object-page-v2.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787

8888
**TestController.js**
8989
```js
90-
/ControllerExtension\.extend\("adp\.fiori\.elements\.v2\.TestController"/
90+
ControllerExtension\.extend\("adp\.fiori\.elements\.v2\.TestController"
9191
```
9292
9393
**Change(s)**
@@ -132,9 +132,13 @@
132132
```xml
133133
<!-- Use stable and unique IDs!-->
134134
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
135-
<!-- add your xml here -->
135+
<!-- viewName: sap.suite.ui.generic.template.ObjectPage.view.Details -->
136+
<!-- controlType: sap.m.OverflowToolbar -->
137+
<!-- targetAggregation: content -->
138+
<!-- add your xml here -->
136139
<Button text="New Button" id="btn-<UNIQUE_ID>"></Button>
137140
</core:FragmentDefinition>
141+
138142
```
139143
140144
**Change(s)**
@@ -192,7 +196,10 @@
192196
**table-cell.fragment.xml**
193197
```xml
194198
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
195-
<!-- add your xml here -->
199+
<!-- viewName: sap.suite.ui.generic.template.ObjectPage.view.Details -->
200+
<!-- controlType: sap.m.Table -->
201+
<!-- targetAggregation: cells -->
202+
<!-- add your xml here -->
196203
<Text id="cell-text-<UNIQUE_ID>" text="Sample data" />
197204
</core:FragmentDefinition>
198205
```
@@ -201,7 +208,10 @@
201208
```xml
202209
<!-- Use stable and unique IDs!-->
203210
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
204-
<!-- add your xml here -->
211+
<!-- viewName: sap.suite.ui.generic.template.ObjectPage.view.Details -->
212+
<!-- controlType: sap.m.Table -->
213+
<!-- targetAggregation: columns -->
214+
<!-- add your xml here -->
205215
<Column id="column-<UNIQUE_ID>"
206216
width="12em"
207217
hAlign="Left"
@@ -276,8 +286,11 @@
276286
xmlns:core='sap.ui.core'
277287
xmlns='sap.m'
278288
>
279-
<VBox id="vBox-<UNIQUE_ID>">
280-
<Label id="label-<UNIQUE_ID>" text="New Field"></Label>
289+
<!-- viewName: sap.suite.ui.generic.template.ObjectPage.view.Details -->
290+
<!-- controlType: sap.uxap.ObjectPageLayout -->
291+
<!-- targetAggregation: headerContent -->
292+
<VBox id="vBox-<UNIQUE_ID>">
293+
<Label id="label-<UNIQUE_ID>" text="New Field"></Label>
281294
</VBox>
282295
</core:FragmentDefinition>
283296
```
@@ -326,13 +339,16 @@
326339
xmlns:core='sap.ui.core'
327340
xmlns='sap.m'
328341
>
342+
<!-- viewName: sap.suite.ui.generic.template.ObjectPage.view.Details -->
343+
<!-- controlType: sap.uxap.ObjectPageLayout -->
344+
<!-- targetAggregation: sections -->
329345
<uxap:ObjectPageSection
330346
id="op-section-<UNIQUE_ID>"
331347
title="New Custom Section"
332348
>
333349
<uxap:ObjectPageSubSection id="op-subsection-<UNIQUE_ID>">
334350
<HBox id="hbox-<UNIQUE_ID>">
335-
<!-- add your xml here -->
351+
<!-- add your xml here -->
336352
</HBox>
337353
</uxap:ObjectPageSubSection>
338354
</uxap:ObjectPageSection>

tests/integration/adaptation-editor/src/scenarios/quick-actions/list-report-v2.spec.ts

Lines changed: 72 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,15 @@ test.describe(`@quick-actions @fe-v2 @list-report`, () => {
154154
}
155155
],
156156
fragments: {
157-
'table-action.fragment.xml': new RegExp(
158-
`<!-- Use stable and unique IDs!-->\\s*<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>\\s*<!-- viewName: sap.suite.ui.generic.template.ListReport.view.ListReport -->\\s*<!-- controlType: sap.m.OverflowToolbar -->\\s*<!-- targetAggregation: content -->\\s*<!--\\s*add your xml here -->\\s*<Button text="New Button" id="btn-[a-z0-9]+"><\\/Button>\\s*<\\/core:FragmentDefinition>`
159-
)
157+
'table-action.fragment.xml': `<!-- Use stable and unique IDs!-->
158+
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
159+
<!-- viewName: sap.suite.ui.generic.template.ListReport.view.ListReport -->
160+
<!-- controlType: sap.m.OverflowToolbar -->
161+
<!-- targetAggregation: content -->
162+
<!-- add your xml here -->
163+
<Button text="New Button" id="btn-[a-z0-9]+"></Button>
164+
</core:FragmentDefinition>
165+
`
160166
}
161167
});
162168
}
@@ -210,34 +216,31 @@ test.describe(`@quick-actions @fe-v2 @list-report`, () => {
210216
}
211217
],
212218
fragments: {
213-
'table-cell.fragment.xml': new RegExp(
214-
`<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>\\s*` +
215-
`<!-- viewName: sap.suite.ui.generic.template.ListReport.view.ListReport -->\\s*` +
216-
`<!-- controlType: sap.m.Table -->\\s*` +
217-
`<!-- targetAggregation: cells -->\\s*` +
218-
`<!--\\s*add your xml here -->\\s*` +
219-
`<Text id="cell-text-[a-z0-9]+" text="Sample data" \/>\\s*` +
220-
`<\\/core:FragmentDefinition>`
221-
),
222-
'table-column.fragment.xml': new RegExp(
223-
`<!-- Use stable and unique IDs!-->\\s*` +
224-
`<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>\\s*` +
225-
`<!-- viewName: sap.suite.ui.generic.template.ListReport.view.ListReport -->\\s*` +
226-
`<!-- controlType: sap.m.Table -->\\s*` +
227-
`<!-- targetAggregation: columns -->\\s*` +
228-
`<!--\\s*add your xml here -->\\s*` +
229-
`<Column id="column-[a-z0-9]+"\\s*` +
230-
`width="12em"\\s*` +
231-
`hAlign="Left"\\s*` +
232-
`vAlign="Middle">\\s*` +
233-
`<Text id="column-title-[a-z0-9]+" text="New column" \/>\\s*` +
234-
`<customData>\\s*` +
235-
`<core:CustomData key="p13nData" id="custom-data-[a-z0-9]+"\\s*` +
236-
`value='.*"columnKey": "column-[a-z0-9]+", "columnIndex": "3".*' \/>\\s*` +
237-
`<\\/customData>\\s*` +
238-
`<\\/Column>\\s*` +
239-
`<\\/core:FragmentDefinition>`
240-
)
219+
'table-cell.fragment.xml': `<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
220+
<!-- viewName: sap.suite.ui.generic.template.ListReport.view.ListReport -->
221+
<!-- controlType: sap.m.Table -->
222+
<!-- targetAggregation: cells -->
223+
<!-- add your xml here -->
224+
<Text id="cell-text-[a-z0-9]+" text="Sample data" />
225+
</core:FragmentDefinition>`,
226+
'table-column.fragment.xml': `<!-- Use stable and unique IDs!-->
227+
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
228+
<!-- viewName: sap.suite.ui.generic.template.ListReport.view.ListReport -->
229+
<!-- controlType: sap.m.Table -->
230+
<!-- targetAggregation: columns -->
231+
<!-- add your xml here -->
232+
<Column id="column-[a-z0-9]+"
233+
width="12em"
234+
hAlign="Left"
235+
vAlign="Middle">
236+
<Text id="column-title-[a-z0-9]+" text="New column" />
237+
238+
<customData>
239+
<core:CustomData key="p13nData" id="custom-data-[a-z0-9]+"
240+
value='\\\\{"columnKey": "column-[a-z0-9]+", "columnIndex": "3"}' />
241+
</customData>
242+
</Column>
243+
</core:FragmentDefinition>`
241244
}
242245
});
243246
await expect(lr.goButton).toBeVisible();
@@ -470,4 +473,42 @@ test.describe(`@quick-actions @fe-v2 @list-report`, () => {
470473
).toBeVisible();
471474
}
472475
);
476+
test('10. Add Custom Page Action', {}, async ({ page, previewFrame, ui5Version, projectCopy }) => {
477+
const dialog = new AdpDialog(previewFrame, ui5Version);
478+
const editor = new AdaptationEditorShell(page, ui5Version);
479+
480+
await editor.reloadCompleted();
481+
await editor.quickActions.addCustomPageAction.click();
482+
483+
await dialog.fillField('Fragment Name', 'page-action');
484+
await dialog.clickCreateButton();
485+
486+
await editor.toolbar.saveAndReloadButton.click();
487+
488+
await editor.toolbar.isDisabled();
489+
490+
await verifyChanges(projectCopy, {
491+
changes: [
492+
{
493+
fileType: 'change',
494+
changeType: 'addXML',
495+
content: {
496+
targetAggregation: 'actions',
497+
fragmentPath: 'fragments/page-action.fragment.xml'
498+
}
499+
}
500+
],
501+
fragments: {
502+
'page-action.fragment.xml': `<!-- Use stable and unique IDs!-->
503+
<core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'>
504+
<!-- viewName: sap.suite.ui.generic.template.ListReport.view.ListReport -->
505+
<!-- controlType: sap.f.DynamicPageTitle -->
506+
<!-- targetAggregation: actions -->
507+
<!-- add your xml here -->
508+
<Button text="New Button" id="btn-[a-z0-9]+"></Button>
509+
</core:FragmentDefinition>
510+
`
511+
}
512+
});
513+
});
473514
});

0 commit comments

Comments
 (0)