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")); }
/// <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> /// 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()); }
/// <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); } }