public void CourseTracker_Resident_ElectiveCoursePass() { /// 1.Navigate to the login page login as a AMA staff UserInfo role = UserUtils.GetUser(UserRole.Ama_Staff); LoginPage LP = Navigation.GoToLoginPage(browser); EducationCenterPage ED = LP.LoginAsUser("10021378", "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); string CourseTracker = Gcep.ResidentCourseTrackerLbl.Text; string[] CourseyrackernotNull = CourseTracker.Split(' '); int regCoursCount = Convert.ToInt16(CourseyrackernotNull[3]); Gcep.ScrolltoGetAllCourses(); string xPathVariable1 = string.Format("//div[@class='activity-info-name']/h4[.='{0}']/../../..//button", "Confidentiality"); Thread.Sleep(0500); IWebElement button1 = browser.FindElement(By.XPath(xPathVariable1)); ElemSet.ScrollToElement(browser, button1); // ElemSet.ScrollToElement(Browser, Browser.FindElement(By.LinkText("AMA TEST"))); CourseTestPage Course = Gcep.ResidentStartCourseOrContinue(browser, "AUTOMATION_004"); Gcep = Course.TestPass(); Gcep.ScrolltoGetAllCourses(); // Assert.IsTrue(Gcep.VerificationCourseCompletion(browser, "AUTOMATION_003", "View Certificate"), "View Certificet button not visible"); string CourseTrackerAfterTestCompletion = Gcep.ResidentCourseTrackerLbl.Text; string[] courseword3 = CourseTrackerAfterTestCompletion.Split(' '); int CountOfCompletedRegCourseafterPassingTest = Convert.ToInt16(courseword3[3]); Assert.True(regCoursCount + 1 == (CountOfCompletedRegCourseafterPassingTest)); }
public void CourseTracker_Resident_RequiredCoursePass() { /// 1.Navigate to the login page login as a AMA staff UserInfo role = UserUtils.GetUser(UserRole.Ama_Staff); LoginPage LP = Navigation.GoToLoginPage(browser); EducationCenterPage ED = LP.LoginAsUser("10021373", "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); string CourseTracker = Gcep.ResidentCourseTrackerLbl.Text; if (!CourseTracker.Contains('/')) { if (!CourseTracker.Contains("0")) { string[] CourseTrackernotNull = CourseTracker.Split(' '); int regCoursCount = Convert.ToInt16(CourseTrackernotNull[3]); } else { string[] CoursetrackerwithNull = CourseTracker.Split(' '); int NoRegCourse = Convert.ToInt16(CoursetrackerwithNull[2]); } Gcep.ClickToAdvance(Gcep.SignOutLnk); LP = Navigation.GoToLoginPage(browser); ED = LP.LoginAsUser(role.Username, role.Password); if (BrowserName == BrowserNames.Firefox) { Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, ElementCriteria.IsEnabled); } Gcep = ED.ClickToAdvance(ED.GcepLnk); /// 3.from Gcep navigating to institution managment searching for institution looking for curriculum and if their any curriculum with the same name deleting and starting create new curriculum. InstitutionsPage Instute1 = Gcep.ClickToAdvance(Gcep.InstitutionManagLnk); InstitutionsGCEPPage InsGcep1 = Instute1.SearchforInstitutions("Ellis Hospital"); ProgramsPage Program1 = InsGcep1.ClickToAdvance(InsGcep1.InstitutionProgramManagmentLnk); Program1.UnassignCurriculum(); CurriculumMngPage Curriculum1 = InsGcep1.ClickToAdvance(InsGcep1.InstitutionCurriculumTmpLnk); Curriculum1.Search("Learning111!!!"); Curriculum1.DeleteCurriculum("Learning111!!!"); CurriculumCoursePage CurCoursPage = Curriculum1.ClickToAdvance(Curriculum1.CreateCurriculumTemplateBtn); /// 4.Form course page choosing available courses from table by index CurCoursPage.AddOrRemoveCourses(CurCoursPage.AvailableCoursesTbl, CurCoursPage.AddSelectedBtn, 8, 9, 10, 11, 12, 13, 14, 15, 16); // List<string> CourseNames = new List<string>(); List <string> CourseNames = CurCoursPage.GetTheNamesChoosenCourses(); int CountofCoursewasAssigned = CourseNames.Count; /// 5. Giving the name for curriculum passing parameter from TestCase as a string CurCoursPage.CurriculumNameTxt.Clear(); CurCoursPage.CurriculumNameTxt.SendKeys("Learning111!!!"); /// 6.Saving curriculum and navigating to the pgy pages to assigne course to students PGYAssignmentPage PGY = CurCoursPage.ClickToAdvance(CurCoursPage.NextBtn); /// 7.Choosing student years to assign course by index for each course PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 1, 4); PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 2, 4); PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 3, 4); PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 4, 4); PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 5, 4); PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 6, 4); PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 7, 4); PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 8, 4); PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 9, 4); /// 8. Saving curriculum and navigating to curriculum management page again PGY.ClickToAdvance(PGY.SaveExitBtn); /// 9.Finding curriculum what we create and assigning to the programm Curriculum1.Search("Learning111!!!"); Curriculum1.Actioncell.Click(); AssignProgramPage Assign = Curriculum1.ClickToAdvance(Curriculum1.AssignToProgrammLnk); /// 10.Choosing starting date and ending date for program and clicking next button string StartingDate = Assign.ChoosingStartDate(); string EndingDate = Assign.ChoosingEndDate(1, "MM/d/yyyy"); Assign.AssignProgramm(); AssignSummaryPage Summary = Assign.ClickToAdvance(Assign.NextBtn); /// 11.Verifying from Assign Summary page program is displayed Assert.IsTrue(Summary.CreatedProgramName.Displayed); Assert.AreEqual((Summary.CreatedProgramName.Text), "Learning111!!!"); /// 12.Verifying Assing confirmation test page curriculum name and starting date and ending dates are there which we choose. AssignConfirmationPage Confirmation = Summary.ClickToAdvance(Summary.NextBtn); // Assert.IsTrue(Confirmation.Grid_CellTextFound(Confirmation.ProgramSummaryTbl, StartingDate + " - " + EndingDate)); Thread.Sleep(0500); Confirmation.ConfirmBtn.Click(); /// 13.Signing out and Signing in as a Resindent counting required courses from myRequiredCourses Curriculum1.ClickToAdvance(Curriculum1.SignOutLnk); Thread.Sleep(2500); LP = Navigation.GoToLoginPage(browser); ED = LP.LoginAsUser("10021373", "password");//10021375,10021377,21387 Gcep = ED.ClickToAdvance(ED.GcepLnk); //Assert.True(Gcep.VerificationOfChoosenCoursesAssignedForResident(browser, CourseNames), "Course count are not equal"); Thread.Sleep(2000); string CourseTrackerAfterAssignment = Gcep.ResidentCourseTrackerLbl.Text; string[] courseword2 = CourseTrackerAfterAssignment.Split(' '); //string[] countofcourses1 = courseword2[2].Split('/'); //string[] courseword = CourseTracker.Split(' '); int CountofcoursesOnResidentGcepaftercourseAssignment = Convert.ToInt16(courseword2[3]); Thread.Sleep(2000); int CountofcoursesOnResidentGcepaftercourseAssigmentCompleted = Convert.ToInt16(courseword2[2]); Thread.Sleep(2000); Assert.True(CountofcoursesOnResidentGcepaftercourseAssignment.Equals(CountofCoursewasAssigned)); } do { ElemSet.ScrollToElement(browser, Gcep.FaceBookLnk); }while (!Gcep.ResidentGcepShowElectiveCourseLnk.Displayed); ElemSet.ScrollToElement(browser, Gcep.ResidentCourseTrackerLbl); CourseTestPage Course = Gcep.ResidentStartCourseOrContinue(browser, "AUTOMATION_002"); Gcep = Course.TestPass(); do { ElemSet.ScrollToElement(browser, Gcep.FaceBookLnk); }while (!Gcep.ResidentGcepShowElectiveCourseLnk.Displayed); Assert.IsTrue(Gcep.VerificationCourseCompletion(browser, "AUTOMATION_002", "View Certificate"), "View Certificet button not visible"); string CourseTrackerAfterTestCompletion = Gcep.ResidentCourseTrackerLbl.Text; string[] courseword3 = CourseTrackerAfterTestCompletion.Split(' '); int CountOfCompletedRegCourseafterPassingTest = Convert.ToInt16(courseword3[2]); //int some = CountofcoursesOnResidentGcepaftercourseAssigmentCompleted + 1; //Assert.True(CountofcoursesOnResidentGcepaftercourseAssigmentCompleted + 1 == (CountOfCompletedRegCourseafterPassingTest)); Gcep.ClickToAdvance(Gcep.SignOutLnk); Thread.Sleep(2500); LP = Navigation.GoToLoginPage(browser); ED = LP.LoginAsUser(role.Username, role.Password);//10021375,10021377,21387 Gcep = ED.ClickToAdvance(ED.GcepLnk); InstitutionsPage Instute = Gcep.ClickToAdvance(Gcep.InstitutionManagLnk); InstitutionsGCEPPage InsGcep = Instute.SearchforInstitutions("Ellis Hospital"); ProgramsPage Program = InsGcep.ClickToAdvance(InsGcep.InstitutionProgramManagmentLnk); Program.UnassignCurriculum(); CurriculumMngPage Curriculum = InsGcep.ClickToAdvance(InsGcep.InstitutionCurriculumTmpLnk); Curriculum.Search("Learning111!!!"); Curriculum.DeleteCurriculum("Learning111!!!"); }
public void Resident_CourseListing_StartNow() { /// 1.Navigate to the login page login as LoginPage LP = Navigation.GoToLoginPage(browser); EducationCenterPage ED = LP.LoginAsUser("10030248", "password");//30248 /// 2.click to GCEP link navigate to Gcep page and waiting load icon disappear GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk); /// 3. Waiting to course tracker to display and verifying all sort by buttons are displayed and enabled Browser.WaitForElement(Bys.GCEPPage.ResidentCourseTrackerLbl, TimeSpan.FromSeconds(120), ElementCriteria.IsVisible); Assert.True(Gcep.ResidentGCEPSortBYDueDateBtn.Displayed); Assert.True(Gcep.ResidentGCEPSortBYDurationBtn.Displayed); Assert.True(Gcep.ResidentGCEPSortBYProgressBtn.Displayed); /// 4.If Start Now button disabled then scrol down and click show elective courses if (Gcep.ResidentCouseStartNowBtn.GetAttribute("class").Contains("disabled")) { Gcep.ScrolltoGetAllCourses(); Gcep.ResidentGcepShowElectiveCourseLnk.Click(); } /// 5.Scrolling down and saving all courses headers. Gcep.ScrolltoGetAllCourses(); List <string> courseTitlesByDueDate = new List <string>(Browser.FindElements(By.XPath("//div[@class='row activity-listing-row']//h4")).Select(iw => iw.Text)); /// 6.Getting locked courses headers and comparing with all courses headers by due date if its matching removing locked courses headers List <string> lockedCourseTitlesByDueDate = new List <string>(Browser.FindElements(By.XPath(" //span[@class='locked']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text)); if (lockedCourseTitlesByDueDate.Count > 0) { for (int i = 0; i < courseTitlesByDueDate.Count; i++) { for (int j = 0; j < lockedCourseTitlesByDueDate.Count; j++) { if (courseTitlesByDueDate[i] == lockedCourseTitlesByDueDate[j]) { courseTitlesByDueDate.Remove(courseTitlesByDueDate[i]); } } } } /// 7.Getting completed courses headers and comparing with all courses headers by due date if its matching removing completed courses headers. List <string> completedCourseTitlesByDueDate = new List <string>(Browser.FindElements(By.XPath(" //span[@class='completed-date ng-binding']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text)); if (completedCourseTitlesByDueDate.Count > 0) { for (int i = 0; i < courseTitlesByDueDate.Count; i++) { for (int j = 0; j < completedCourseTitlesByDueDate.Count; j++) { if (courseTitlesByDueDate[i] == completedCourseTitlesByDueDate[j]) { courseTitlesByDueDate.Remove(courseTitlesByDueDate[i]); } } } } /// 8.After removing locked courses and completed courses headers getting first course header and saving it.Then clicking start now button string firstCourseTitleByDueDate = courseTitlesByDueDate[0]; ElemSet.ScrollToElement(Browser, Gcep.ResidentCourseTrackerLbl); CourseTestPage CTP = Gcep.ClickToAdvance(Gcep.ResidentCouseStartNowBtn); /// 9.getting course name header and comparing with our first course header what saved above and navigating back string startedCourseTitleByDueDate = CTP.CourseTitleLbl.Text; Assert.AreEqual(firstCourseTitleByDueDate, startedCourseTitleByDueDate); Browser.Navigate().Back(); Gcep.WaitForInitialize(); Gcep.ResidentGCEPSortBYDurationBtn.Click(); Gcep.WaitForInitialize(); if (Gcep.ResidentCouseStartNowBtn.GetAttribute("class").Contains("disabled")) { Gcep.ScrolltoGetAllCourses(); Gcep.ResidentGcepShowElectiveCourseLnk.Click(); } Gcep.ScrolltoGetAllCourses(); List <string> courseTitlesByDuration = new List <string>(Browser.FindElements(By.XPath("//div[@class='row activity-listing-row']//h4")).Select(iw => iw.Text)); List <string> lockedCourseTitlesByDuration = new List <string>(Browser.FindElements(By.XPath(" //span[@class='locked']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text)); if (lockedCourseTitlesByDuration.Count > 0) { for (int i = 0; i < courseTitlesByDuration.Count; i++) { for (int j = 0; j < lockedCourseTitlesByDuration.Count; j++) { if (courseTitlesByDuration[i] == lockedCourseTitlesByDuration[j]) { courseTitlesByDuration.Remove(courseTitlesByDuration[i]); } } } } List <string> completedCourseTitlesByDuration = new List <string>(Browser.FindElements(By.XPath(" //span[@class='completed-date ng-binding']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text)); if (completedCourseTitlesByDuration.Count > 0) { for (int i = 0; i < courseTitlesByDuration.Count; i++) { for (int j = 0; j < completedCourseTitlesByDuration.Count; j++) { if (courseTitlesByDuration[i] == completedCourseTitlesByDuration[j]) { courseTitlesByDuration.Remove(courseTitlesByDuration[i]); } } } } string firstCourseTitleByDuration = courseTitlesByDuration[0]; ElemSet.ScrollToElement(Browser, Gcep.ResidentCourseTrackerLbl); CTP = Gcep.ClickToAdvance(Gcep.ResidentCouseStartNowBtn); string startedCourseTitleByDuration = CTP.CourseTitleLbl.Text; Assert.AreEqual(firstCourseTitleByDuration, startedCourseTitleByDuration); Browser.Navigate().Back(); Gcep.WaitForInitialize(); Gcep.ResidentGCEPSortBYProgressBtn.Click(); Gcep.WaitForInitialize(); if (Gcep.ResidentCouseStartNowBtn.GetAttribute("class").Contains("disabled")) { Gcep.ScrolltoGetAllCourses(); Gcep.ResidentGcepShowElectiveCourseLnk.Click(); } Gcep.ScrolltoGetAllCourses(); List <string> courseTitlesProgress = new List <string>(Browser.FindElements(By.XPath("//div[@class='row activity-listing-row']//h4")).Select(iw => iw.Text)); List <string> lockedCourseTitlesByProgress = new List <string>(Browser.FindElements(By.XPath(" //span[@class='locked']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text)); if (lockedCourseTitlesByProgress.Count > 0) { for (int i = 0; i < courseTitlesProgress.Count; i++) { for (int j = 0; j < lockedCourseTitlesByProgress.Count; j++) { if (courseTitlesProgress[i] == lockedCourseTitlesByProgress[j]) { courseTitlesProgress.Remove(courseTitlesProgress[i]); } } } } List <string> completedCourseTitlesByProgress = new List <string>(Browser.FindElements(By.XPath(" //span[@class='completed-date ng-binding']/../..//div[@class='activity-info-name']/h4")).Select(iw => iw.Text)); if (completedCourseTitlesByProgress.Count > 0) { for (int i = 0; i < courseTitlesProgress.Count; i++) { for (int j = 0; j < completedCourseTitlesByProgress.Count; j++) { if (courseTitlesProgress[i] == completedCourseTitlesByProgress[j]) { courseTitlesProgress.Remove(courseTitlesProgress[i]); } } } } string firstCourseTitleByProgress = courseTitlesProgress[0]; ElemSet.ScrollToElement(Browser, Gcep.ResidentCourseTrackerLbl); CTP = Gcep.ClickToAdvance(Gcep.ResidentCouseStartNowBtn); string startedCourseTitleByProgress = CTP.CourseTitleLbl.Text; Assert.AreEqual(firstCourseTitleByProgress, startedCourseTitleByProgress); Browser.Navigate().Back(); Gcep.WaitForInitialize(); }
public void Resident_Pass_Test(string InstitutionName, string CurriculumName) { UserInfo role = UserUtils.GetUser(UserRole.Ama_Staff); LoginPage LP = Navigation.GoToLoginPage(browser); EducationCenterPage ED = LP.LoginAsUser(role.Username, role.Password); /// 2.click to GCEP link navigate to Gcep page and waiting load icon disappear GCEPPage Gcep = ED.ClickToAdvance(ED.GcepLnk); /// 3.from Gcep navigating to institution managment searching for institution looking for curriculum and if their any curriculum with the same name deleting and starting create new curriculum. InstitutionsPage Instute = Gcep.ClickToAdvance(Gcep.InstitutionManagLnk); InstitutionsGCEPPage InsGcep = Instute.SearchforInstitutions(InstitutionName); ProgramsPage Program = InsGcep.ClickToAdvance(InsGcep.InstitutionProgramManagmentLnk); Program.UnassignCurriculum(); CurriculumMngPage Curriculum = InsGcep.ClickToAdvance(InsGcep.InstitutionCurriculumTmpLnk); Curriculum.Search(CurriculumName); Curriculum.DeleteCurriculum(CurriculumName); CurriculumCoursePage CurCoursPage = Curriculum.ClickToAdvance(Curriculum.CreateCurriculumTemplateBtn); /// 4.Form course page choosing available courses from table by index CurCoursPage.AddOrRemoveCourses(CurCoursPage.AvailableCoursesTbl, CurCoursPage.AddSelectedBtn, 1, 4, 5); // List<string> CourseNames = new List<string>(); List <string> CourseNames = CurCoursPage.GetTheNamesChoosenCourses(); /// 5. Giving the name for curriculum passing parameter from TestCase as a string CurCoursPage.CurriculumNameTxt.Clear(); CurCoursPage.CurriculumNameTxt.SendKeys(CurriculumName); /// 6.Saving curriculum and navigating to the pgy pages to assigne course to students PGYAssignmentPage PGY = CurCoursPage.ClickToAdvance(CurCoursPage.NextBtn); /// 7.Choosing student years to assign course by index for each course PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 1, 5); PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 2, 5); PGY.Grid_ClickElementWithoutTextInsideRow(PGY.CourseTbl, 3, 5); /// 8. Saving curriculum and navigating to curriculum management page again PGY.ClickToAdvance(PGY.SaveExitBtn); /// 9.Finding curriculum what we create and assigning to the programm Curriculum.Search(CurriculumName); Curriculum.Actioncell.Click(); AssignProgramPage Assign = Curriculum.ClickToAdvance(Curriculum.AssignToProgrammLnk); /// 10.Choosing starting date and ending date for program and clicking next button string StartingDate = Assign.ChoosingStartDate(); string EndingDate = Assign.ChoosingEndDate(1, "MM/d/yyyy"); Assign.AssignProgramm(); AssignSummaryPage Summary = Assign.ClickToAdvance(Assign.NextBtn); /// 11.Verifying from Assign Summary page program is displayed Assert.IsTrue(Summary.CreatedProgramName.Displayed); Assert.AreEqual((Summary.CreatedProgramName.Text), CurriculumName); /// 12.Verifying Assing confirmation test page curriculum name and starting date and ending dates are there which we choose. AssignConfirmationPage Confirmation = Summary.ClickToAdvance(Summary.NextBtn); // Assert.IsTrue(Confirmation.Grid_CellTextFound(Confirmation.ProgramSummaryTbl, StartingDate + " - " + EndingDate)); Thread.Sleep(0500); Confirmation.ConfirmBtn.Click(); /// 13.Signing out and Signing in as a Resindent counting required courses from myRequiredCourses Curriculum.ClickToAdvance(Curriculum.SignOutLnk); LP = Navigation.GoToLoginPage(browser); ED = LP.LoginAsUser("10021387", "password");//10021375,10021377,21387 Gcep = ED.ClickToAdvance(ED.GcepLnk); Assert.True(Gcep.VerificationOfChoosenCoursesAssignedForResident(browser, CourseNames), "Course count are not equal"); CourseTestPage Course = Gcep.ResidentStartCourseOrContinue(browser, CourseNames[1]); Gcep = Course.TestPass(); Assert.IsTrue(Gcep.VerificationCourseCompletion(browser, CourseNames[1], "View Certificate"), "View Certificet button not visible"); }