/// <summary> /// Stale Milestone Issue: Sometimes after we complete a milestone and then click the Back To Dashboard button, the milestone doesnt /// properly disappear, So we are adding the following logic to click on this milestone again, then click back again, to refresh the /// table so the milestone disappears. I was going to create a bug for this, but I cant reproduce it manually /// </summary> /// <param name="milestoneText">The milestone that may be left in a stale state</param> private void CleanStaleMilestone(string milestoneText) { IList <IWebElement> staleMilestoneElement = Browser.FindElements(By.XPath(string.Format("//a[text()='{0}']", milestoneText))); if (staleMilestoneElement.Count > 0) { staleMilestoneElement[0].Click(); WaitForMilestoneFrame(); ClickAndWait(BackToDashboardBtn); } StatusSelElem.SelectByText("Not Started"); }
/// <summary> /// For all required milestones, this method clicks on each milestone, uploads a document, saves and completes the milestone. /// This does not complete the milestones labeled as "optional". Note that for this method to work, you /// have to label your optional milestones as "optional" when creating your program in Lifetime Support /// </summary> public List <string> CompleteAllRequiredMilestones() { string currentMileStoneText = ""; // Have to wait for the milestones to appear in the table first. Note that we cant use this Wait Criteria // our WaitForInitialize method because sometimes we login expecting there not to be any milestones this.WaitUntilAny(Criteria.PERTraineePage.MilestonesTblMilestoneNameLinksEnabled); StatusSelElem.SelectByText("Not Started"); // Get all of the the milestone names first so we can then return them at the end of the method. Note that we have // to get the textContent property, not Selenium's Text property. This is because the text inside the HTML has 2 // spaces between the milestone number and the title. Selenium's text property only has 1 space List <string> milestoneNames = MilestonesInMilestonesTblLnks.Select(t => t.GetAttribute("textContent")).ToList(); // Get the count of all rows (except for the last one) on the milestone table and then loop through them. The reason // why we are leaving the last one out is because this is the optional milestone. Note that for this method to work, a // PER Program has to be created that includes an optional milestone that comes last in the sort order int countOfRowsInMilestoneTable = MilestonesInMilestonesTblLnks.Count; for (int i = 0; i <= countOfRowsInMilestoneTable; i++) { if (RequiredMilestonesInMilestonesTblLnks.Count > 0) { // Store the text of the milestone that we are manipulating, so that we can use this text in the method CleanStaleMilestone // See description of that method for explanation of this issue currentMileStoneText = RequiredMilestonesInMilestonesTblLnks[0].Text; RequiredMilestonesInMilestonesTblLnks[0].Click(); this.WaitUntilAll(Criteria.PERTraineePage.EvidenceTblUpdateLinksEnabledAndVisible, Criteria.PERTraineePage.BackToDashboardBtnVisible); UploadFileForAllEvidenceRows(); AddDescriptionAndMarkMilestoneComplete(); ClickAndWait(BackToDashboardBtn); } else { break; } StatusSelElem.SelectByText("Not Started"); CleanStaleMilestone(currentMileStoneText); } return(milestoneNames); }
/// <summary> /// Selects "Needs Additional Information" in the Status drop down, clicks on the user-specified milestone, /// enters user-specified text into the "Your Reply" text box, clicks Save, then goes back to the Dashboard /// </summary> /// <param name="milestoneName">The milestone name as it appears in the text of the HTML elementThe exact text of the milestone inside the milestone table</param> /// <param name="additionalInfoText">The text you want to enter for the requested or submitted additional infoThe text of your choice</param> public void SubmitAdditionalInfo(string milestoneName, string additionalInfoText) { StatusSelElem.SelectByText("Needs Additional Information"); this.WaitUntilAny(Criteria.DiplomaTraineePage.MilestonesTblMilestoneNameLinksEnabled); ElemSet.ScrollToElement(Browser, MilestonesInMilestonesTblLnks[0]); ElemSet.Grid_ClickButtonOrLinkWithinRow(Browser, MilestonesTbl, Bys.DiplomaTraineePage.MilestonesTblFirstRow, milestoneName, null, milestoneName); WaitForMilestoneFrame(); YourReplyTxt.SendKeys(additionalInfoText); this.WaitUntilAll(Criteria.DiplomaTraineePage.YourReplySaveChangesButtonVisible); ClickAndWait(YourReplySaveChangesBtn); ClickAndWait(ResubmitBtn); }
/// <summary> /// Clicks on each milestone, uploads a document, saves and completes the milestone, then submits the milestone to a user-specified clinical supervisor /// </summary> public List <string> CompleteAndSubmitAllMilestones(string clinicalSupervisorFullName) { string currentMileStoneText = ""; // Have to wait for the milestones to appear in the table first. Note that we cant use this Wait Criteria // our WaitForInitialize method because sometimes we login expecting there not to be any milestones this.WaitUntilAny(Criteria.DiplomaTraineePage.MilestonesTblMilestoneNameLinksEnabled); Thread.Sleep(0200); StatusSelElem.SelectByText("Not Started"); // Get all of the the milestone names first so we can then return them at the end of the method. Note that we have // to get the textContent property, not Selenium's Text property. This is because the text inside the HTML has 2 // spaces between the milestone number and the title. Selenium's text property only has 1 space List <string> milestoneNames = MilestonesInMilestonesTblLnks.Select(t => t.GetAttribute("textContent")).ToList(); // Get the count of all rows on the milestone table and then loop through them. int countOfRowsInMilestoneTable = MilestonesInMilestonesTblLnks.Count; for (int i = 0; i <= countOfRowsInMilestoneTable; i++) { if (MilestonesInMilestonesTblLnks.Count > 0) { // Store the text of the milestone that we are manipulating, so that we can use this text in the method CleanStaleMilestone // See description of that method for explanation of this issue currentMileStoneText = MilestonesInMilestonesTblLnks[0].Text; Thread.Sleep(0200); ClickAndWait(MilestonesInMilestonesTblLnks[0]); UploadFileForAllEvidenceRows(); AddDescriptionAndSubmitMilestone(clinicalSupervisorFullName); } else { break; } StatusSelElem.SelectByText("Not Started"); CleanStaleMilestone(currentMileStoneText); } return(milestoneNames); }
/// <summary> /// For all required milestones, this method clicks on each milestone, uploads a document, saves and completes the milestone, then submits the /// milestone to a clinical supervisor. This does not complete the milestones labeled as "optional". Note that for this method to work, you /// have to label your optional milestones as "optional" when creating your program in Lifetime Support /// </summary> public List <string> CompleteAndSubmitAllRequiredMilestones(string clinicalSupervisorFullName) { string currentMileStoneText = ""; // Have to wait for the milestones to appear in the table first. Note that we cant use this Wait Criteria on // our WaitForInitialize method because sometimes we login expecting there not to be any milestones this.WaitUntil(Criteria.DiplomaTraineePage.MilestonesTblMilestoneNameLinksEnabled); StatusSelElem.SelectByText("Not Started"); // Get all of the the milestone names first so we can then return them at the end of the method. Note that we have // to get the textContent property, not Selenium's Text property. This is because the text inside the HTML has 2 // spaces between the milestone number and the title. Selenium's text property only has 1 space List <string> milestoneNames = MilestonesInMilestonesTblLnks.Select(t => t.GetAttribute("textContent")).ToList(); // Get the count of all rows (except for the last one) on the milestone table and then loop through them int countOfRowsInMilestoneTable = MilestonesInMilestonesTblLnks.Count; for (int i = 0; i <= countOfRowsInMilestoneTable; i++) { StatusSelElem.SelectByText("Not Started"); if (RequiredMilestonesInMilestonesTblLnks.Count > 0) { currentMileStoneText = RequiredMilestonesInMilestonesTblLnks[0].Text; RequiredMilestonesInMilestonesTblLnks[0].Click(); WaitForMilestoneFrame(); UploadFileForAllEvidenceRows(); AddDescriptionAndSubmitMilestone(clinicalSupervisorFullName); } else { break; } } return(milestoneNames); }
/// <summary> /// Selecting a value from the Status dropdown, Entering text in the name text box and clicking search /// </summary> /// <param name="UserStatus">Select user status from dropdown</param> /// <param name="UserName">passing username</param> public void SearchForUserByStatusAndName(String UserStatus, String UserName) { Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(180), ElementCriteria.IsNotVisible); StatusSelElem.SelectByValue(UserStatus); SearchTxt.Clear(); SearchTxt.SendKeys(UserName); Browser.WaitForElement(Bys.AMAPage.SearchBtn, TimeSpan.FromSeconds(180), ElementCriteria.IsEnabled, ElementCriteria.IsVisible); try { Thread.Sleep(0500); SearchBtn.Click(); } catch (InvalidOperationException) { SearchTxt.SendKeys(Keys.Enter); SearchTxt.SendKeys(Keys.Enter); } // StatusSelElem.SelectByValue(UserStatus); Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible); }
/// <summary> /// Clicks the Review button for a user-specified Trainee, selects Under Review in the Status select element, /// clicks on the milestone links in the Milestone table, then marks the milestone /// as Achieved or Not Achieved, depending on the AllAchieved parameter /// </summary> /// <param name="traineeFullName">The trainee's first and last nameFirst and last name of the trainee</param> /// <param name="AllAchieved">If true, then mark all milestones as achieved, else mark all but 1 milestone as achieved</param> public void MarkAllMilestones(string traineeFullName, bool AllAchieved) { GoToTraineeDashboard(traineeFullName); StatusSelElem.SelectByText("Under Review"); int countOfRowsInMilestoneTable = MilestonesInMilestonesTblLnks.Count; string currentMileStoneText = ""; // loop through every row on the milestone table for (int i = 1; i <= countOfRowsInMilestoneTable; i++) { StatusSelElem.SelectByText("Under Review"); currentMileStoneText = MilestonesInMilestonesTblLnks[0].Text; ElemSet.ScrollToElement(Browser, MilestonesInMilestonesTblLnks[0]); MilestonesInMilestonesTblLnks[0].Click(); this.WaitUntilAll(Criteria.PERAssessorPage.MarkAsAchievedBtnVisible); if (AllAchieved == true) // Mark all milestones as achieved if set to true { ClickAndWait(MarkAsAchievedBtn); } else // Mark all milestones except for one as achieved. Mark the last one as not achieved { if (i < countOfRowsInMilestoneTable) // If we are not on the last row, mark as achieved. Else mark as not achieved { ClickAndWait(MarkAsAchievedBtn); } else { ClickAndWait(MarkAsNotAchievedBtn); } } } }