Skip to content

Commit

Permalink
Added everything for Step 11: Testing User Input
Browse files Browse the repository at this point in the history
  • Loading branch information
wridgeu committed Jun 7, 2020
1 parent cb9aec8 commit ff36d79
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
11 changes: 10 additions & 1 deletion webapp/test/integration/WorklistJourney.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ sap.ui.define(["sap/ui/test/opaQunit", "./pages/Worklist"], function (opaTest) {

// Assertions
Then.onTheWorklistPage.theTableShouldHaveAllEntries();
// Cleanup
});

opaTest("Should be able to search for items", function(Given, When, Then){
//Actions
When.onTheWorklistPage.iSearchFor("Bear");

//Assertion
Then.onTheWorklistPage.theTableShouldHaveOneItem();

//Cleanup
Then.iTeardownMyApp();
});
});
37 changes: 36 additions & 1 deletion webapp/test/integration/pages/Worklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ sap.ui.define(
"sap/ui/test/matchers/I18NText",
"sap/ui/test/actions/Press",
"sap/ui/test/matchers/BindingPath",
"sap/ui/test/actions/EnterText",
],
function (Opa5, AggregationLengthEquals, I18NText, Press, BindingPath) {
function (
Opa5,
AggregationLengthEquals,
I18NText,
Press,
BindingPath,
EnterText
) {
"use strict";

var sViewName = "Worklist",
Expand Down Expand Up @@ -35,6 +43,16 @@ sap.ui.define(
errorMessage: "No list item with the id " + sId + " was found.",
});
},
iSearchFor: function (sSearchString) {
return this.waitFor({
id: "searchField",
viewName: sViewName,
actions: new EnterText({
text: sSearchString,
}),
errorMessage: "SearchField was not found.",
});
},
},
assertions: {
theTableShouldHavePagination: function () {
Expand Down Expand Up @@ -95,6 +113,23 @@ sap.ui.define(
errorMessage: "Was not able to see the table.",
});
},
theTableHasOneItem: function () {
return this.waitFor({
id: sTableId,
viewName: sViewName,
matchers: new AggregationLengthEquals({
name: "items",
length: 1,
}),
success: function () {
Opa5.assert.ok(
true,
"The table contains one corresponding entry"
);
},
errorMessage: "The table does not contain one item.",
});
}
},
},
});
Expand Down

0 comments on commit ff36d79

Please sign in to comment.