/// <summary> /// Goes to the Self Reporting tab if we are not already there, 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 be done loading /// </summary> /// <param name="activityName">The exact text of the activity inside the Self Reported Activities table table that you want to click on</param> internal void ChooseActivityAndValidateCredi(string activityName) { ClickAndWait(SelfReportActTab); IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, SelfReportActTabValidActivityTbl, Bys.ProgramPage.SelfReportActTabActivityTblBodyRow, activityName, "td", "Actions", "span"); Thread.Sleep(0500); IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3); ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Validate"); Browser.WaitForElement(Bys.ProgramPage.CreditValidationAcceptRdo); CreditValidationAcceptRdo.Click(); ClickAndWait(CreditValidationSubmitBtn); Thread.Sleep(0300); this.WaitUntil(Criteria.ProgramPage.ExternalActivityHasBeenAcceptedBannerNotExists); // Adding a little sleep here. For some reason, whenever the code proceeds after clicking this button (which invokes the green banner at the top), // the next line of code doesnt execute. For example, Navigate.GoToLoginPage. That code gets past the navigation part, but if you view the test in // progress, no URL is entered into the URL. Another example I have code to click on the "Sites" tab in LTS after this, and the code goes past the // Click line, but if you view the test, it didnt click anything. I have never seen this before. So far, I think it only happened in Debug mode. // Monitor going forward Thread.Sleep(0600); // Have to refresh the page sometimes so the credits appear on the details tab this.RefreshPage(true); }
/// <summary> /// Chooses a learner in the learners table, clicks on the Actions button, clicks on Schedule Progress Meeting, fill in /// all of the fields with random data and clicks Submit /// </summary> /// <param name="learnerFullName"></param> public void ScheduleProgressMeeting(string learnerFullName) { IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, LearnersTbl, Bys.CBDProgDirectorPage.LearnersTblRowBody, learnerFullName, "a", "Actions", "span"); Thread.Sleep(0500); IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3); ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Schedule Progress Meeting"); Browser.WaitForElement(Bys.CBDProgDirectorPage.SchedProgMeetFormSubjectTxt, ElementCriteria.IsVisible); this.WaitUntilAll(Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide, Criteria.CBDProgDirectorPage.LoadElementDisappeared); ElemSet.ChkBx_ChooseRandom(Browser, UserUtils.ProgAdmin1FullName); ElemSet.DatePicker_ChooseDate(Browser, "19", "December", "01"); SchedProgMeetFormSubjectTxt.SendKeys(DataUtils.GetRandomSentence(10)); // Generate a random boolean, then use it to randomly check or uncheck the check box and select a recurring meeting or not Random gen = new Random(); bool reccuring = gen.Next(100) <= 20 ? true : false; if (reccuring) { SchedProgMeetFormRecurChk.Click(); Thread.Sleep(0300); ElemSet.SelElem_Single_SelectRandomItem(SchedProgMeetFormRecurringSelElem); } ClickAndWait(SchedProgMeetFormScheduleBtn); }
/// <summary> /// Clicks on the Programs tab, clcks Actions>Adjust Dates link for the Maintenance Of Certification program, fills in a user-specified start or end date, /// then clicks the Yes button /// </summary> /// <param name="startOrEndDate">"Start" or "End"</param> /// <param name="date">The date to enter</param> internal void AdjustProgramCycleDates(string startOrEndDate, string date) { ClickAndWait(ProgramsTab); IWebElement btn = ElemSet.Grid_HoverButtonOrLinkWithinRow(Browser, ProgramsTabProgramTbl, Bys.ParticipantsPage.ProgramsTabProgramTblBodyRow, "Maintenance of Certification", null, "Actions", "span"); Thread.Sleep(0500); IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3); ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Adjust Dates"); Browser.WaitForElement(Bys.ParticipantsPage.ProgramsTabRecognitionFormStartDtTxt, ElementCriteria.IsVisible); if (startOrEndDate == "Start") { ProgramsTabRecognitionFormStartDtTxt.Clear(); ProgramsTabRecognitionFormStartDtTxt.SendKeys(date); } else { ProgramsTabRecognitionFormEndDtTxt.Clear(); ProgramsTabRecognitionFormEndDtTxt.SendKeys(date); } ClickAndWait(ProgramsTabRecognitionFormYesBtn); }
/// <summary> /// Clicks the Actions button inside of a user-specified row, clicks the Accept/Decline button, fills the form and either /// clicks the Accept or Decline button /// </summary> /// <param name="learnerName">The first and last name of the learner with the pending observation request</param> /// <param name="acceptOrDecline">Either "Accept" "Decline"</param> /// <returns></returns> public AcceptDeclineAssignmentFormInfo AcceptOrDeclineAssignment(string learnerName, string formName, string acceptOrDecline) { IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, PendingAcceptanceTbl, Bys.CBDObserverPage.PendingAcceptanceTblRowBody, learnerName, "td", "Actions", "span", formName, "span"); Thread.Sleep(0500); IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3); ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Accept/Decline Assignment"); // Wait until the Accept/Decline assesment window opens Browser.WaitForElement(Bys.CBDObserverPage.AccDecAssgnMntFormCommentsTxt, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible, ElementCriteria.IsEnabled); Browser.WaitForElement(Bys.RCPPage.LoadIcon, TimeSpan.FromSeconds(60), ElementCriteria.AttributeValue("class", "page-splash dissolve-animation ng-hide") .OR(ElementCriteria.AttributeValue("class", "page-splash dissolve-animation ng-animate ng-hide"))); AcceptDeclineAssignmentFormInfo ADFO = FillAcceptDeclineAssignmentForm(); if (acceptOrDecline == "Accept") { ClickAndWait(AccDecAssgnMntFormAcceptBtn); } else { // TOD: Add code for declining assessment ClickAndWait(AccDecAssgnMntFormDeclineBtn); ClickAndWait(ConfirmFormDeclineAssessYesBtn); } return(ADFO); }
/// <summary> /// /// </summary> /// <param name="learnerName">The first and last name of the learner with the pending observation request</param> /// <param name="acceptOrDecline">Either "Accept" "Decline"</param> /// <returns></returns> public void RemoveExpiredDeclinedRequest(string learnerName, string formName) { IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, ExpiredDeclinedTbl, Bys.CBDObserverPage.ExpiredDeclinedTblRowBody, learnerName, "td", "Actions", "span", formName, "span"); Thread.Sleep(0500); IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3); ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Remove"); ClickAndWait(ConfirmFormRemoveAssessOkBtn); }
public void OpenCompleteAssessFormmentWindow(string learnerName, string formName) { IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, AcceptedTbl, Bys.CBDObserverPage.AcceptedTblRowBody, learnerName, "td", "Actions", "span", formName, "span"); Thread.Sleep(0500); IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3); ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Complete Assessment"); Browser.WaitForElement(Bys.CBDObserverPage.CompleteAssessFormFeedbackTxt, ElementCriteria.IsEnabled, ElementCriteria.IsVisible); Browser.WaitForElement(Bys.CBDObserverPage.CompleteAssessFormDateControlExpandBtn, ElementCriteria.IsVisible, ElementCriteria.IsEnabled); this.WaitForInitialize(); }
/// <summary> /// Chooses a learner in the learners table, clicks on the Actions button, clicks on Add/Remove Flag, fill in /// all of the fields with random data and clicks Save Flag /// </summary> /// <param name="learnerFullName"></param> public void AddFlag(string learnerFullName) { IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, LearnersTbl, Bys.CBDProgDirectorPage.LearnersTblRowBody, learnerFullName, "a", "Actions", "span"); Thread.Sleep(0500); IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3); ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Add/Remove Flag"); Browser.WaitForElement(Bys.CBDProgDirectorPage.AddRemoveFlagFormReasonTxt, ElementCriteria.IsVisible); this.WaitUntilAll(Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide, Criteria.CBDProgDirectorPage.LoadElementDisappeared); AddRemoveFlagFormReasonTxt.SendKeys(DataUtils.GetRandomSentence(10)); ClickAndWait(AddRemoveFlagFormSaveFlagBtn); }
/// <summary> /// Chooses User specified Learner, clicks the Action button, selects Add Notes, fills in the Subject and Notes text box with /// a random string, chooses the user-specified radio button then clicks Submit /// </summary> /// <param name="learnerFullName">First and last name of the learner</param> /// <param name="sharingOption">The exact text of either radio button on the Add Notes form</param> public void AddNotes(string learnerFullName, string sharingOption) { IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, LearnersTbl, Bys.CBDProgDirectorPage.LearnersTblRowBody, learnerFullName, "a", "Actions", "span"); Thread.Sleep(0500); IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3); ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Add Notes"); Browser.WaitForElement(Bys.CBDProgDirectorPage.AddNotesFormSubjectTxt, ElementCriteria.IsVisible); this.WaitUntilAll(Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide, Criteria.CBDProgDirectorPage.LoadElementDisappeared); AddNotesFormNotesTxt.SendKeys(DataUtils.GetRandomSentence(12)); ElemSet.RdoBtn_ClickRandom(Browser, "Share This Note"); AddNotesFormSubjectTxt.SendKeys(DataUtils.GetRandomSentence(12)); ClickAndWait(AddNotesFormSubmitBtn); }
/// <summary> /// Chooses User specified Learner, clicks the Action button, selects Add Supporting Documentation, /// fills in the File Name text box, then clicks Submit /// </summary> /// <param name="learnerName">First and last name of the learner</param> /// <param name="fileLocation">File location</param> public void AddSupportDocumentation(string learnerFullName, string fileLocation) { IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, LearnersTbl, Bys.CBDProgDirectorPage.LearnersTblRowBody, learnerFullName, "a", "Actions", "span"); Thread.Sleep(0500); IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3); ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Add Supporting Documentation"); Browser.WaitForElement(Bys.CBDProgDirectorPage.AddSupportingDocumentationFormFilelocationTxt, ElementCriteria.IsVisible); this.WaitUntilAll(Criteria.CBDProgDirectorPage.LoadElementClassAttributeSetToHide, Criteria.CBDProgDirectorPage.LoadElementDisappeared); AddSupportingDocumentationFormFilelocationTxt.SendKeys(fileLocation); // FileUtils.Upload(AddSupportingDocumentationFormBrowseBtn, @"C:\SeleniumAutoIt\FileUpload.exe", browserName, "C:\\SeleniumAutoIt\\test.txt"); ClickAndWait(AddSupportingDocumentationFormSubmitBtn); }
/// <summary> /// Chooses a program from the Program dropdown, clicks on the Learner tab, chooses a user specified Learner, /// clicks on the Actions button, clicks on Add/Remove Flag, fill in /// all of the fields with random data and clicks Save Flag /// </summary> /// <param name="program">The text from one of the items in the Program dropdown</param> /// <param name="learnerFullName">First and last name of the learner</param> public void AddFlag(string program, string learnerFullName) { SelectProgram(program); ClickAndWait(LearnersTab); IWebElement btn = ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, LearnersTbl, Bys.CBDProgDeanPage.LearnersTblBodyRow, learnerFullName, "a", "Actions", "span"); Thread.Sleep(0500); IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3); ElemSet.Grid_ClickMenuItemInsideDropdown(Browser, btnParent, "Add/Remove Flag"); Browser.WaitForElement(Bys.CBDProgDeanPage.AddRemoveFlagFormReasonTxt, ElementCriteria.IsVisible); this.WaitUntil(Criteria.CBDProgDeanPage.LoadElementDoneLoading); AddRemoveFlagFormReasonTxt.SendKeys(DataUtils.GetRandomSentence(10)); ClickAndWait(AddRemoveFlagFormSaveFlagBtn); }