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 TestSignin(User admin) { // Precondition // Test Steps LoginPage loginPage = Application.Get().Login(); UsersPage usersPage = loginPage.SuccessAdminLogin(admin); //UsersPage usersPage = Application.Get().Login().SuccessAdminLogin(admin); // // Check Assert.AreEqual(admin.GetName(), usersPage.GetUsernameText()); // // Return to previous state loginPage = usersPage.GotoLogOut(); // // Check Assert.AreEqual("SoftServe Language School", loginPage.GetLoginDescriptionText()); }
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(); }
public void TestUsersTable(User user, string[] columnNames) { // Test steps LoginPage loginPage = Application.Get().Login(); UsersPage usersPage = loginPage.SuccessAdminLogin(user); // Check whether column names are presented in user table foreach (var columnName in columnNames) { Assert.IsTrue(usersPage.GetHeadColumnsText().Contains(columnName)); } // Check whether users in appropriate columns in user table are checked Assert.IsTrue(usersPage.IsUserCheckedAsAdmin()); Assert.IsTrue(usersPage.IsUserCheckedAsTeacher()); Assert.IsTrue(usersPage.IsUserCheckedAsStudent()); // Return to previous state 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(); }
public void TestSignin(User admin) { // Precondition // Test Steps LoginPage loginPage = Pages.Application.Get().Login(); UsersPage usersPage = loginPage.SuccessAdminLogin(admin); //UsersPage usersPage = Application.Get().Login().SuccessAdminLogin(admin); // // Check Assert.AreEqual("LV-204 ISTQB", usersPage.GetUsernameText()); // // Return to previous state loginPage = usersPage.GotoLogOut(); // // Check Assert.AreEqual("SoftServe Language School", loginPage.GetLoginDescriptionText()); //-------------------------------------------------------------- //[Test] Manager manager; Settings mySettings = new Settings(); // // Precondition mySettings.Web.DefaultBrowser = BrowserType.Chrome; manager = new Manager(mySettings); manager.Start(); manager.LaunchNewBrowser(); manager.ActiveBrowser.NavigateTo("https://wow.training.local/Index#/Home"); // IList <HtmlControl> description = manager.ActiveBrowser.Find.AllByXPath <HtmlControl>("//div[@class='text-primary']/h2/small"); Console.WriteLine("description = " + description.Count); if ((description.Count == 0) && (manager.ActiveBrowser.BrowserType == BrowserType.Chrome)) { for (int i = 0; i < 5; i++) { manager.ActiveBrowser.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Tab); } manager.ActiveBrowser.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Space); manager.ActiveBrowser.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Tab); manager.ActiveBrowser.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Tab); manager.ActiveBrowser.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Enter); } Thread.Sleep(1000); HtmlButton loginButton = manager.ActiveBrowser.Find.ByAttributes <HtmlButton>("class=btn btn-success"); loginButton.Click(); HtmlInputEmail loginInput = manager.ActiveBrowser.Find.ByAttributes <HtmlInputEmail>("ng-model=email"); loginInput.Text = "*****@*****.**"; Thread.Sleep(1000); HtmlInputPassword passwordInput = manager.ActiveBrowser.Find.ByAttributes <HtmlInputPassword>("ng-model=password"); passwordInput.Text = "q2w3e4r5"; Thread.Sleep(1000); HtmlInputSubmit submitInput = manager.ActiveBrowser.Find.ByName <HtmlInputSubmit>("loginButton"); submitInput.Click(); Thread.Sleep(2000); // Check HtmlSpan userAccount = manager.ActiveBrowser.Find.ByAttributes <HtmlSpan>("ng-bind=userName"); Assert.AreEqual("Mariana Medynska", userAccount.TextContent); //Steps--------------------------------------------------------------------------------------------- HtmlSpan managerButton = manager.ActiveBrowser.Find.ByContent <HtmlSpan>("p:Manager"); managerButton.Click(); //# cursorStyle > span:nth-child(2) // //*[@id="cursorStyle"]/span[1] HtmlSpan groupsButton = manager.ActiveBrowser.Find.ByContent <HtmlSpan>("l:Groups"); managerButton.Click(); // //*[@id="teaching-tools"]/li/ul/li[4]/a/span //#teaching-tools > li > ul > li:nth-child(4) > a > span var myGroupsText = manager.ActiveBrowser.Find.ByXPath("//h2['My Groups']"); Assert.AreEqual("My Groups", myGroupsText.TextContent); // #myJum > div > div.container.ng-scope > div:nth-child(1) > div > h2 // //*[@id="myJum"]/div/div[3]/div[1]/div/h2 // //h2["My Groups"] HtmlButton editPencilButton = manager.ActiveBrowser.Find.ByAttributes <HtmlButton>("//*[@id='myJum']/div/div[3]/div[4]/table/tbody/tr[2]/td[3]/a"); editPencilButton.Click(); //#myJum > div > div.container.ng-scope > div.panel.panel-default > table > tbody > tr:nth-child(2) > td:nth-child(3) > a // //*[@id="myJum"]/div/div[3]/div[4]/table/tbody/tr[2]/td[3]/a //Check if Test_M //var testMGroup = manager.ActiveBrowser.Find.ByAttributes<HtmlDiv>("class=col-md-4 text-left blod-text ng-binding"); //testMGroup.Get //class = col-md-4 text-left blod-text ng-binding //# myJum > div > div.container.ng-scope > div:nth-child(2) > h3.col-md-4.text-left.blod-text.ng-binding // //*[@id="myJum"]/div/div[3]/div[2]/h3[1] HtmlButton selectDropdown = manager.ActiveBrowser.Find.ByAttributes <HtmlButton>("class=dropdown-toggle ng-binding btn btn-default"); selectDropdown.Click(); HtmlControl selectDropDownDialog = manager.ActiveBrowser.Find.ByAttributes <HtmlControl>("class=dropdown-menu dropdown-menu-form"); //selectDropDownDialog. - check names in the lists at least five HtmlAnchor checkAll = manager.ActiveBrowser.Find.ByContent <HtmlAnchor>("p:Check All"); checkAll.Click(); // how to check if names are checked/unchecked HtmlAnchor UnCheckAll = manager.ActiveBrowser.Find.ByAttributes <HtmlAnchor>("class=glyphicon glyphicon-remove"); UnCheckAll.Click(); HtmlInputSearch studentSearchByName = manager.ActiveBrowser.Find.ByAttributes <HtmlInputSearch>("class=form-control ng-pristine ng-valid ng-touched"); HtmlButton submitChangesButton = manager.ActiveBrowser.Find.ByAttributes <HtmlButton>("class=btn btn-default center- block"); manager.Dispose(); Console.WriteLine("done"); }