public void ChangeUserRoleTest(string userName) { // Preconditions LoginPage loginPage = Application.Get().Login(); UsersPage usersPage = loginPage.SuccessAdminLogin(UserRepository.Get().Admin()); usersPage.SetValueToSearch(userName); // Test steps // Step 1:Check if checkboxes are disabled and edit button is displayed Assert.False(usersPage.IsAdminRoleEnabled()); Assert.False(usersPage.IsTeacherRoleEnabled()); Assert.False(usersPage.IsStudentRoleEnabled()); Assert.IsTrue(usersPage.IsDisplayedEditPencil()); // Step 2: Click edit user role button, check if checkboxes are enabled usersPage.EditRole(); Assert.IsTrue(usersPage.IsDisplayedCheckMark()); //Assert.IsTrue(usersPage.IsAdminRoleEnabled()); //Assert.IsTrue(usersPage.IsTeacherRoleEnabled()); //Assert.IsTrue(usersPage.IsStudentRoleEnabled()); // Step 3: Change state of teacher role chekbox usersPage.SetTeacherRole(); Assert.False(usersPage.IsTeacherRoleChecked()); usersPage.FinishEditing(); Assert.False(usersPage.IsTeacherRoleChecked()); // Return to previous state usersPage.EditRole(); usersPage.SetTeacherRole(); usersPage.FinishEditing(); loginPage = usersPage.GotoLogOut(); }
public void UserSearchTest(string userName) { const string DEFAULT_SEARCHBOX_PLACEHOLDER_VALUE = "Search users"; // Preconditions LoginPage loginPage = Application.Get(ApplicationSourcesRepository.ChromeByIP()).Login(); UsersPage usersPage = loginPage.SuccessAdminLogin(UserRepository.Get().Admin()); // Test Steps // Step 1: Check default value of search box Input users name into search field Assert.AreEqual(DEFAULT_SEARCHBOX_PLACEHOLDER_VALUE, usersPage.GetUserSearchBoxText()); // Step 2: Enter user name into search box usersPage.SetValueToSearch(userName); // Step 3: Check if user name from test data are equal with user from table IList <User> actual = usersPage.GetUsersDataForTable(); IList <User> expected = actual.Where(item => item.GetName().Contains(userName)).ToList(); Assert.AreEqual(expected, actual); // Return to previous state loginPage = usersPage.GotoLogOut(); }