public void UserCanDeleteActivityOnMyMOCPage() { /// 1. Create a Mainport user and Login UserInfo NewUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.Mainport, UserUtils.UserRole.MP); LoginPage LP = Navigation.GoToLoginPage(browser); MyDashboardPage DP = LP.LoginAsNewUser(UserUtils.UserRole.MP, NewUser.Username, ConfigurationManager.AppSettings["LoginPassword"]); /// 2. Enter 2 activities EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity ConferenceActivity = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "10", false); DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity ConferenceActivity2 = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "10", false); // Have to wait for the credits to be applied before we can proceed MainportHelperMethods.WaitForCreditsToBeApplied(browser, DP, Bys.MyDashboardPage.TotalCreditsAppliedValueLbl, "10"); /// 3. On the My MOC page, open the View Activity form, click the X button for an activity, and verify that it got removed from the table MyMOCPage MP = DP.ClickAndWaitBasePage(DP.MyMOCTab); MP.OpenViewActivitiesForm(MP.GroupLearnTblUnaccrActRowViewLnk); IWebElement row = ElemGet.Grid_GetRowByRowName(MP.ViewActivitiesFormActivitiesTbl, Bys.MyMOCPage.ViewActivitiesFormActivitiesTblBodyRow, ConferenceActivity.ActivityName, "td"); ElemSet.Grid_ClickElementWithoutTextInsideRow(row, "input"); MP.ClickAndWait(MP.DeleteActivityWarningFormYesBtn); Assert.False(ElemGet.Grid_ContainsRecord(Browser, MP.ViewActivitiesFormActivitiesTbl, Bys.MyMOCPage.ViewActivitiesFormActivitiesTblBodyRow, 0, ConferenceActivity.ActivityName, "td")); }
public void UIUpdatesAfterLearnerAddsReflection() { /// 1. Create learner user and login LoginPage LP = Navigation.GoToLoginPage(browser); LRUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.CBD, UserUtils.UserRole.LR); CBDLearnerPage CLP = LP.LoginAsNewUser(UserUtils.UserRole.LR, LRUser.Username, LRUser.Password); /// 2. Store the number from the label text of the Reflections tab, and also "Showing" label, for the purpose of a future Assert within this /// test. If there are no Reflections yet, this showing label will not appear, so skip it if so CLP.SwitchToTab(CLP.ReflectionsTab, Bys.CBDLearnerPage.ReflectionsTab); string origNumbOfReflectionsOnReflectionsTab = DataUtils.GetStringBetweenCharacters(CLP.ReflectionsTab.Text, "(", ")"); if (browser.Exists(Bys.CBDLearnerPage.ShowingLbl, ElementCriteria.IsVisible)) { string origNumbOfReflectionsOnShowingLbl = DataUtils.GetStringAfterCharacter(CLP.ShowingLbl.Text, "f", 2); } /// 3. Add a reflection LearnerRelectionObject LR = CLP.AddReflection(); /// 4. Assert that the Reflections tab label increased by 1 Assert.AreEqual(Int32.Parse(origNumbOfReflectionsOnReflectionsTab) + 1, Int32.Parse(DataUtils.GetStringBetweenCharacters(CLP.ReflectionsTab.Text, "(", ")"))); /// 5. Assert that the label within the Reflections tab increased by 1 // Bug RCPSC-264: "Learner->Add Reflection: "Showing" label does not update after learner adds reflection" // Uncomment and run the test when fixed if (browser.Exists(Bys.CBDLearnerPage.ShowingLbl, ElementCriteria.IsVisible)) { //Assert.AreEqual(Int32.Parse(origNumbOfReflectionsOnShowingLbl) + 1, Int32.Parse(DataUtils.GetStringAfterCharacter(CLP.ShowingLbl.Text, "f", 2))); } /// 5. Assert that the table contains the reflection Assert.True(ElemGet.Grid_ContainsRecord(browser, CLP.ReflectionsTbl, Bys.CBDLearnerPage.ReflectionsTblBdy, LR.ReflectionTitle, "td", Bys.CBDLearnerPage.TableFirstBtn, Bys.CBDLearnerPage.TableNextBtn)); }
public void ReflectionShowsInTableAfterAdded() { // TEMPORARY: When the Delete User API is developed, we can remove the below code and uncomment the code below it, which creates new users // on the fly. Decide this when the delete API is complete /// 1. Login as a learner LoginPage LP = Navigation.GoToLoginPage(browser); CBDLearnerPage CLP = LP.LoginAsExistingUser(UserUtils.UserRole.LR, UserUtils.Learner1Login, ConfigurationManager.AppSettings["LoginPassword"]); /// 2. Add a reflection LearnerRelectionObject LR = CLP.AddReflection(); /// 3. Switch to the Reflection tab and verify the reflection is shown in the table CLP.SwitchToTab(CLP.ReflectionsTab, Bys.CBDLearnerPage.ReflectionsTab); Assert.True(ElemGet.Grid_ContainsRecord(browser, CLP.ReflectionsTbl, Bys.CBDLearnerPage.ReflectionsTblBdy, 0, LR.ReflectionTitle, "td", Bys.CBDLearnerPage.TableFirstBtn, Bys.CBDLearnerPage.TableNextBtn)); ///// 1. Login as learner //LoginPage LP = Navigation.GoToLoginPage(browser); //UserInfo LRUser = UserUtils.CreateAndRegisterUser(null, UserUtils.Application.CBD, UserUtils.UserRole.LR); //CBDLearnerPage CLP = LP.Login(UserUtils.UserRole.LR, LRUser.Username, LRUser.Password, false); ///// 2. Add a reflection //LearnerRelectionObject LR = CLP.AddReflection(); ///// 3. Switch to the Reflection tab and verify the reflection is shown in the table //CLP.SwitchToTab(CLP.ReflectionsTab, Bys.CBDLearnerPage.ReflectionsTab); //Assert.True(ElemGet.Grid_ContainsRecord(browser, CLP.ReflectionsTbl, LR.ReflectionTitle, Bys.CBDLearnerPage.TableFirstBtn, Bys.CBDLearnerPage.TableNextBtn)); }
/// <summary> /// Clicks the X button to delete the activity for a user-specified activity in the user-specified table, clicks Yes on the Delete Activity popup, /// then waits for the popup to disappear /// </summary> /// <param name="activityName">The exact text from the first column of the table for your activity, or your activity name</param> public void DeleteActivity(string activityName) { IWebElement row = ElemGet.Grid_GetRowByRowName(IncompleteActivitiesTbl, Bys.MyHoldingAreaPage.IncompleteActivitiesTblBodyRow, activityName); ElemSet.Grid_ClickElementWithoutTextInsideRow(row, "input"); ClickAndWait(DeleteActivityYesBtn); }
/// <summary> /// Click the X button on the activity inside the grid, then clicks Ok on the popup to delete the activity /// </summary> /// <param name="activityName">The activity name. Specifically the exact text from the first column of the grid for the activity</param> public void DeleteActivityFromGrid(string activityName) { IWebElement row = ElemGet.Grid_GetRowByRowName(ActivityTblBody, Bys.MyCPDActivitiesListPage.ActivityTblBody, activityName); ElemSet.Grid_ClickElementWithoutTextInsideRow(row, "input"); Browser.WaitForElement(Bys.MyCPDActivitiesListPage.DeleteActivityFormOkBtn, ElementCriteria.IsVisible); ClickAndWait(DeleteActivityFormOkBtn); }
/// <summary> /// something /// </summary> /// <returns></returns> public int GetCountOfCourse() { Browser.FindElement(By.XPath("//*[@id='gridProgramManagement']//a[@title]")).Click(); Thread.Sleep(0500); int count = ElemGet.Grid_GetRowCount(CurriculumTempDetailsFormTbl); FormCloseBtn.Click(); Thread.Sleep(0500); return(count); }
/// <summary> /// Clicks the View link for a user-specified activity type, waits for the View Activities form to load, clicks on the pencil icon for a /// user-specified activity, then waits for the Enter an Activity form to load /// </summary> /// <param name="activityTypeViewLnk">The View link for a given activity type. <see cref="GroupLearnTblAccrActRowViewLnk"/> for an example</param> /// <param name="activityName">The exact text from the first column of the table for your activity, or your activity name</param> public EnterCPDActivityPage OpenEditActivityForm(IWebElement activityTypeViewLnk, string activityName) { OpenViewActivitiesForm(activityTypeViewLnk); IWebElement row = ElemGet.Grid_GetRowByRowName(ViewActivitiesFormActivitiesTbl, Bys.MyMOCPage.ViewActivitiesFormActivitiesTblBodyRow, activityName); ElemSet.Grid_ClickElementWithoutTextInsideRow(row, "img"); return(SwitchToEnterACPDActivitiesFormFrame()); }
public void MultyInstitution_HelpPageVerification() { /// 1.Navigate to the login page login as Admin with availability manage multy Institutions UserInfo role = UserUtils.GetUser(UserRole.Ama_Staff); LoginPage LP = Navigation.GoToLoginPage(browser); EducationCenterPage ED = LP.LoginAsUser("10016185", "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.Saving all Institutions from drop down in list of strings and Sign Out List <string> institutions = ElemGet.SelElem_ListTextToListString(Gcep.InstitutionSelElem); Gcep.ClickToAdvance(Gcep.SignOutLnk); /// 4.Sign in again as Ama staff searching for all Institution what we saved on previous step. LP = Navigation.GoToLoginPage(browser); ED = LP.LoginAsUser(role.Username, role.Password); Gcep = ED.ClickToAdvance(ED.GcepLnk); InstitutionsPage IP = Gcep.ClickToAdvance(Gcep.InstitutionManagLnk); /// 5.Getting contact emails for each institution saving them and Sign out. List <string> institutionContactEmailAdress = new List <string>(); institutionContactEmailAdress = HelperMethods.GetTheInstutionsEmail(Browser, institutions); /// 6.Login as Admin who manages multyple Institution choosing each Institution and comparing contact email adresses. // if(BrowserName == BrowserNames.InternetExplorer) { IP.HeaderMenuDropDown.SendKeys(Keys.Tab); } IP.HeaderMenuDropDown.Click(); IP.SignOutLnk.Click(); Thread.Sleep(2000); if (BrowserName == BrowserNames.InternetExplorer) { Thread.Sleep(2000); } LP = Navigation.GoToLoginPage(browser); ED = LP.LoginAsUser("10016185", "password"); Gcep = ED.ClickToAdvance(ED.GcepLnk); HelpPage HP = Gcep.ClickToAdvance(Gcep.HelpfromYourInstitutionLnk); // HelpPage HP = Gcep.ClickToAdvance(Gcep.HelpLnk); /// 7.Verifiying emails are correct on help page for each Institution. //Assert.True(HP.AdministrationLnk.Displayed); //Assert.True(HP.AdminWatchVideoLnk.Displayed); Assert.IsTrue(HelperMethods.ComparingInstitutionEmailsWithHelpContactEmails(Browser, institutions, institutionContactEmailAdress)); }
/// <summary> /// Clicks on all milestones for a user-specified trainee, clicks the Mark As Achieved button, then clicks Submit on the popup /// </summary> /// <param name="traineeFullName">First and last name of the trainee</param> public void MarkAllMilestonesAchieved(string traineeFullName) { IList <IWebElement> rows = ElemGet.Grid_GetRowsByRowName(UnderReviewTbl, Bys.DiplomaClinicalSupervisorPage.UnderReviewTblBodyRow, traineeFullName); foreach (IWebElement row in rows) { ElemSet.Grid_ClickElementWithoutTextInsideRow(row, "input"); } ClickAndWait(MarkSelectedMilestonesAsAchievedBtn); ClickAndWait(MarkSelMilestonesAchFormSubmitBtn); }
/// <summary> /// If an upcoming agenda is not created (e.g. No items in the Meeting Agenda dropdown have an agenda that says "Upcoming"), then /// this creates one with a user-specified date. First it will click on the Competenece Committee tab if we are not on this page, /// then it opens the Create New Agenda window, assigns the date and clicks Create to create the new agenda /// </summary> /// <param name="yearsToAdd">However many years you want to add to the current date. If you want a random date, enter "-1"</param> /// <param name="monthsToAdd">However many months you want to add to the current date. If none, enter "0"</param> /// <param name="daysToAdd">However many days you want to add to the current date. If none, enter "0"</param> public void CreateUpcomingAgendaWithSpecificDateIfNoneExist(int yearsToAdd, int monthsToAdd, int daysToAdd) { // If we are not on the Competence Committee tab, then click on it to go there if (!Browser.Exists(Bys.CBDProgDirectorPage.FinalizeAgendaBtn, ElementCriteria.IsEnabled)) { ClickAndWait(CompCommiteeTab); } // If none of the list<string> items contain the text "Upcoming", then create an upcoming agenda if (!ElemGet.SelElem_ContainsText(MeetingAgendaSelElem, "Upcoming")) { CreateUpcomingAgendaWithSpecificDate(yearsToAdd, monthsToAdd, daysToAdd); } }
/// <summary> /// Creates a new agenda. First it will click on the Competenece Committee tab if we are not on this page, then it opens the Create /// New Agenda window, then assigns a random date and clicks Create to create the new agenda. Returns the agenda name that was created /// </summary> public string CreateUpcomingAgendaWithRandomDate() { // If we are not on the Competence Committee tab, then click on it to go there if (!Browser.Exists(Bys.CBDProgDirectorPage.FinalizeAgendaBtn, ElementCriteria.IsEnabled)) { ClickAndWait(CompCommiteeTab); } // First get a list of all existing agendas, so that we can filter these out when we return the new agenda that we create below // Note that DEV may redesign creating agendas, and if they do, this wont be needed, because we may then be able to see the // agenda name at creation. See JIRA bug RCPSC-547 List <string> existingAgendas = ElemGet.SelElem_ListTextToListString(MeetingAgendaSelElem); // Open the form ActionsBtn.Click(); ClickAndWait(CreateNewAgendaLnk); // The calendar control limits a user to have a maximum of 9 agendas on a certain day. So we have to generate a random day, // then use it to create an upcoming agenda. We will also handle the situation where we hit the max per day by looping // and IF statement // First get the amount of days between tomorrow and 3 years from now because this is the furthest the date control will // allow you to select. Then use that amount to do the loop int daysCount = (DateTime.Now.AddYears(2).AddMonths(11).AddDays(27) - DateTime.Now.AddDays(1)).Days; for (int i = 0; i < daysCount; i++) { // Choose the date and click on Create Dictionary <string, string> dates = DataUtils.GetDateForCalendarElem(GetRandomDateForCreateNewAgendaFormDateControl()); ElemSet.DatePicker_ChooseDate(Browser, dates["year"], dates["month"], dates["day"]); ClickAndWait(CreateNewAgendaFormCreateBtn); // If the warning message appears, continue in the loop to choose another date, else break if (Browser.Exists(Bys.CBDProgDirectorPage.CreateNewAgendaFormMaxNumOfAgendasLbl, ElementCriteria.IsVisible)) { continue; } else { break; } } // Compare the existing agewnda list with the list at this moment and extract the new item that was inserted after we created it above List <string> existingAgendasPlusNewAgenda = ElemGet.SelElem_ListTextToListString(MeetingAgendaSelElem); List <string> differences = existingAgendasPlusNewAgenda.Except(existingAgendas).ToList(); return(differences[0]); }
public void ActivityAwaitingValidationShowsInCoorespondingTable() { /// 1. Create a Mainport user and Login UserInfo NewUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.Mainport, UserUtils.UserRole.MP); LoginPage LP = Navigation.GoToLoginPage(browser); MyDashboardPage DP = LP.LoginAsNewUser(UserUtils.UserRole.MP, NewUser.Username, ConfigurationManager.AppSettings["LoginPassword"]); /// 2. Enter an activity which requires credit validation EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity Actvity = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec2_BulkJournalReadingwithTranscript_ValidationRequired, "10"); /// 3. Click the My Holding Area table, then verify that the activity appears in the Activity Awaiting Credit Validation table MyHoldingAreaPage MP = DP.ClickAndWaitBasePage(DP.MyHoldingAreaTab); Assert.True(ElemGet.Grid_ContainsRecord(browser, MP.AwaitingCredValidationTbl, Bys.MyHoldingAreaPage.AwaitingCredValidationTblBody, 0, Actvity.ActivityName, "a")); }
public void DeclinedExpiredTableUpdatesAfterObserverMakesChanges() { /// 1. Create learner and observer users and login as a learner LoginPage LP = Navigation.GoToLoginPage(browser); // We are using a try catch here for the following reason. This test sometimes is the very first test that gets run during the build. For some reason, the // RegisterUser API fails to complete and throws a 500 error whenever the first test gets set off on the grid. So if the error happens, then we will // just call the API again in the Catch block and proceed UserInfo LRUser = null; try { LRUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.CBD, UserUtils.UserRole.LR); } catch { LRUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.CBD, UserUtils.UserRole.LR); } OBUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.CBD, UserUtils.UserRole.OB); CBDLearnerPage CLP = LP.LoginAsNewUser(UserUtils.UserRole.LR, LRUser.Username, LRUser.Password); /// 2. Request an observation from the observer CLP.RequestObservationForEPA("Transition to Discipline", "Performing preoperative assessments for ASA 1 or 2 patients who will be undergoing a minor scheduled surgical procedure", OBUser.FullName, "Part A: Direct observation - Form 1"); /// 3. Log out and then log in as the observer that the learner requested CLP.ClickAndWaitBasePage(CLP.LogoutLnk); Navigation.GoToLoginPage(browser); CBDObserverPage OP = LP.LoginAsNewUser(UserUtils.UserRole.OB, OBUser.Username, OBUser.Password); /// 4. Decline the Pending observation request OP.AcceptOrDeclineAssignment(LRUser.FullName, "Part A: Direct observation - Form 1", "Decline"); OP.ExpandTable(OP.ExpiredDeclinedTblHdr, "", "expand"); Assert.True(ElemGet.Grid_ContainsRecord(Browser, OP.ExpiredDeclinedTbl, Bys.CBDObserverPage.ExpiredDeclinedTblRowBody, 0, LRUser.FullName, "td")); /// 5. Remove the declined request and verify that the table disappears. The table should disappear at this point /// because there was only 1 declined request to begin with OP.RemoveExpiredDeclinedRequest(LRUser.FullName, "Part A: Direct observation - Form 1"); Assert.True(browser.FindElements(Bys.CBDObserverPage.ExpiredDeclinedTblRowBody).Count == 0); /// 6. Switch to the Archived Observations tab and verify that the request shows there OP.SwitchToTab(OP.ArchivedObsTab); Assert.True(ElemGet.Grid_ContainsRecord(Browser, OP.ArchivedObservationsTbl, Bys.CBDObserverPage.ArchivedObservationsTblRowBody, 0, LRUser.FullName, "td")); }
public void UserCanCreateAGoal() { // Remove this if statement when bug https://code.premierinc.com/issues/browse/RCPSC-793 is fixed if (BrowserName == BrowserNames.Chrome) { /// 1. Create a Mainport user and Login UserInfo NewUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.Mainport, UserUtils.UserRole.MP); LoginPage LP = Navigation.GoToLoginPage(browser); MyDashboardPage DP = LP.LoginAsNewUser(UserUtils.UserRole.MP, NewUser.Username, ConfigurationManager.AppSettings["LoginPassword"]); /// 2. Click the Add a Goal button, fill in the information, click Next, then click Close string goalName = DP.AddAGoal(); /// 3. Verify that the goals table populates with this goal Assert.True(ElemGet.Grid_ContainsRecord(browser, DP.GoalsTbl, Bys.MyDashboardPage.GoalsTblBody, 0, goalName, "span")); } }
public void ObserverGetsObservationRequestFromLearner() { // TEMPORARY: When the Delete User API is developed, we can remove the below code and uncomment the code below it, which creates new users // on the fly. Decide this when the delete API is complete /// 1. Login as a learner LoginPage LP = Navigation.GoToLoginPage(browser); CBDLearnerPage CLP = LP.LoginAsExistingUser(UserUtils.UserRole.LR, UserUtils.Learner1Login, ConfigurationManager.AppSettings["LoginPassword"]); /// 2. Request an observation from the observer CLP.RequestObservationForEPA("Transition to Discipline", "Performing preoperative assessments for ASA 1 or 2 patients who will be undergoing a minor scheduled surgical procedure", UserUtils.Observer1FullName, "Part A: Direct observation - Form 1"); /// 3. Log out and then log in as the observer that the learner requested CLP.ClickAndWaitBasePage(CLP.LogoutLnk); Navigation.GoToLoginPage(browser); CBDObserverPage OP = LP.LoginAsExistingUser(UserUtils.UserRole.OB, UserUtils.Observer1Login, ConfigurationManager.AppSettings["LoginPassword"]); /// 4. Check that the observation that was just created is now in the Pending Acceptance table Assert.True(ElemGet.Grid_ContainsRecord(browser, OP.PendingAcceptanceTbl, Bys.CBDObserverPage.PendingAcceptanceTblRowBody, 0, UserUtils.Learner1FullName, "td"), "The observation that was requested from the learner is not showing in the Observer's Pending Acceptance table"); ///// 1. Create learner and observer users and login as the learner //LoginPage LP = Navigation.GoToLoginPage(browser); //LRUser = UserUtils.CreateAndRegisterUser(null, UserUtils.Application.CBD, UserUtils.UserRole.LR); //OBUser = UserUtils.CreateAndRegisterUser(null, UserUtils.Application.CBD, UserUtils.UserRole.OB); //CBDLearnerPage CLP = LP.LoginAsNewUser(UserUtils.UserRole.LR, LRUser.Username, LRUser.Password); ///// 2. Request an observation from the observer //CLP.RequestObservationForEPA(CLP.EPAIMTbl, "Transition to Discipline", // "Performing preoperative assessments for ASA 1 or 2 patients who will be undergoing a minor scheduled surgical procedure", // OBUser.FullName, "Part A: Direct observation - Form 1"); ///// 3. Log out and then log in as the observer that the learner requested //CLP.ClickAndWaitBasePage(CLP.LogoutLnk); //Navigation.GoToLoginPage(browser); //CBDObserverPage OP = LP.LoginAsNewUser(UserUtils.UserRole.OB, OBUser.Username, OBUser.Password); ///// 4. Check that the observation that was just created is now in the Pending Acceptance table //Assert.True(ElemGet.Grid_ContainsRecord(browser, OP.PendingAcceptanceTbl, LRUser.FullName, null)); }
/// <summary> /// /// </summary> /// <param name="yearsToAdd">However many years you want to add to the current date. If none, enter "0"</param> /// <param name="monthsToAdd">However many months you want to add to the current date. If none, enter "0"</param> /// <param name="daysToAdd">However many days you want to add to the current date. If none, enter "0"</param> public void FinalizeAllUpcomingAgendasOnSpecificDate(int yearsToAdd, int monthsToAdd, int daysToAdd) { // If we are not on the Competence Committee tab, then click on it to go there if (!Browser.Exists(Bys.CBDProgDirectorPage.FinalizeAgendaBtn, ElementCriteria.IsEnabled)) { ClickAndWait(CompCommiteeTab); } string date = DateTime.Now.AddYears(yearsToAdd).AddMonths(monthsToAdd).AddDays(daysToAdd).ToString("MM/dd/yyyy"); String upcomingAgendaInstance = string.Format("{0} Upcoming", date); int countOfUpcomingAgendasOnSpecificDate = ElemGet.SelElem_GetCountOfItemsContainingText(MeetingAgendaSelElem, "Upcoming"); for (int i = 0; i < countOfUpcomingAgendasOnSpecificDate; i++) { ElemSet.SelElem_SelectItemContainingText(MeetingAgendaSelElem, upcomingAgendaInstance); ClickAndWait(FinalizeAgendaBtn); ClickAndWait(FinalizeAgendaFormFinalizeBtn); } }
public void UserCanDeleteActivityFromMyHoldingArea() { /// 1. Create a Mainport user and Login UserInfo NewUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.Mainport, UserUtils.UserRole.MP); LoginPage LP = Navigation.GoToLoginPage(browser); MyDashboardPage DP = LP.LoginAsNewUser(UserUtils.UserRole.MP, NewUser.Username, ConfigurationManager.AppSettings["LoginPassword"]); /// 2. Click the Enter a CPD Activity button, fill in the fields, click Continue, then click Send to Holding Area, then click Close EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity ConferenceActivity = EAP.AddActivityThenSendToHoldingArea(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "10", true); /// 3. Click the My Holding Area tab, click the X button to delete the activity, then verify that it disappears from the Incomplete Activites table MyHoldingAreaPage MP = DP.ClickAndWaitBasePage(DP.MyHoldingAreaTab); MP.DeleteActivity(ConferenceActivity.ActivityName); Assert.False(ElemGet.Grid_ContainsRecord(browser, MP.IncompleteActivitiesTbl, Bys.MyHoldingAreaPage.IncompleteActivitiesTblBody, 0, ConferenceActivity.ActivityName, "a")); }
public void UserCanSendActivityToHoldingAreaThenCompleteActivity() { /// 1. Create a Mainport user and Login UserInfo NewUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.Mainport, UserUtils.UserRole.MP); LoginPage LP = Navigation.GoToLoginPage(browser); MyDashboardPage DP = LP.LoginAsNewUser(UserUtils.UserRole.MP, NewUser.Username, ConfigurationManager.AppSettings["LoginPassword"]); /// 2. Click the Enter a CPD Activity button, fill in the fields, click Send to Holding Area, then click Close /// Do this again for a second activity EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity ConferenceActivity = EAP.AddActivityThenSendToHoldingArea(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "10", true); DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity ConferenceActivity2 = EAP.AddActivityThenSendToHoldingArea(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "10", true); /// 3. Verify that the activity shows in the My Holding Area table Assert.True(ElemGet.Grid_ContainsRecord(browser, DP.MyHoldingAreaTbl, Bys.MyDashboardPage.MyHoldingAreaTblBody, 0, ConferenceActivity2.ActivityName, "span")); /// 4. Click the View More button underneath the My Holding Area table, then verify that the activity is showing in the /// Incomplete Activities. Click Complete Activity, then click the Continue button and complete the activity and verify /// that it disappears from the Incomplete Activites table MyHoldingAreaPage MP = DP.ClickAndWait(DP.ViewMoreBtn); Assert.True(ElemGet.Grid_ContainsRecord(browser, MP.IncompleteActivitiesTbl, Bys.MyHoldingAreaPage.IncompleteActivitiesTblBody, 0, ConferenceActivity2.ActivityName, "a")); MP.ClickCompleteActivityBtn(MP.IncompleteActivitiesTbl, Bys.MyHoldingAreaPage.IncompleteActivitiesTblBodyRow, ConferenceActivity2.ActivityName); // Not running this in firefox. For some reason, when I enter the date in the above AddActivityThenSendToHoldingArea method, the date enters fine // and the activity completes, but when I open the activity from this window, then the date isnt there, so this is an automation bug. Revisit if (BrowserName != BrowserNames.Firefox) { EAP.ClickAndWait(EAP.ContinueBtn); EAP.ClickAndWait(EAP.OptionalTabSubmitBtn); EAP.CloseBtn.Click(); // Very tired right now. Add dynamic wait here later Thread.Sleep(5000); browser.SwitchTo().DefaultContent(); Assert.False(ElemGet.Grid_ContainsRecord(browser, MP.IncompleteActivitiesTbl, Bys.MyHoldingAreaPage.IncompleteActivitiesTblBody, 0, ConferenceActivity2.ActivityName, "a")); } }
/// <summary> /// Checks the check box in the Portfolios Under Review tab for a user-specified trainee, clicks the Mark Selected Portfolio as Achieved button, checks the /// I Attest check box on the Mark Selected Portfolios as Achieved form, then clicks Submbit /// </summary> /// <param name="traineeFullName"></param> public void MarkPortfolioAchieved(string traineeFullName) { IWebElement row = ElemGet.Grid_GetRowByRowName(PortfoliosUnderReviewTbl, Bys.DiplomaDirectorPage.PortfoliosUnderReviewTblBodyRow, traineeFullName); ElemSet.Grid_ClickElementWithoutTextInsideRow(row, "input"); ClickAndWait(MarkSelectedPortfoliosAsAchievedBtn); MarkSelPortAchFormIAttestChk.Click(); // This failed once or twice, maybe because after I click on the I Atttest chekc box above, the Submit button sometimes // takes a long time to enable. So adding a sleep and then a try catch Thread.Sleep(0400); try { ClickAndWait(MarkSelPortAchFormSubmitBtn); } catch { ClickAndWait(MarkSelPortAchFormSubmitBtn); } }
/// <summary> /// Clicks on the Competence Committee tab if that page is not in view, then If an upcoming agenda is not created /// (e.g. No items in the Meeting Agenda dropdown have an agenda that says "Upcoming"), then this creates one with /// a random date. It opens the Create New Agenda window, assigns the date and clicks Create to create the new agenda. /// It will return the string representation of the agenda in the Meeting Agenda dropdown, so you can then select it. /// </summary> public string CreateUpcomingAgendaWithRandomDateIfNoneExist() { string agendaName = ""; // If we are not on the Competence Committee tab, then click on it to go there if (!Browser.Exists(Bys.CBDProgDirectorPage.FinalizeAgendaBtn, ElementCriteria.IsEnabled)) { ClickAndWait(CompCommiteeTab); } // If none of the list<string> items contain the text "Upcoming", then create an upcoming agenda if (!ElemGet.SelElem_ContainsText(MeetingAgendaSelElem, "Upcoming")) { agendaName = CreateUpcomingAgendaWithRandomDate(); } else // else return the string value of an existing one { return(ElemGet.SelElem_GetFirstItemContainingText(MeetingAgendaSelElem, "Upcoming").Text); } return(agendaName); }
public void NewActivityAppearsAndDisappearsFromGrid() { /// 1. Login as an existing user LoginPage LP = Navigation.GoToLoginPage(browser); MyDashboardPage DP = LP.LoginAsExistingUser(UserUtils.UserRole.MP, UserUtils.MainportUser1Login, ConfigurationManager.AppSettings["LoginPassword"]); /// 2. Add an activity EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity NewConferenceActivity = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "10", false); /// 3. Navigate to the My CPD Activities List page and verify that the activity got added to the the table MyCPDActivitiesListPage MCP = DP.ClickAndWaitBasePage(DP.MyCPDActivitiesTab); Assert.True(ElemGet.Grid_ContainsRecord(browser, MCP.ActivityTblBody, Bys.MyCPDActivitiesListPage.ActivityTblBody, 0, NewConferenceActivity.ActivityName, "a"), "The activity has not been added to the grid"); /// 4. Click the X button on the activity inside the grid, then click Ok on the popup to delete the activity, and make sure the activity /// disappears from the grid MCP.DeleteActivityFromGrid(NewConferenceActivity.ActivityName); Assert.False(ElemGet.Grid_ContainsRecord(browser, MCP.ActivityTblBody, Bys.MyCPDActivitiesListPage.ActivityTblBody, 0, NewConferenceActivity.ActivityName, "a"), "The activity has not been deleted"); }
/// <summary> /// Goes to the Publishing Details tab. If the catalog is not added to the activity, then this searches for the catalog in the available table, /// clicks on the plus icon of this catalog, and then waits for catalog to be added to the Selected Catalogs table /// </summary> /// <param name="catalogName">The name of the activity</param> /// <returns></returns> public void AddCatalogToActivity(string catalogName) { ClickAndWait(PubDetailsTab); // If the catalog is not in the selected table, then add it if (!ElemGet.Grid_ContainsRecord(Browser, PubDetailsTabSelCatTbl, Bys.ActivityMainPage.PubDetailsTabSelCatTblBodyRow, 1, catalogName, "td")) { // If the catalog is not showing on the 1st page of the available table, then search for it if (ElemGet.Grid_ContainsRecord(Browser, PubDetailsTabAvailCatTblBodyRow, Bys.ActivityMainPage.PubDetailsTabAvailCatTblBodyRow, 1, catalogName, "td")) { SearchForAvailableCatalog(catalogName); } IWebElement row = ElemGet_CME360.Grid_GetRowByRowName(PubDetailsTabAvailCatTbl, Bys.ActivityMainPage.PubDetailsTabAvailCatTblBodyRow, catalogName, "td"); ElemSet_CME360.Grid_ClickElementWithoutTextInsideRow(row, "input", "Add"); this.WaitUntil(Criteria.ActivityMainPage.PubDetailsTabAvailCatTblAddCatLoadElemVisible); this.WaitUntil(Criteria.ActivityMainPage.PubDetailsTabAvailCatTblAddCatLoadElemNotVisible); } }
public void SearchAddRemoveCatalogAndPortalDependency() { string activityName = ""; if (BrowserName == BrowserNames.Chrome) { activityName = "TestAuto Activity 1 Chrome"; } if (BrowserName == BrowserNames.InternetExplorer) { activityName = "TestAuto Activity 1 IE"; } if (BrowserName == BrowserNames.Firefox) { activityName = "TestAuto Activity 1 FF"; } string catalogName = "TestAuto Catalog 1"; string portalName = "_Test Portal"; /// 1. Login as TestAuto_TestPortal_User1 LoginPage LP = Navigation.GoToLoginPage(browser); MyDashboardPage MDP = LP.Login("TestAuto_TestPortal_User1", "password"); /// 2. Open the "TestAuto Activity 1" activity SearchResultsPage SP = MDP.Search(activityName); ActivityMainPage AMP = SP.GoToActivity(activityName); /// 3. Go to the Publishing Details and do a search for "TestAuto Catalog 1" and verify that it shows in the available table // First, we should check to make sure that this catalog is not in the Selected table (if it is, then the test failed at some point, and didnt reach // the part of the test where it moves the catalog back to the available list). So if its not in the available list, then we need to put it back AMP.ClickAndWait(AMP.PubDetailsTab); if (ElemGet.Grid_ContainsRecord(browser, AMP.PubDetailsTabSelCatTbl, Bys.ActivityMainPage.PubDetailsTabSelCatTblBodyRow, 1, catalogName, "td")) { AMP.RemoveCatalogFromActivity(catalogName); } AMP.SearchForAvailableCatalog(catalogName); Assert.True(ElemGet.Grid_ContainsRecord(browser, AMP.PubDetailsTabAvailCatTbl, Bys.ActivityMainPage.PubDetailsTabAvailCatTblBodyRow, 1, "TestAuto Catalog 1", "td", Bys.ActivityMainPage.PubDetailsTabAvailCatTblFirstBtn, Bys.ActivityMainPage.PubDetailsTabAvailCatTblNextBtn)); /// 4. Click the + icon in the catalog row of the available table and verify that it gets added to the selected table and removed from /// the available table AMP.AddCatalogToActivity(catalogName); Assert.False(ElemGet.Grid_ContainsRecord(browser, AMP.PubDetailsTabAvailCatTbl, Bys.ActivityMainPage.PubDetailsTabAvailCatTblBodyRow, 1, catalogName, "td", Bys.ActivityMainPage.PubDetailsTabAvailCatTblFirstBtn, Bys.ActivityMainPage.PubDetailsTabAvailCatTblNextBtn)); Assert.True(ElemGet.Grid_ContainsRecord(browser, AMP.PubDetailsTabSelCatTbl, Bys.ActivityMainPage.PubDetailsTabSelCatTblBodyRow, 1, catalogName, "td")); /// 5. Verify that the Portals table populates with the cooresponding portal that the Catalog is associated to Assert.True(ElemGet.Grid_ContainsRecord(browser, AMP.PubDetailsTabPortalsTbl, Bys.ActivityMainPage.PubDetailsTabPortalsTblBodyRow, 0, portalName, "td")); /// 6. Click the X icon in the catalog row of the selected table and verify that it gets removed from the selected table and added to /// the available table. Also verify that the portal gets removed from the portals table AMP.RemoveCatalogFromActivity(catalogName); Assert.True(ElemGet.Grid_ContainsRecord(browser, AMP.PubDetailsTabAvailCatTbl, Bys.ActivityMainPage.PubDetailsTabAvailCatTblBodyRow, 1, catalogName, "td", Bys.ActivityMainPage.PubDetailsTabAvailCatTblFirstBtn, Bys.ActivityMainPage.PubDetailsTabAvailCatTblNextBtn)); Assert.False(ElemGet.Grid_ContainsRecord(browser, AMP.PubDetailsTabSelCatTbl, Bys.ActivityMainPage.PubDetailsTabSelCatTblBodyRow, 1, catalogName, "td")); Assert.False(ElemGet.Grid_ContainsRecord(browser, AMP.PubDetailsTabPortalsTbl, Bys.ActivityMainPage.PubDetailsTabPortalsTblBodyRow, 0, portalName, "td")); }
public void CreditLabelVerification() { // Not runing firefox right now due to Lifetime support Actions button being a hover dropdown. Revisit this and fix in firefox, // Will probably just need to add a line of code to hover over Actions instead of clicking on it. if (BrowserName == BrowserNames.Chrome || BrowserName == BrowserNames.InternetExplorer) { /// 1. Create a Mainport user and Login UserInfo NewUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.Mainport, UserUtils.UserRole.MP); LoginPage LP = Navigation.GoToLoginPage(browser); MyDashboardPage DP = LP.LoginAsNewUser(UserUtils.UserRole.MP, NewUser.Username, ConfigurationManager.AppSettings["LoginPassword"]); /// 2. Add at least 1 activity for each activity type /// 3. Choose 1 activity which cuts the credits in half per hour/article when the No radio button is clicked. EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity ConferenceActivity = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "10", false); /// 4. Choose 1 activity which has a fixed amount of credits DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity FellowshipActivity = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec2_Fellowship_FixedCredits25); /// 5. Choose 1 activity which triples credits DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity AccreditedSelAssessActivity = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec3_AccreditedSelfAssessmentPrograms_CreditsTripled, "10"); /// 6. Choose 1 activity that requires validation DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity BulkJournalActivity = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec2_BulkJournalReadingwithTranscript_ValidationRequired, "10"); /// 7. Log on to the Lifetime Support site and validate the credit LSHelp.Login(browser, "lkaveti", "password"); LSHelp.ValidateCredit(browser, "Royal College of Physicians", NewUser.FullName, "Maintenance of Certification", BulkJournalActivity.ActivityName); /// 8. Go back to the Mainport app, and on the My Dashboard page, verify that the Total Credits Submitted and Applied labels reflect the amount of /// credits that were added above. Also verify the "MOC Section Requirements" graph labels get reflected. Based on the above activites, the /// Submitted label should have 5 for Conference, + 25 for fellowship, + 30 for accreditedselfassess, + 10 for bulkjournal. So total we should see 70 Navigation.GoToMyDashboardPage(browser); MainportHelperMethods.WaitForCreditsToBeApplied(browser, DP, Bys.MyDashboardPage.TotalCreditsAppliedValueLbl, "70"); Assert.AreEqual("70", DP.TotalCreditsSubmittedValueLbl.Text); Assert.AreEqual("70", DP.TotalCreditsAppliedValueLbl.Text); Assert.AreEqual(string.Format("Section 1Group Learning{0}/25 Credits", ConferenceActivity.Credits), DP.MOCSectionReqsGraphGroupLearningCreditLbl.GetAttribute("textContent")); int totalSelfLearningCredits = Int32.Parse(FellowshipActivity.Credits) + Int32.Parse(BulkJournalActivity.Credits); // For the Section 2 Self Learning activities, we completed 2 of them, so we have to add those 2 credits to get the total label Assert.AreEqual(string.Format("Section 2Self Learning{0}/25 Credits", totalSelfLearningCredits.ToString()), DP.MOCSectionReqsGraphSelfLearningCreditLbl.GetAttribute("textContent")); Assert.AreEqual(string.Format("Section 3Assessment{0}/25 Credits", AccreditedSelAssessActivity.Credits), DP.MOCSectionReqsGraphAssessmentCreditLbl.GetAttribute("textContent")); /// 9. On the My MOC page, verify that the credits are reflected in the Overall label, reflected in each Credits Applied to Date labels, /// and in each row under the Credits Reported column MyMOCPage MP = DP.ClickAndWaitBasePage(DP.MyMOCTab); // Overall label Assert.AreEqual("70 of 400", MP.OverallCreditsAppliedLbl.Text); // Credits Applied to Date labels Assert.AreEqual(ConferenceActivity.Credits + " Credits", MP.GroupLearnTblCreditsAppliedValueLbl.Text); Assert.AreEqual(totalSelfLearningCredits.ToString() + " Credits", MP.SelfLearningTblCreditsAppliedValueLbl.Text); Assert.AreEqual(AccreditedSelAssessActivity.Credits + " Credits", MP.AssessmentTblCreditsAppliedValueLbl.Text); // Credits Reported column Assert.AreEqual(ConferenceActivity.Credits, MP.GroupLearnTblUnaccrActRowCredsRptLbl.Text); Assert.AreEqual(FellowshipActivity.Credits, MP.SelfLearningTblPlanLearnActRowCredsRptLbl.Text); Assert.AreEqual(BulkJournalActivity.Credits, MP.SelfLearningTblScanActRowCredsRptLbl.Text); Assert.AreEqual(AccreditedSelAssessActivity.Credits, MP.AssessmentTblKnowledgeAssRowCredsRptLbl.Text); /// 10. Click on the View link for one of the activities, verify the credits are reflected correctly on the popup, click the Pencil icon /// to view the activity in read-only mode to verify that it appears MP.OpenViewActivitiesForm(MP.GroupLearnTblUnaccrActRowViewLnk); Assert.AreEqual(ElemGet.Grid_GetCellTextByRowNameAndColumnName(MP.ViewActivitiesFormActivitiesTbl, MP.ViewActivitiesFormActivitiesTblThead, Bys.MyMOCPage.ViewActivitiesFormActivitiesTblBody, ConferenceActivity.ActivityName, "td", "Credits Reported"), ConferenceActivity.Credits); MP.ClickAndWait(MP.ViewActivitiesFormCloseBtn); } }