GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Added everything for Step 8: Testing Navigation · wridgeu/UI5-testing@2b69492

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • webapp/test/integration
    • AllJourneys.js
    • PostJourney.js
    • pages
      • Browser.js
      • Post.js
      • Worklist.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎webapp/test/integration/AllJourneys.js‎

Copy file name to clipboardExpand all lines: webapp/test/integration/AllJourneys.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
sap.ui.define([
22
"sap/ui/test/Opa5",
33
"./arrangements/Startup",
4-
"./WorklistJourney"
4+
"./WorklistJourney",
5+
"./PostJourney"
56
], function (Opa5, Startup) {
67
"use strict";
78

Collapse file

‎webapp/test/integration/PostJourney.js‎

Copy file name to clipboard
+45Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
sap.ui.define(
2+
[
3+
"sap/ui/test/opaQunit",
4+
"./pages/Worklist",
5+
"./pages/Browser",
6+
"./pages/Post",
7+
],
8+
function (opaTest) {
9+
"use strict";
10+
11+
QUnit.module("Post");
12+
13+
opaTest(
14+
"Should see the post page when a user click on an entry of the list",
15+
function (Given, When, Then) {
16+
//Arrangements
17+
Given.iStartMyApp();
18+
19+
//Actions
20+
When.onTheWorklistPage.iPressOnTheItemWithTheID("PostID_15");
21+
22+
//Assertion
23+
Then.onThePostPage.theTitleShouldDisplayTheName("Jeans");
24+
}
25+
);
26+
27+
opaTest("Should go back to the TablePage", function (Given, When, Then) {
28+
// Actions
29+
When.onThePostPage.iPressTheBackButton();
30+
31+
// Assertions
32+
Then.onTheWorklistPage.iShouldSeeTheTable();
33+
});
34+
opaTest("Should be on the post page again when the browser's forward button is pressed", function (Given, When, Then) {
35+
// Actions
36+
When.onTheBrowser.iPressOnTheForwardButton();
37+
38+
// Assertions
39+
Then.onThePostPage.theTitleShouldDisplayTheName("Jeans");
40+
41+
// Cleanup
42+
Then.iTeardownMyApp();
43+
});
44+
}
45+
);
Collapse file

‎webapp/test/integration/pages/Browser.js‎

Copy file name to clipboard
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
sap.ui.define(["sap/ui/test/Opa5"], function (Opa5) {
2+
"use strict";
3+
Opa5.createPageObjects({
4+
onTheBrowser: {
5+
actions: {
6+
iPressOnTheForwardButton: function () {
7+
return this.waitFor({
8+
success: function () {
9+
Opa5.getWindow().history.forward();
10+
},
11+
});
12+
},
13+
},
14+
assertions: {},
15+
},
16+
});
17+
});
Collapse file

‎webapp/test/integration/pages/Post.js‎

Copy file name to clipboard
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
sap.ui.define([
2+
'sap/ui/test/Opa5',
3+
'sap/ui/test/matchers/Properties',
4+
'sap/ui/test/actions/Press'
5+
], function (Opa5, Properties, Press) {
6+
"use strict";
7+
var sViewName = "Post";
8+
Opa5.createPageObjects({
9+
onThePostPage: {
10+
actions: {
11+
iPressTheBackButton: function () {
12+
return this.waitFor({
13+
id: "page",
14+
viewName: sViewName,
15+
actions: new Press(),
16+
errorMessage: "Did not find the nav button on object page"
17+
});
18+
}
19+
},
20+
assertions: {
21+
theTitleShouldDisplayTheName: function (sName) {
22+
return this.waitFor({
23+
success: function () {
24+
return this.waitFor({
25+
id: "objectHeader",
26+
viewName: sViewName,
27+
matchers: new Properties({
28+
title: sName
29+
}),
30+
success: function (oPage) {
31+
Opa5.assert.ok(true, "was on the remembered detail page");
32+
},
33+
errorMessage: "The Post " + sName + " is not shown"
34+
});
35+
}
36+
});
37+
}
38+
}
39+
}
40+
});
41+
});
Collapse file

‎webapp/test/integration/pages/Worklist.js‎

Copy file name to clipboard
+99-75Lines changed: 99 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,102 @@
1-
sap.ui.define([
2-
'sap/ui/test/Opa5',
3-
'sap/ui/test/matchers/AggregationLengthEquals',
4-
'sap/ui/test/matchers/I18NText',
5-
'sap/ui/test/actions/Press'
6-
],
7-
function (Opa5,
8-
AggregationLengthEquals,
9-
I18NText, Press) {
10-
"use strict";
1+
sap.ui.define(
2+
[
3+
"sap/ui/test/Opa5",
4+
"sap/ui/test/matchers/AggregationLengthEquals",
5+
"sap/ui/test/matchers/I18NText",
6+
"sap/ui/test/actions/Press",
7+
"sap/ui/test/matchers/BindingPath",
8+
],
9+
function (Opa5, AggregationLengthEquals, I18NText, Press, BindingPath) {
10+
"use strict";
1111

12-
var sViewName = "Worklist",
13-
sTableId = "table";
12+
var sViewName = "Worklist",
13+
sTableId = "table";
1414

15-
Opa5.createPageObjects({
16-
onTheWorklistPage: {
17-
actions: {
18-
iPressOnMoreData: function () {
19-
// Press action hits the "more" trigger on a table
20-
return this.waitFor({
21-
id: sTableId,
22-
viewName: sViewName,
23-
actions: new Press(),
24-
errorMessage: "The table does not have a trigger."
25-
});
26-
}
27-
},
28-
assertions: {
29-
theTableShouldHavePagination: function () {
30-
return this.waitFor({
31-
id: sTableId,
32-
viewName: sViewName,
33-
matchers: new AggregationLengthEquals({
34-
name: "items",
35-
length: 20
36-
}),
37-
success: function () {
38-
Opa5.assert.ok(true, "The table has 20 items on the first page");
39-
},
40-
errorMessage: "The table does not contain all items."
41-
});
42-
},
43-
theTableShouldHaveAllEntries: function () {
44-
return this.waitFor({
45-
id: sTableId,
46-
viewName: sViewName,
47-
matchers: new AggregationLengthEquals({
48-
name: "items",
49-
length: 23
50-
}),
51-
success: function () {
52-
Opa5.assert.ok(true, "The table has 23 items");
53-
},
54-
errorMessage: "The table does not contain all items."
55-
});
56-
},
15+
Opa5.createPageObjects({
16+
onTheWorklistPage: {
17+
actions: {
18+
iPressOnMoreData: function () {
19+
// Press action hits the "more" trigger on a table
20+
return this.waitFor({
21+
id: sTableId,
22+
viewName: sViewName,
23+
actions: new Press(),
24+
errorMessage: "The table does not have a trigger.",
25+
});
26+
},
27+
iPressOnTheItemWithTheID: function (sId) {
28+
return this.waitFor({
29+
controlType: "sap.m.ColumnListItem",
30+
viewName: sViewName,
31+
matchers: new BindingPath({
32+
path: "/Posts('" + sId + "')",
33+
}),
34+
actions: new Press(),
35+
errorMessage: "No list item with the id " + sId + " was found.",
36+
});
37+
},
38+
},
39+
assertions: {
40+
theTableShouldHavePagination: function () {
41+
return this.waitFor({
42+
id: sTableId,
43+
viewName: sViewName,
44+
matchers: new AggregationLengthEquals({
45+
name: "items",
46+
length: 20,
47+
}),
48+
success: function () {
49+
Opa5.assert.ok(
50+
true,
51+
"The table has 20 items on the first page"
52+
);
53+
},
54+
errorMessage: "The table does not contain all items.",
55+
});
56+
},
57+
theTableShouldHaveAllEntries: function () {
58+
return this.waitFor({
59+
id: sTableId,
60+
viewName: sViewName,
61+
matchers: new AggregationLengthEquals({
62+
name: "items",
63+
length: 23,
64+
}),
65+
success: function () {
66+
Opa5.assert.ok(true, "The table has 23 items");
67+
},
68+
errorMessage: "The table does not contain all items.",
69+
});
70+
},
5771

58-
theTitleShouldDisplayTheTotalAmountOfItems: function () {
59-
return this.waitFor({
60-
id: "tableHeader",
61-
viewName: sViewName,
62-
matchers: new I18NText({
63-
key: "worklistTableTitleCount",
64-
propertyName: "text",
65-
parameters: [23]
66-
}),
67-
success: function () {
68-
Opa5.assert.ok(true, "The table header has 23 items");
69-
},
70-
errorMessage: "The table header does not contain the number of items: 23"
71-
});
72-
}
73-
74-
}
75-
}
76-
});
77-
78-
});
72+
theTitleShouldDisplayTheTotalAmountOfItems: function () {
73+
return this.waitFor({
74+
id: "tableHeader",
75+
viewName: sViewName,
76+
matchers: new I18NText({
77+
key: "worklistTableTitleCount",
78+
propertyName: "text",
79+
parameters: [23],
80+
}),
81+
success: function () {
82+
Opa5.assert.ok(true, "The table header has 23 items");
83+
},
84+
errorMessage:
85+
"The table header does not contain the number of items: 23",
86+
});
87+
},
88+
iShouldSeeTheTable: function () {
89+
return this.waitFor({
90+
id: sTableId,
91+
viewName: sViewName,
92+
success: function () {
93+
Opa5.assert.ok(true, "The table is visible");
94+
},
95+
errorMessage: "Was not able to see the table.",
96+
});
97+
},
98+
},
99+
},
100+
});
101+
}
102+
);

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.