diff --git a/webapp/test/integration/PostJourney.js b/webapp/test/integration/PostJourney.js index 5ebc624..d7e172c 100644 --- a/webapp/test/integration/PostJourney.js +++ b/webapp/test/integration/PostJourney.js @@ -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(); }); } ); diff --git a/webapp/test/integration/pages/Post.js b/webapp/test/integration/pages/Post.js index c5a0243..007c533 100644 --- a/webapp/test/integration/pages/Post.js +++ b/webapp/test/integration/pages/Post.js @@ -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" - }); - } - }); - } - } - } - }); - }); \ No newline at end of file +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", + }); + }, + }, + }, + }); + } +);