/// <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); }
public virtual List <CodeMemberMethod> GenerateMethods(Activity activity, Dictionary <string, string> variables) { var activityMethod = new CodeMemberMethod { Attributes = MemberAttributes.Private | MemberAttributes.Final, Name = VariableHelper.ToClassName(activity.Name) + "Call" }; var dependantVariables = new XpathUtils().GetVariableNames(activity.InputBindings); foreach (var variable in dependantVariables) { if (variables.ContainsKey(variable)) { activityMethod.Parameters.Add(new CodeParameterDeclarationExpression(variables[variable], VariableHelper.ToVariableName(variable))); } } activityMethod.ReturnType = new CodeTypeReference(this.GetReturnType(activity)); var invocationLogCodeCollection = new CodeStatementCollection(); invocationLogCodeCollection.AddRange(LogActivity(activity)); activityMethod.Statements.AddRange(invocationLogCodeCollection); return(new List <CodeMemberMethod> { activityMethod }); }
/// <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); }
public void Should_Return_complex_remove_all_Local_Variable_from_List_when_InputBinding_contains_a_xpath_formula_contains_local_var() { var xml = @"<pd:inputBindings xmlns:pd=""http://xmlns.tibco.com/bw/process/2003"" xmlns:xsl=""http://w3.org/1999/XSL/Transform""> <inputs> <xsl:variable name=""params""> <xsl:for-each select=""$Start/pfx3:logInfo/param""> <xsl:if test=""name !='xml'""> <xsl:value-of select=""concat(' [', name, '=', value, ']')""/> </xsl:if> </xsl:for-each> <xsl:if test=""exists($Start/pfx3:logInfo/param[name='xml'])""> <xsl:value-of select=""concat('
	', translate($Start/pfx3:logInfo/param[name='xml']/value, '
', ''))""/> </xsl:if> </xsl:variable> <Interface> <xsl:value-of select=""Start/pfx3:logInfo/GetProcessInstanceInfo[1]/ProcessStarterName""/> </Interface> </inputs> </pd:inputBindings> "; XElement doc = XElement.Parse(xml); var inputBindings = doc.Nodes(); var variableNames = new XpathUtils().GetVariableNames(inputBindings); Assert.AreEqual(1, variableNames.Count); Assert.AreEqual("start_logInfo", variableNames.FirstOrDefault()); }
public virtual CodeStatementCollection GenerateInvocationCode(Activity activity, Dictionary <string, string> variables) { var existingParamaters = new XpathUtils().GetVariableNames(activity.InputBindings); for (int i = 0; i < existingParamaters.Count; i++) { existingParamaters[i] = VariableHelper.ToVariableName(existingParamaters[i]); } var parameters = GenerateParameters(existingParamaters, null); var invocationCodeCollection = new CodeStatementCollection(); var returnType = this.GetReturnType(activity); if (!returnType.Equals(CSharpTypeConstant.SystemVoid)) { var codeInvocation = new CodeVariableDeclarationStatement( new CodeTypeReference(returnType), this.GetReturnVariableName(activity), new CodeMethodInvokeExpression(new CodeThisReferenceExpression(), this.GetMethodName(activity), parameters)); invocationCodeCollection.Add(codeInvocation); } else { var codeInvocation = new CodeMethodInvokeExpression(new CodeThisReferenceExpression(), this.GetMethodName(activity), parameters); invocationCodeCollection.Add(codeInvocation); } return(invocationCodeCollection); }
/// <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 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); }
public void XpathSelectByMultipleClassesTest() { // we expect the following result: // /div[contains(@class,'atag') and contains(@class ,'btag')] string[] classes = new[] { "atag", "btag" }; string result = XpathUtils.XpathSelectByMultipleClasses("/div", classes); Assert.AreEqual("/div[contains(@class,'atag') and contains(@class ,'btag')]", result); }
/// <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); }
public void Should_Return_all_Local_Variable_from_List_when_InputBinding_contains_a_xpath_formula_contains_local_var() { var xml = @"<pd:inputBindings xmlns:pd=""http://xmlns.tibco.com/bw/process/2003"" xmlns:xsl=""http://w3.org/1999/XSL/Transform""> <Log> <xsl:variable name=""messageBody"" select=""tib:render-xml($Start/pfx3:logInfo, true(), true())""/> <Message> <xsl:value-of select=""concat($Start/pfx3:logInfo, true(), $params,' ')""/> </Message> </Log> </pd:inputBindings> "; XElement doc = XElement.Parse(xml); var inputBindings = doc.Nodes(); var variableNames = new XpathUtils().GetAllLocalVariables(inputBindings); Assert.AreEqual(1, variableNames.Count); Assert.AreEqual("messageBody", variableNames.FirstOrDefault()); }
/// <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); }