Skip to content

Commit

Permalink
Added everything for Step 13: Testing User Interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
wridgeu committed Jun 11, 2020
1 parent f38ea27 commit 6d158b9
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 48 deletions.
20 changes: 13 additions & 7 deletions webapp/test/integration/PostJourney.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,21 @@ sap.ui.define(
// Assertions
Then.onTheWorklistPage.iShouldSeeTheTable();
});
opaTest("Should be on the post page again when the browser's forward button is pressed", function (Given, When, Then) {
// Actions
When.onTheBrowser.iPressOnTheForwardButton();
opaTest(
"Should be on the post page again when the browser's forward button is pressed",
function (Given, When, Then) {
// Actions
When.onTheBrowser.iPressOnTheForwardButton();

// Assertions
Then.onThePostPage.theTitleShouldDisplayTheName("Jeans");
}
);
opaTest("Should select the statistics tab", function (Given, When, Then) {
// Actions
When.onThePostPage.iPressOnTheTabWithTheKey("statistics");
// Assertions
Then.onThePostPage.theTitleShouldDisplayTheName("Jeans");

// Cleanup
Then.iTeardownMyApp();
Then.onThePostPage.iShouldSeeTheViewCounter().and.iTeardownMyApp();
});
}
);
106 changes: 65 additions & 41 deletions webapp/test/integration/pages/Post.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,65 @@
sap.ui.define([
'sap/ui/test/Opa5',
'sap/ui/test/matchers/Properties',
'sap/ui/test/actions/Press'
], function (Opa5, Properties, Press) {
"use strict";
var sViewName = "Post";
Opa5.createPageObjects({
onThePostPage: {
actions: {
iPressTheBackButton: function () {
return this.waitFor({
id: "page",
viewName: sViewName,
actions: new Press(),
errorMessage: "Did not find the nav button on object page"
});
}
},
assertions: {
theTitleShouldDisplayTheName: function (sName) {
return this.waitFor({
success: function () {
return this.waitFor({
id: "objectHeader",
viewName: sViewName,
matchers: new Properties({
title: sName
}),
success: function (oPage) {
Opa5.assert.ok(true, "was on the remembered detail page");
},
errorMessage: "The Post " + sName + " is not shown"
});
}
});
}
}
}
});
});
sap.ui.define(
[
"sap/ui/test/Opa5",
"sap/ui/test/matchers/Properties",
"sap/ui/test/actions/Press",
],
function (Opa5, Properties, Press) {
"use strict";
var sViewName = "Post";
Opa5.createPageObjects({
onThePostPage: {
actions: {
iPressTheBackButton: function () {
return this.waitFor({
id: "page",
viewName: sViewName,
actions: new Press(),
errorMessage: "Did not find the nav button on object page",
});
},
iPressOnTheTabWithTheKey: function (sKey) {
return this.waitFor({
controlType: "sap.m.IconTabFilter",
viewName: sViewName,
matchers: new Properties({
key: sKey,
}),
actions: new Press(),
errorMessage: "Cannot find the icon tab bar",
});
},
},
assertions: {
theTitleShouldDisplayTheName: function (sName) {
return this.waitFor({
success: function () {
return this.waitFor({
id: "objectHeader",
viewName: sViewName,
matchers: new Properties({
title: sName,
}),
success: function (oPage) {
Opa5.assert.ok(true, "was on the remembered detail page");
},
errorMessage: "The Post " + sName + " is not shown",
});
},
});
},
iShouldSeeTheViewCounter: function () {
return this.waitFor({
id: "viewCounter",
viewName: sViewName,
success: function () {
Opa5.assert.ok(true, "The view counter was visible");
},
errorMessage: "The view counter could not be found",
});
},
},
},
});
}
);

0 comments on commit 6d158b9

Please sign in to comment.