public void MainCycleAdvancesToMain2CycleAfter400Credits() { // Not running this test on Feb 1st of any year, because Mainport has some weird gracce period rule where the user gets auto-advanced without // the Admin having to manually advance him, so it messes with the test if (DateTime.Now.Date.ToString() != "2/1/2018 12:00:00 AM") { /// 1. Create a Mainport user, which has a cycle start date 6 years prior, then Login. We are using a date 6 years in the past because /// the end date of the cycle needs to be a past date for the user to be able to advance, and the Main cycle is 5 years UserInfo NewUser = UserUtils.CreateAndRegisterUser(UserUtils.Application.Mainport, UserUtils.UserRole.MP, null, null, DateTime.Now.AddYears(-6).ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); LoginPage LP = Navigation.GoToLoginPage(browser); MyDashboardPage DP = LP.LoginAsNewUser(UserUtils.UserRole.MP, NewUser.Username, ConfigurationManager.AppSettings["LoginPassword"]); /// 2. Submit an activity totalling 400 credits, Enter an activity date that falls within the cycle date range. /// NOTE: If the activity date falls within the cycle date's last year for a Main cycle, then we wont need to credit validate string actDate = DateTime.Now.AddYears(-1).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity ConferenceAct = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "400", true, actDate); /// 3. Login to Lifetime Support and validate the credit that needs validated, if applicable. See note above in step 2 about credit validation. /// Depending on what day of the year this test is run, it may need credit validation LSHelp.Login(browser, "lkaveti", "password"); LSHelp.GoToParticipantProgramPage(browser, "Royal College of Physicians", NewUser.FullName, "Maintenance of Certification"); MainportHelperMethods.ValidateCreditsIfApplicable(browser, NewUser, ConferenceAct); /// 4. Click on the Details tab and verify that the UI displays Complete for the Status label // First we have to wait for the windows service to process the credits. LSHelp.WaitForProgramCreditsWindowsService(browser, "400 (of 400)"); Assert.AreEqual("Complete", LSHelp.GetProgramDetail(browser, "Status")); /// 5. Add a Main cycle adjustment, then verify that the UI displays In Progress for the Status label, and "Main 2nd or Later Cycle" for the /// program label. NOTE: We can not automate the "automatic" cycle advacement because it relies on a windows service that gets run overnight. /// Going from Main 1 to Main2/EXT, etc. usually occurs automatically for clients with the overnight windows service. We are sort of hacking /// the system by manually setting this user to Main 2, and not truly testing that a user gets put into Main 2 once he meets his credit /// minimum. Basically, you can place a user into any cycle through LTS, even if the user did not meet credit minimum LSHelp.RCP_AddProgramAdjustment(browser, NewUser.FullName, LSConstants.AdjustmentCodes.MainProgram, DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)); Assert.AreEqual(DateTime.Now.ToString("M/d/yyyy", CultureInfo.InvariantCulture), LSHelp.GetProgramDetail(browser, "Starts")); Assert.AreEqual("Main 2nd or Later Cycle", LSHelp.GetProgramDetail(browser, "Program")); /// 6. Go back to Mainport and verify that the user is in a new cycle by checking that the credits reset to 0 Navigation.GoToMyDashboardPage(browser); Assert.AreEqual("0", DP.TotalCreditsSubmittedValueLbl.Text); Assert.AreEqual("0", DP.TotalCreditsAppliedValueLbl.Text); } }
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); } }