public void UsersCount(UserRole userRole) { /// 1.Navigate to the login page login as a Manager UserInfo role = UserUtils.GetUser(userRole); LoginPage LP = Navigation.GoToLoginPage(browser); EducationCenterPage ED = LP.LoginAsUser(role.Username, role.Password); if (BrowserName == BrowserNames.Firefox) { Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled); } /// 2.click to CGEP link navigate to Gcep page and waiting load icon disappear GCEPPage GCEP = ED.ClickToAdvance(ED.GcepLnk); if (userRole == UserRole.Manager) { Browser.WaitForElement(Bys.GCEPPage.SendEmailNotificationLnk, TimeSpan.FromSeconds(150), ElementCriteria.IsVisible); } /// 3.From GCEP page getting count of user from Users link and saving in Count of user integer then clicking user management link int CountOfUserOnGCEP = Convert.ToInt32(GCEP.TotalUsersCountLnk.Text); GCEPUserMngPage GUMP = GCEP.ClickToAdvance(GCEP.UserManageLnk); /// 4.Getting count of user from user management label on user management page and verifying thatthey are equals. int CountOfUsersOnUserMngPage = GUMP.GetCountOfUsersFromUserManagementLabel(); Assert.AreEqual(CountOfUserOnGCEP, CountOfUsersOnUserMngPage, "Counts of Users are not the same"); }
public void UserManagement() { /// 1.Navigate to the login page with valid credentials below UserInfo role = UserUtils.GetUser(UserRole.Ama_Staff); LoginPage LP = Navigation.GoToLoginPage(browser); EducationCenterPage ED = LP.LoginAsUser(role.Username, role.Password); if (BrowserName == BrowserNames.Firefox) { Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled); } /// 2.click to CGEP link and waiting load icon disappear GCEPPage GCEP = ED.ClickToAdvance(ED.GcepLnk); /// 3.From CGEPPage clicking UsermngLnk if (BrowserName == BrowserNames.Chrome) { Browser.WaitForElement(Bys.GCEPPage.UserManageLnk, ElementCriteria.IsVisible, ElementCriteria.IsEnabled); } GCEPUserMngPage UserManagePage = GCEP.ClickToAdvance(GCEP.UserManageLnk); /// 4.verifying Inactive user with below credentials UserManagePage.SearchForUserByStatusAndName("Inactive", "Emily"); if (BrowserName == BrowserNames.Chrome) { Thread.Sleep(5000); } Assert.True(UserManagePage.Grid_CellTextFoundAMATest(UserManagePage.UsersManagementTbl, "Inactive"), "text on the grid is not what we expected"); /// 5.verifying Active user with below credentials UserManagePage.SearchForUserByStatusAndName("Active", "Hamza"); Assert.True(UserManagePage.Grid_CellTextFoundAMATest(UserManagePage.UsersManagementTbl, "Active")); /// 6.Verifying from User Management table that "Active" User ("Hamza") and with "Admin" Role Displayed UserManagePage.SearchForUserByRoleandStatusAndName("Admin", "Active", "Hamza"); Assert.True(UserManagePage.Grid_CellTextFoundAMATest(UserManagePage.UsersManagementTbl, "Active")); /// 7.Verifying from User Management table that "Inactive" User ("Hamza") and with "Admin" Role is not Displayed UserManagePage.SearchForUserByRoleandStatusAndName("Admin", "Inactive", "Hamza"); Assert.True(UserManagePage.NoRecorMatchLabel.Displayed, "No record Label is not displayed"); }
public void User_Management(UserRole userRole) { /// 1. Navigate to the login page and login as a Admin UserInfo role = UserUtils.GetUser(userRole); LoginPage LP = Navigation.GoToLoginPage(browser); EducationCenterPage ED = LP.LoginAsUser(role.Username, role.Password); if (BrowserName == BrowserNames.Firefox) { Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled); } /// 2.click to GCEP link navigate to Gcep page and waiting load icon disappear GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk); /// 3.Clicking User Management link and navigating to User Management Page GCEPUserMngPage User = Gcep.ClickToAdvance(Gcep.UserManageLnk); /// 4.Searching for specicfic user and checking edit user enabled by clicking verifying url and navigating back by clicking cancel button User.SearchTxt.SendKeys("Aabo"); Thread.Sleep(0500); User.Select("ins-admin-action-active", "Edit User"); Thread.Sleep(0500); Assert.IsTrue(Browser.Url.Contains("users/manageuser")); User.CancelBtn.Click(); /// 5.from action gear clicking to Send notification and verifying url and navigating back by clicking cancel button User.Select("ins-admin-action-active", "Send Notification"); Thread.Sleep(0500); Assert.IsTrue(Browser.Url.Contains("users/sendnotification")); User.CancelSendBtn.Click(); /// 6.from action gear clicking to mark inactive and verifiying alert is generated by checking button aviability. User.Select("ins-admin-action-active", "Mark Inactive"); Thread.Sleep(0500); Assert.IsTrue(User.AcceptBtn.Displayed); User.DismissBtn.Click(); }
public void PromotePGY() { /// 1. Navigate to the login page and login as a Admin LoginPage LP = Navigation.GoToLoginPage(browser); EducationCenterPage ED = LP.LoginAsUser("10013616", "password"); //10004610 if (BrowserName == BrowserNames.Firefox) { Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled); } /// 2.click to GCEP link navigate to Gcep page and waiting load icon disappear GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk); /// 3. Go to the promote pgy page and then add an availavle redisent to the selected list choosing different user for each browser. PromotePGYPage ProPGY = Gcep.ClickToAdvance(Gcep.PromotePGYLnk); if (BrowserName == BrowserNames.Firefox) { ProPGY.AddOrRemoveResidents(ProPGY.AvailableResidentsPromotePGYTbl, ProPGY.AddSelectedBtn, 1); } if (BrowserName == BrowserNames.Chrome) { ProPGY.AddOrRemoveResidents(ProPGY.AvailableResidentsPromotePGYTbl, ProPGY.AddSelectedBtn, 3); } if (BrowserName == BrowserNames.InternetExplorer) { ProPGY.AddOrRemoveResidents(ProPGY.AvailableResidentsPromotePGYTbl, ProPGY.AddSelectedBtn, 2); } /// 4. Grab the year value from the select table, open the form, and then assert that the New Year /// element's value increased 1 year from the tables value int chosenResidentsTableYearValue = Convert.ToInt32(ProPGY.Grid_GetValueOfCell(ProPGY.ChoosenResidentsPromotePGYTbl)); /// 5. Clicking promote button waiting to pop up appear getting name and new year what will be updated ProPGY.PromoteBtn.Click(); Browser.WaitForElement(Bys.PromotePGYPage.FormConfirmBtn, TimeSpan.FromSeconds(180), ElementCriteria.IsVisible, ElementCriteria.IsEnabled); int promotePGYFormNewYearValue = Convert.ToInt32(ProPGY.GetValueOfCell(ProPGY.FormResidentsDescriptionTbl, 2)); string Resident_FullName = ProPGY.GetValueOfCell(ProPGY.FormResidentsDescriptionTbl, 0); /// 6. Verifying new year are equals year value from choosen resident increase 1 year and clicking confirmation button Assert.AreEqual(chosenResidentsTableYearValue + 1, promotePGYFormNewYearValue); Gcep = ProPGY.ClickToAdvance(ProPGY.FormConfirmBtn); /// 7. After confirmation its getting Gcep page and clicking user managment link and searching for users by name what we promoted GCEPUserMngPage UMP = Gcep.ClickToAdvance(Gcep.UserManageLnk); // Extracting the first name from the resident to then search on first name var Resident_FirstAndLastName = Resident_FullName.Split(','); string Resident_LastName = Resident_FirstAndLastName[0]; UMP.Search(Resident_LastName); //IWebElement UserLnk1 = browser.FindElement(By.LinkText(Resident_FullName)); /// 8. Clicking on user and navigating User management page UserManagementPage UMPG = UMP.chooseUser(Resident_FullName); /// 9. Getting value as a year from user pgy and user name int userManagementPageYearValue = Convert.ToInt32(UMPG.UserPgySelElem.SelectedOption.Text); string Resident_Fullname_Expected = UMPG.UserNameTxt.GetAttribute("value"); /// 10. Verifying user pgy year equals to promote new year value and the user name with last name are the same Assert.AreEqual(userManagementPageYearValue, promotePGYFormNewYearValue); Assert.AreEqual(Resident_FullName, Resident_Fullname_Expected, "Resident name from available promote pgy table are not the same with user management page"); }
public void TestCount() { string InstitutionName = "Temple University Hospital"; Browser.Navigate().GoToUrl("https://cme.ama-assn.org"); IWebElement ProdUserNameTxt = Browser.FindElement(By.Id("go_username")); IWebElement ProdPasswordTxt = Browser.FindElement(By.Id("go_password")); IWebElement ProdLoginBtn = Browser.FindElement(By.XPath("//input[@value='Sign In']")); ProdUserNameTxt.Clear(); ProdUserNameTxt.SendKeys("jpenderville"); ProdPasswordTxt.Clear(); ProdPasswordTxt.SendKeys("password1"); //div[@role='gridcell' and @ng-if='row.entity.Users > 0']/a ProdLoginBtn.Click(); EducationCenterPage ED = new EducationCenterPage(Browser); Browser.WaitForElement(Bys.EducationCenterPage.CourseTbl, ElementCriteria.IsEnabled, ElementCriteria.IsVisible); GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk); int countOfCurriculumsOnGcep = Convert.ToInt32(Gcep.TotalCurriculumTmtsCountLnk.Text); int countOfTotalUsers = Convert.ToInt32(Gcep.TotalUsersCountLnk.Text); GCEPUserMngPage GUMP = Gcep.ClickToAdvance(Gcep.UserManageLnk); int CountOfUsersOnUserMngPage = GUMP.GetCountOfUsersFromUserManagementLabel(); Assert.AreEqual(countOfTotalUsers, CountOfUsersOnUserMngPage, "Counts of Users are not the same"); Gcep = GUMP.ClickToAdvance(GUMP.AdministrationLnk); CurriculumMngPage CMP = Gcep.ClickToAdvance(Gcep.CurriculumTemplatesLnk); int countofCurriculumTemplatesFromCurriculumTemplatesPage = CMP.GetCountOfCurriculumonTable("of", "items"); Assert.AreEqual(countOfCurriculumsOnGcep, countofCurriculumTemplatesFromCurriculumTemplatesPage, "Count of Curriculum Templates are not equals on GCEP page with CurriculumMngPage"); Gcep = CMP.ClickToAdvance(CMP.AdministrationLnk); InstitutionsPage IP = Gcep.ClickToAdvance(Gcep.InstitutionManagLnk); IP.Search(InstitutionName); string xPathVariableForUserCount = string.Format("//*[text()='{0}']/../../../../div/div[3]", InstitutionName); //div[@role='gridcell' and contains (text(),'')]/a[@ng-if='row.entity.Users > 0'] string xPathVariableForProgramCount = string.Format("//*[text()='{0}']/../../../../div/div[4]", InstitutionName); //div[@role='gridcell' and contains (text(),'')]/a[@ng-if='row.entity.Programs > 0'] int usersCountFromInstitutionsPage = Convert.ToInt32(Browser.FindElement(By.XPath(xPathVariableForUserCount)).Text); int programsCountFromInstitutionsPage = Convert.ToInt32(Browser.FindElement(By.XPath(xPathVariableForProgramCount)).Text); InstitutionsGCEPPage IGP = IP.SearchforInstitutions(InstitutionName); int usersCountFromInstitutionsGCEPPage = Convert.ToInt32(IGP.TotalUserCountLnk.Text); int programsCountFromInstitutionsGCEPPage = Convert.ToInt32(IGP.TotalProgramCountLnk.Text); // Assert.AreEqual(usersCountFromInstitutionsPage, usersCountFromInstitutionsGCEPPage, "Count of user are not equals on Institutions table with InstitutionGCEP page"); // Assert.AreEqual(programsCountFromInstitutionsPage, programsCountFromInstitutionsGCEPPage, "Count of programs are not equals on Institutions table with InstitutionGCEP page"); ProgramsPage PP = IGP.ClickToAdvance(IGP.InstitutionProgramManagmentLnk); int countsOfProgramsOnPP = PP.Grid_GetCountOfItemsOnTable("of", "items"); // Assert.AreEqual(programsCountFromInstitutionsPage, countsOfProgramsOnPP); IGP = PP.ClickToBreadCrumbContainerToReturnInsGCEP(InstitutionName); GUMP = IGP.ClickToAdvance(IGP.InstitutionUserManagementLnk); int CountOfUsersOnUserMngPageForIns = GUMP.GetCountOfUsersFromUserManagementLabel(); //Assert.AreEqual(usersCountFromInstitutionsPage, CountOfUsersOnUserMngPageForIns); Assert.True(DataUtils.intsEqual(usersCountFromInstitutionsPage, usersCountFromInstitutionsGCEPPage, CountOfUsersOnUserMngPageForIns)); Assert.True(DataUtils.intsEqual(countsOfProgramsOnPP, programsCountFromInstitutionsGCEPPage, programsCountFromInstitutionsPage)); Thread.Sleep(5000); }
public void Checking_AllCounts_FromGcep() { /// 1.Navigate to the login page with valid credentials below UserInfo role = UserUtils.GetUser(UserRole.Ama_Staff); LoginPage LP = Navigation.GoToLoginPage(browser); EducationCenterPage ED = LP.LoginAsUser(role.Username, role.Password); if (BrowserName == BrowserNames.Firefox) { Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled); } /// 2.click to CGEP link navigate to Gcep page and waiting load icon disappear and getting count of curriculum templates GCEPPage GCEP = ED.ClickToAdvance(ED.GcepLnk); int countOfCurriculumTemplatesFromGCEP = Convert.ToInt32(GCEP.TotalCurriculumTmtsCountLnk.Text); /// 3.From GCEP Navigate to Curriculum Template saving count of curriculum on the table and verifying counts of curriculum from GCEP are equals CurriculumMngPage CMP = GCEP.ClickToAdvance(GCEP.CurriculumTemplatesLnk); int countofCurriculumTemplatesFromPage = CMP.GetCountOfCurriculumonTable("of", "items"); //string something = CMP.CountTableItemLbl.Text; //something = new string(something.Where(x => char.IsDigit(x)).ToArray()); Assert.AreEqual(countOfCurriculumTemplatesFromGCEP, countofCurriculumTemplatesFromPage); /// 4.Navigating back to GCEP if (BrowserName == BrowserNames.Firefox) { Browser.Navigate().Back(); } CMP.GMECompetencyEducationProgramLnk.Click(); //AdministrationLnk.Click(); GCEP.WaitForInitialize(); if (BrowserName == BrowserNames.Firefox) { Browser.WaitForElement(Bys.GCEPPage.InstitutionManagLnk, ElementCriteria.IsEnabled); } /// 5.from Gcep navigating to institution managment searching for institution InstitutionsPage Instute = GCEP.ClickToAdvance(GCEP.InstitutionManagLnk); InstitutionsGCEPPage InsGcep = Instute.SearchforInstitutions("Albert Einstein Medical Center"); /// 6.Saving counts of program,user,curriculum template from Institution GCEP int totalProgramCountonGCEP = Convert.ToInt32(InsGcep.TotalProgramCountLnk.Text); int totalUsersCountonGCEP = Convert.ToInt32(InsGcep.TotalUserCountLnk.Text); int totalCurTempCountonGCEP = Convert.ToInt32(InsGcep.TotalCurriculumTemplatesCountLnk.Text); /// 7.Navigating Program Management Page and getting counts of Programs Page and comparing countsof program from Institution GCEP page. ProgramsPage PP = InsGcep.ClickToAdvance(InsGcep.InstitutionProgramManagmentLnk); int countsOfProgramsOnPP = PP.Grid_GetCountOfItemsOnTable("of", "items"); Assert.AreEqual(totalProgramCountonGCEP, countsOfProgramsOnPP); /// 8.Navigating to Institution GCEP Page InsGcep = PP.ClickToBreadCrumbContainerToReturnInsGCEP("Albert Einstein Medical Center"); /// 9.From Instution GCEP clicking user management link and navigating GCEP User Management page getting counts of users from User Management table /// verifying counts of users count are equals from Institution GCEP and Users Management Page. GCEPUserMngPage GUMP = InsGcep.ClickToAdvance(InsGcep.InstitutionUserManagementLnk); int CountOfUsersOnUserMngPage = GUMP.GetCountOfUsersFromUserManagementLabel(); Assert.AreEqual(totalUsersCountonGCEP, CountOfUsersOnUserMngPage); /// 10.Navigating to Institution GCEP Page InsGcep = GUMP.ClickToBreadCrumbContainerToReturnInsGCEP("Albert Einstein Medical Center"); /// 11.From Institutiom GCEP clicking curriculum templates and navigating Curriculum Mng Page and getting count of curriculum templates and asserting /// counts of curriculum template from Institution GCEP page are equals. CMP = InsGcep.ClickToAdvance(InsGcep.InstitutionCurriculumTmpLnk); int countOfCurTempFromCurrimMngPage = CMP.Grid_GetCountOfItemsOnTable("of", "items"); Assert.AreEqual(totalCurTempCountonGCEP, countOfCurTempFromCurrimMngPage); }