Skip to content

Commit bddb553

Browse files
committed
OpenUI5 Documentation Update 17.05.2024
1 parent 1cdf47d commit bddb553

File tree

1 file changed

+70
-77
lines changed

1 file changed

+70
-77
lines changed

docs/Step_6_A_First_OPA_Test_1b47457.md

Lines changed: 70 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ The journey uses another structuring element of OPA called “page object” tha
5858

5959
```js
6060
sap.ui.define([
61-
"sap/ui/test/opaQunit",
62-
"./pages/Worklist"
61+
'sap/ui/test/opaQunit',
62+
'./pages/Worklist'
6363
], function (opaTest) {
6464
"use strict";
6565

@@ -116,86 +116,79 @@ Now you might wonder where all those descriptive functions and the helper object
116116

117117
```js
118118
sap.ui.define([
119-
'sap/ui/test/Opa5',
120-
'sap/ui/test/matchers/AggregationLengthEquals',
121-
'sap/ui/test/matchers/I18NText',
122-
'sap/ui/test/actions/Press'
123-
],
124-
function (Opa5,
125-
AggregationLengthEquals,
126-
I18NText,
127-
Press) {
128-
"use strict";
129-
130-
var sViewName = "Worklist",
131-
sTableId = "table";
132-
133-
Opa5.createPageObjects({
134-
onTheWorklistPage: {
135-
actions: {
136-
iPressOnMoreData: function () {
137-
// Press action hits the "more" trigger on a table
138-
return this.waitFor({
139-
id: sTableId,
140-
viewName: sViewName,
141-
actions: new Press(),
142-
errorMessage: "The table does not have a trigger."
143-
});
144-
}
119+
'sap/ui/test/Opa5',
120+
'sap/ui/test/matchers/AggregationLengthEquals',
121+
'sap/ui/test/matchers/I18NText',
122+
'sap/ui/test/actions/Press'
123+
], function (Opa5, AggregationLengthEquals, I18NText, Press) {
124+
"use strict";
125+
126+
var sViewName = "Worklist",
127+
sTableId = "table";
128+
129+
Opa5.createPageObjects({
130+
onTheWorklistPage: {
131+
actions: {
132+
iPressOnMoreData: function () {
133+
// Press action hits the "more" trigger on a table
134+
return this.waitFor({
135+
id: sTableId,
136+
viewName: sViewName,
137+
actions: new Press(),
138+
errorMessage: "The table does not have a trigger."
139+
});
140+
}
141+
},
142+
assertions: {
143+
theTableShouldHavePagination: function () {
144+
return this.waitFor({
145+
id: sTableId,
146+
viewName: sViewName,
147+
matchers: new AggregationLengthEquals({
148+
name: "items",
149+
length: 20
150+
}),
151+
success: function () {
152+
Opa5.assert.ok(true, "The table has 20 items on the first page");
153+
},
154+
errorMessage: "The table does not contain all items."
155+
});
156+
},
157+
158+
theTableShouldHaveAllEntries: function () {
159+
return this.waitFor({
160+
id: sTableId,
161+
viewName: sViewName,
162+
matchers: new AggregationLengthEquals({
163+
name: "items",
164+
length: 23
165+
}),
166+
success: function () {
167+
Opa5.assert.ok(true, "The table has 23 items");
168+
},
169+
errorMessage: "The table does not contain all items."
170+
});
145171
},
146-
assertions: {
147-
theTableShouldHavePagination: function () {
148-
return this.waitFor({
149-
id: sTableId,
150-
viewName: sViewName,
151-
matchers: new AggregationLengthEquals({
152-
name: "items",
153-
length: 20
154-
}),
155-
success: function () {
156-
Opa5.assert.ok(true, "The table has 20 items on the first page");
157-
},
158-
errorMessage: "The table does not contain all items."
159-
});
160-
},
161-
162-
theTableShouldHaveAllEntries: function () {
163-
return this.waitFor({
164-
id: sTableId,
165-
viewName: sViewName,
166-
matchers: new AggregationLengthEquals({
167-
name: "items",
168-
length: 23
169-
}),
170-
success: function () {
171-
Opa5.assert.ok(true, "The table has 23 items");
172-
},
173-
errorMessage: "The table does not contain all items."
174-
});
175-
},
176-
177-
theTitleShouldDisplayTheTotalAmountOfItems: function () {
178-
return this.waitFor({
179-
id: "tableHeader",
180-
viewName: sViewName,
181-
matchers: new I18NText({
182-
key: "worklistTableTitleCount",
183-
propertyName: "text",
184-
parameters: [23]
185-
}),
186-
success: function () {
187-
Opa5.assert.ok(true, "The table header has 23 items");
188-
},
189-
errorMessage: "The table header does not contain the number of items: 23"
190-
});
191-
}
192172

173+
theTitleShouldDisplayTheTotalAmountOfItems: function () {
174+
return this.waitFor({
175+
id: "tableHeader",
176+
viewName: sViewName,
177+
matchers: new I18NText({
178+
key: "worklistTableTitleCount",
179+
propertyName: "text",
180+
parameters: [23]
181+
}),
182+
success: function () {
183+
Opa5.assert.ok(true, "The table header has 23 items");
184+
},
185+
errorMessage: "The table header does not contain the number of items: 23"
186+
});
193187
}
194188
}
195-
});
196-
189+
}
197190
});
198-
191+
});
199192
```
200193

201194
As you can see, the OPA page object is constructed with the call `Opa5.createPageObjects` and a `configuration` object that contains the actions and assertions properties.

0 commit comments

Comments
 (0)