public void PRACycleNotCompleteAfter79Credits() { /// 1. Create a Mainport user, then place the user in the PRA cycle through LTS UserInfo NewUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.Mainport, UserUtils.UserRole.MP); LSHelp.Login(browser, "lkaveti", "password"); LSHelp.GoToParticipantProgramPage(browser, "Royal College of Physicians", NewUser.FullName, "Maintenance of Certification"); LSHelp.RCP_AddProgramAdjustment(browser, NewUser.FullName, LSConstants.AdjustmentCodes.PRA); /// 2. Custom date the cycle end date so that it is in the past. This is so that the user is able to be marked as Complete (Sort of hacking /// the system). First, We have to move the start date back LSHelp.RCP_AdjustMOCDate(browser, NewUser.FullName, "Start", DateTime.Now.AddYears(-2).ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); LSHelp.RCP_AdjustMOCDate(browser, NewUser.FullName, "End", DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); /// 3. Login to Mainport and submit an activity totalling 79 credits. Enter an activity date that falls within the cycle date range. string actDate = DateTime.Now.AddMonths(-13).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); LoginPage LP = Navigation.GoToLoginPage(browser); MyDashboardPage DP = LP.LoginAsNewUser(UserUtils.UserRole.MP, NewUser.Username, ConfigurationManager.AppSettings["LoginPassword"]); EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity ConferenceAct = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "79", true, actDate); /// 4. Login to Lifetime Support and validate the credits LSHelp.Login(browser, "lkaveti", "password"); LSHelp.ValidateCredit(browser, "Royal College of Physicians", NewUser.FullName, "Maintenance of Certification", ConferenceAct.ActivityName); /// 5. Click on the Details tab and verify that the UI displays In Progress for the Status label // First we have to wait for the windows service to process the credits. LSHelp.WaitForProgramCreditsWindowsService(browser, "79 (of 80)"); string actualStatusLblValue = LSHelp.GetProgramDetail(browser, "Status"); Assert.AreEqual("In Progress", LSHelp.GetProgramDetail(browser, "Status"), string.Format("The Status label did not show 'In Progress' for " + "a user who only completed 79 out of 80 credits in a PRA cycle. The label printed '{0}' instead", actualStatusLblValue)); }
/// <summary> /// Send as many activities as you want to this method, and this will determine if they need credit validation, and if so, they will validate them. Specificaly, /// for activities that need credit validation, this clicks on the the Self Reporting tab on the Program Page of Lifetime support, clicks the Actions>Validate /// link for a user-specified activity, waits for the Credit Validation page to appear, clicks the Accept radio button, clicks the Submit button, and waits for /// the page to be done loading. /// </summary> /// <param name="activities"><see cref="Activity"/></param> public static void ValidateCreditsIfApplicable(IWebDriver browser, UserInfo user, params Activity[] activities) { LSHelperMethods LSHelp = new LSHelperMethods(); foreach (Activity act in activities) { if (act.RequiresValidation) { LSHelp.ValidateCredit(browser, "Royal College of Physicians", user.FullName, "Maintenance of Certification", act.ActivityName); } } }
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); } }