Skip to content

Commit dec61ab

Browse files
committed
feat(ui5): adapt TestRecorder example to use async/await
1 parent 7efc160 commit dec61ab

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

plugins/ui5/skills/opa5/references/enable-testrecorder-tooling.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,16 @@ The `sap.ui.testrecorder` library provides the module `sap.ui.testrecorder.Contr
5050
## Example Usage
5151
5252
```javascript
53-
sap.ui.require(["sap/ui/testrecorder/ControlTree"], function(ControlTree) {
53+
sap.ui.require(["sap/ui/testrecorder/ControlTree"], async function (ControlTree) {
5454
// Navigate to the state where the anchor bar is visible, then:
55-
ControlTree.search("anchorBar").then(function(tree) {
56-
// Parse: Button nodeId="1_8" text="Methods"
57-
return ControlTree.press("1_8");
58-
}).then(function(actionSnippet) {
59-
// actionSnippet is the OPA5 snippet — save it; UI has now navigated
60-
return ControlTree.search("selectedSection");
61-
}).then(function(tree) {
62-
// Parse: ObjectPageLayout nodeId="2_3"
63-
return ControlTree.getControlData("2_3");
64-
}).then(function(result) {
65-
// result.selectorSnippet + result.associations → build assertion
66-
});
55+
const tree = await ControlTree.search("anchorBar");
56+
// Inspect tree (markdown snapshot) and pick nodeId, e.g. Button nodeId="1_8" text="Methods"
57+
const actionSnippet = await ControlTree.press("1_8");
58+
// actionSnippet is the OPA5 snippet — save it; UI has now navigated
59+
60+
const treeAfterPress = await ControlTree.search("selectedSection");
61+
// Inspect treeAfterPress and pick nodeId, e.g. ObjectPageLayout nodeId="2_3"
62+
const result = await ControlTree.getControlData("2_3");
63+
// result.selectorSnippet + result.associations → build assertion
6764
});
68-
```
65+
```

0 commit comments

Comments
 (0)