Beispiel #1
0
        public void TestPagination(User admin, IList <User> usersFromDb, int countOfUsers)
        {
            // Preconditions
            LoginPage loginPage = Application.Get().Login();
            UsersPage usersPage = loginPage.SuccessAdminLogin(admin);

            usersPage.ClickAdminTab();

            // Check if First and StepBack are disabled
            Assert.IsFalse(usersPage.IsFirstItemEnabled());
            Assert.IsFalse(usersPage.IsStepBackItemEnabled());

            usersPage.ClickStepForward();

            // Check if First, StepBack, StepForward, Last are enabled
            Assert.IsTrue(usersPage.AreAllPaginationElementsEnabled());

            // Check if second page of table is displayed
            CheckUsersAtTable(usersFromDb, usersPage);

            usersPage.ClickLast();

            // Check if Last and StepForward are disabled
            Assert.IsFalse(usersPage.IsStepForwardItemEnabled());
            Assert.IsFalse(usersPage.IsLastItemEnabled());

            // Check if last page of table is displayed
            CheckUsersAtTable(usersFromDb, usersPage);

            //Check count of users
            Assert.AreEqual(countOfUsers, CalcCountOfAllUsers(usersPage));

            usersPage.ClickStepBack();

            //Check if First, StepBack, StepForward, Last are enabled
            Assert.IsTrue(usersPage.AreAllPaginationElementsEnabled());

            //Check if last minus one page of table is displayed
            CheckUsersAtTable(usersFromDb, usersPage);

            // Return to previous state
            usersPage.GotoLogOut();
        }