diff --git a/webapp/test/integration/WorklistJourney.js b/webapp/test/integration/WorklistJourney.js index e729e64..73432da 100644 --- a/webapp/test/integration/WorklistJourney.js +++ b/webapp/test/integration/WorklistJourney.js @@ -1,22 +1,26 @@ /*global QUnit*/ -sap.ui.define([ - "sap/ui/test/opaQunit", - "./pages/Worklist" -], function (opaTest) { - "use strict"; +sap.ui.define(["sap/ui/test/opaQunit", "./pages/Worklist"], function (opaTest) { + "use strict"; - QUnit.module("Posts"); + QUnit.module("Posts"); - opaTest("Should see the table with all posts", function (Given, When, Then) { - // Arrangements - Given.iStartMyApp(); + opaTest("Should see the table with all posts", function (Given, When, Then) { + // Arrangements + Given.iStartMyApp(); - // Assertions - Then.onTheWorklistPage.theTableShouldHaveAllEntries(). - and.theTitleShouldDisplayTheTotalAmountOfItems(); + // Assertions + Then.onTheWorklistPage + .theTableShouldHavePagination() + .and.theTitleShouldDisplayTheTotalAmountOfItems(); + }); - // Cleanup - Then.iTeardownMyApp(); - }); + opaTest("Should be able to load more items", function (Given, When, Then) { + //Actions + When.onTheWorklistPage.iPressOnMoreData(); + // Assertions + Then.onTheWorklistPage.theTableShouldHaveAllEntries(); + // Cleanup + Then.iTeardownMyApp(); + }); }); diff --git a/webapp/test/integration/pages/Worklist.js b/webapp/test/integration/pages/Worklist.js index c2ee413..7c3808f 100644 --- a/webapp/test/integration/pages/Worklist.js +++ b/webapp/test/integration/pages/Worklist.js @@ -1,11 +1,12 @@ sap.ui.define([ 'sap/ui/test/Opa5', 'sap/ui/test/matchers/AggregationLengthEquals', - 'sap/ui/test/matchers/I18NText' + 'sap/ui/test/matchers/I18NText', + 'sap/ui/test/actions/Press' ], function (Opa5, AggregationLengthEquals, - I18NText) { + I18NText, Press) { "use strict"; var sViewName = "Worklist", @@ -13,8 +14,32 @@ sap.ui.define([ Opa5.createPageObjects({ onTheWorklistPage: { - actions: {}, + actions: { + iPressOnMoreData: function () { + // Press action hits the "more" trigger on a table + return this.waitFor({ + id: sTableId, + viewName: sViewName, + actions: new Press(), + errorMessage: "The table does not have a trigger." + }); + } + }, assertions: { + theTableShouldHavePagination: function () { + return this.waitFor({ + id: sTableId, + viewName: sViewName, + matchers: new AggregationLengthEquals({ + name: "items", + length: 20 + }), + success: function () { + Opa5.assert.ok(true, "The table has 20 items on the first page"); + }, + errorMessage: "The table does not contain all items." + }); + }, theTableShouldHaveAllEntries: function () { return this.waitFor({ id: sTableId,