public void PRACycleCompleteAfter80Credits() { /// 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 80 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, "80", 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 Complete for the Status label // First we have to wait for the windows service to process the credits. LSHelp.WaitForProgramCreditsWindowsService(browser, "80 (of 80)"); Assert.AreEqual("Complete", LSHelp.GetProgramDetail(browser, "Status")); }
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 MainCyclNotCompleteAfter399Credits() { /// 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 399 credits, Enter an activity date that falls within the cycle date range. /// NOTE: If the activity date falls within cycle date's the 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, "399", true, actDate); /// 3. Login to Lifetime Support and validate the credits that need 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 In Progress for the Status label, since we did not reach the 400 credits // First we have to wait for the windows service to process the credits. LSHelp.WaitForProgramCreditsWindowsService(browser, "399 (of 400)"); Assert.AreEqual("In Progress", LSHelp.GetProgramDetail(browser, "Status")); }
public void UIUpdatesAfterUserMeetsSectionCreditMinimumRequirement() { /// 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. Submit an activity in each section, ensuring that 25 credits have been met in each section EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity ConferenceAct = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "25", true); DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity FellowshipAct = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec2_Fellowship_FixedCredits25); DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity MultiSourceFeedbackAct = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec3_MultisourceFeedback_CreditsTripled, "10"); // Have to wait for the credits to be applied before we can proceed MainportHelperMethods.WaitForCreditsToBeApplied(browser, DP, Bys.MyDashboardPage.TotalCreditsAppliedValueLbl, "80"); /// 3. Verify that the MOC Section Requirements labels show as blue/gray, and that the checkmark shows for each box Assert.AreEqual("showGrey", DP.MOCSectionReqsGraphGroupLearningSquare.GetAttribute("class")); Assert.AreEqual("showGrey", DP.MOCSectionReqsGraphSelfLearningSquare.GetAttribute("class")); Assert.AreEqual("showGrey", DP.MOCSectionReqsGraphAssessmentSquare.GetAttribute("class")); Assert.True(DP.MOCSectionReqsGraphGroupLearningTickBox.Displayed); Assert.True(DP.MOCSectionReqsGraphSelfLearningTickBox.Displayed); Assert.True(DP.MOCSectionReqsGraphAssessmentTickBox.Displayed); /// 4. Go to the My MOC tab and verify that the "section minimum requirement was met" label is shown DP.ClickAndWaitBasePage(DP.MyMOCTab); Assert.True(Browser.Exists(Bys.MyMOCPage.GroupLearnTblYouHaveMetMinCredsLbl, ElementCriteria.IsVisible)); Assert.True(Browser.Exists(Bys.MyMOCPage.SelfLearningTblYouHaveMetMinCredsLbl, ElementCriteria.IsVisible)); Assert.True(Browser.Exists(Bys.MyMOCPage.AssessmentTblYouHaveMetMinCredsLbl, ElementCriteria.IsVisible)); }
public void UserCanCompleteAllActivities() { // Only going to run this in Chrome. I create activities in other test methods, so we already cross-browser test that an activity can be // completed in all browsers in those tests. If we were to run this method in all browsers, especially IE, it would just increase run time // unneccessarily 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. Add 1 activity for all of section 1's activity types /// 3. Add 1 activity for all of section 2's activity types /// 4. Add 1 activity for all of section 3's activity types foreach (Constants.MainportActivityTypes activityType in Enum.GetValues(typeof(Constants.MainportActivityTypes))) { // This will fail until https://code.premierinc.com/issues/browse/RCPSC-772 is fixed. Once fixed, then make sure the Reading dropdown // By is updated and run the test removing this If statement if (activityType != Constants.MainportActivityTypes.Sec2_Reading_FixedCredits1) { EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); EAP.AddActivityThenSubmit(activityType, "10", true); } } } }
/// <summary> /// Clicks on the Complete Activity button for a user-specified activity in the user-specified table, then waits for the Enter a CPD Activity page /// to appear, then returns that page object /// </summary> /// <param name="tbl">The table that your activity is in</param> /// <param name="tblBodyRow">Any row within the table, in By form. This is just used to wait until any row loads</param> /// <param name="activityName">The exact text from the first column of the table for your activity, or your activity name</param> /// <returns></returns> public EnterCPDActivityPage ClickCompleteActivityBtn(IWebElement tbl, By tblBodyRow, string activityName) { ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, tbl, tblBodyRow, activityName, null, "Complete Activity"); EnterCPDActivityPage page = new EnterCPDActivityPage(Browser); page.WaitForInitialize(); Browser.SwitchTo().Frame(page.EnterACPDFrame); return(page); }
//[Test] public void sandboxtest() { 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"]); EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity ConferenceActivity = EAP.AddActivityThenSendToHoldingArea(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "10", true); }
/// <summary> /// Switches to the Enter a CPD Activity page iframe /// </summary> /// <returns></returns> public EnterCPDActivityPage SwitchToEnterACPDActivitiesFormFrame() { Browser.SwitchTo().DefaultContent(); Browser.WaitForElement(Bys.EnterCPDActivityPage.EnterACPDFrame, ElementCriteria.IsVisible); EnterCPDActivityPage page = new EnterCPDActivityPage(Browser); page.WaitForInitialize(); Browser.SwitchTo().Frame(page.EnterACPDFrame); return(page); }
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 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 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")); } }
public void UserCanEditActivityOnMyMOCPage() { /// 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 EnterCPDActivityPage EAP = DP.ClickAndWait(DP.EnterACPDActivityBtn); Activity NewConferenceActivity = EAP.AddActivityThenSubmit(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "20", true); /// 3. Click to the MyMOC page, click on the View link for the activity that was created, click on the Pencil icon in the Activities table on the popup, /// then verify that the information on this form is correct // Gotta wait for the windows service first to apply the credits MainportHelperMethods.WaitForCreditsToBeApplied(browser, DP, Bys.MyDashboardPage.TotalCreditsAppliedValueLbl, "20"); MyMOCPage MP = DP.ClickAndWaitBasePage(DP.MyMOCTab); MP.OpenEditActivityForm(MP.GroupLearnTblAccrActRowViewLnk, NewConferenceActivity.ActivityName); /// 4. Edit the activity. Change accredited to not accredited. Change the credits from 20 to 10. Change the name. Close the form. Verify that the /// amount of credits gets updated on all related labels, verify that the activity was moved from the accredited table to the not accredited table, /// and verify the name change Activity EditedConferenceActivity = EAP.EditActivity(Constants.MainportActivityTypes.Sec1_Conference_IfNotAccreditedCutCreditsInHalf, "10", false); Browser.SwitchTo().DefaultContent(); MP.ClickAndWaitBasePage(MP.MyDashboardTab); MainportHelperMethods.WaitForCreditsToBeApplied(browser, DP, Bys.MyDashboardPage.TotalCreditsAppliedValueLbl, "5"); // Overall label DP.ClickAndWaitBasePage(DP.MyMOCTab); Assert.AreEqual("5 of 400", MP.OverallCreditsAppliedLbl.Text); // Credits Applied to Date labels Assert.AreEqual(EditedConferenceActivity.Credits + " Credits", MP.GroupLearnTblCreditsAppliedValueLbl.Text); // Credits Reported column Assert.AreEqual("-", MP.GroupLearnTblAccrActRowCredsRptLbl.Text); Assert.AreEqual(EditedConferenceActivity.Credits, MP.GroupLearnTblUnaccrActRowCredsRptLbl.Text); /// 5. Click back to the Dashboard page and verify that the credit amount change is reflected there MP.ClickAndWaitBasePage(MP.MyDashboardTab); Assert.AreEqual("5", DP.TotalCreditsSubmittedValueLbl.Text); Assert.AreEqual("5", DP.TotalCreditsAppliedValueLbl.Text); }
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> /// Clicks the user-specified element and then waits for a window to close or open, or a page to load, /// depending on the element that was clicked /// </summary> /// <param name="buttonOrLinkElem">The button element</param> public dynamic ClickAndWait(IWebElement buttonOrLinkElem) { if (Browser.Exists(Bys.MyCPDActivitiesListPage.EnterACPDActivityBtn)) { if (buttonOrLinkElem.GetAttribute("outerHTML") == EnterACPDActivityBtn.GetAttribute("outerHTML")) { EnterACPDActivityBtn.Click(); Browser.WaitForElement(Bys.EnterCPDActivityPage.EnterACPDFrame, ElementCriteria.IsVisible); EnterCPDActivityPage EAP = new EnterCPDActivityPage(Browser); EAP.WaitForInitialize(); Browser.SwitchTo().Frame(EAP.EnterACPDFrame); return(EAP); } } if (Browser.Exists(Bys.MyCPDActivitiesListPage.DeleteActivityFormOkBtn)) { if (buttonOrLinkElem.GetAttribute("outerHTML") == DeleteActivityFormOkBtn.GetAttribute("outerHTML")) { DeleteActivityFormOkBtn.Click(); // Mike J 12/21/2017: I tried everything to implement a dynamic wait here, but couldnt find a way to do it. I tried to wait until // various different loading elements disappear, but none of them worked. I even element inspected the exact circle load icon that // I visually see when we click the delete button, but that didnt work, as its not within the body of the HTML. We might have to use // a static wait here. Dont waste time trying to implement a dynamic wait later on, as I dont think its possible, or if it is, it // is very hidden Thread.Sleep(10000); return(null); } } else { throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, " + "or if the button is already added, then the page you were on did not contain the button."); } return(null); }
/// <summary> /// Clicks the user-specified element and then waits for a window to close or open, or a page to load, /// depending on the element that was clicked /// </summary> /// <param name="buttonOrLinkElem">The button element</param> public dynamic ClickAndWait(IWebElement buttonOrLinkElem) { // Error handler to make sure that the button that the tester passed in the parameter is actually on the page if (Browser.Exists(Bys.MyDashboardPage.EnterACPDActivityBtn)) { // This is a workaround to be able to use an IF statement on an IWebElement type. if (buttonOrLinkElem.GetAttribute("outerHTML") == EnterACPDActivityBtn.GetAttribute("outerHTML")) { buttonOrLinkElem.Click(); Browser.WaitForElement(Bys.EnterCPDActivityPage.EnterACPDFrame, ElementCriteria.IsVisible); EnterCPDActivityPage EAP = new EnterCPDActivityPage(Browser); EAP.WaitForInitialize(); Browser.SwitchTo().Frame(EAP.EnterACPDFrame); return(EAP); } } if (Browser.Exists(Bys.MyDashboardPage.AddAGoalBtn)) { if (buttonOrLinkElem.GetAttribute("outerHTML") == AddAGoalBtn.GetAttribute("outerHTML")) { buttonOrLinkElem.Click(); SwitchToFrame(Bys.MyDashboardPage.CreateAGoalFrame, CreateAGoalFrame, Bys.MyDashboardPage.CreateAGoalFormNextBtnTxt); return(null); } } if (Browser.Exists(Bys.MyDashboardPage.CreateAGoalFormNextBtnTxt)) { if (buttonOrLinkElem.GetAttribute("outerHTML") == CreateAGoalFormNextBtnTxt.GetAttribute("outerHTML")) { buttonOrLinkElem.Click(); this.WaitUntil(Criteria.MyDashboardPage.CreateAGoalFormCloseBtnVisible); return(null); } } if (Browser.Exists(Bys.MyDashboardPage.CreateAGoalFormCloseBtn)) { if (buttonOrLinkElem.GetAttribute("outerHTML") == CreateAGoalFormCloseBtn.GetAttribute("outerHTML")) { buttonOrLinkElem.Click(); this.WaitUntil(Criteria.MyDashboardPage.TotalCreditsAppliedValueLblVisible); return(null); } } if (Browser.Exists(Bys.MyDashboardPage.ViewMoreBtn)) { if (buttonOrLinkElem.GetAttribute("outerHTML") == ViewMoreBtn.GetAttribute("outerHTML")) { buttonOrLinkElem.Click(); MyHoldingAreaPage page = new MyHoldingAreaPage(Browser); page.WaitForInitialize(); return(page); } } else { throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, " + "or if the button is already added, then the page you were on did not contain the button."); } return(null); }
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); } }