public void SelectProperty(string name, Button openPopupWithThis)
        {
            var parentWindow = Web.PortalDriver.Title;
            Wait.Until(d => openPopupWithThis.Exists);
            openPopupWithThis.AsyncClick();
            Thread.Sleep(2000);
            PopUpWindow.SwitchTo(Title);

            // Switch to the frame within this popup dialog
            Web.PortalDriver.SwitchTo()
                .Frame(Web.PortalDriver.FindElement(By.Id("ifrmAttributeTable")));
            Wait.Until(d => new Container(By.Id("spanAttributeName")).Exists);

            var parsedName = name.Split('.');
            var path = new String[parsedName.Length - 1];
            Array.Copy(parsedName, path, parsedName.Length - 1);
            var propertyName = parsedName.Last();

            foreach (var expander in path.Select(attr => new Button(By.XPath(String.Format("//*[@id='spanAttributeName' and text()='{0}']/../../td[1]/a", attr))))) {
                expander.Click();
            }

            var property = new Container(By.XPath(String.Format("//*[@id='spanAttributeName' and text()='{0}']", propertyName)));
            property.Click();

            // Switch back out of frame
            PopUpWindow.SwitchTo(Title);
            OkButton.Click();
            PopUpWindow.SwitchTo(parentWindow);
        }
 public SelectionCdtEntity(string attribute)
 {
     Attribute = attribute;
     BtnSelect = new Button(By.XPath(XpathPrefix + "//input[@value='Select...']"));
     BtnClear = new Button(By.XPath(XpathPrefix + "//input[@value='Clear']"));
     LnkCdtEntLink = new Link(By.XPath(XpathPrefix + "//a"));
     TxtCdtEntInput = new TextBox(By.XPath(XpathPrefix + "//input[contains(@id, '_chooser')]"));
 }
 public CommandWindow()
 {
     SelScript = new Select(By.CssSelector("#selectScript"));
     TxtScriptName = new TextBox(By.CssSelector("#CommandScript\\2e name"));
     TxtScript = new TextBox(By.CssSelector("#CommandScript\\2e script"));
     BtnNew = new Button(By.CssSelector("#New"));
     BtnRun = new Button(By.CssSelector("#Run"));
     BtnSave = new Button(By.CssSelector("#Save"));
     BtnDelete = new Button(By.CssSelector("#Delete"));
     TxtResult = new TextBox(By.CssSelector("#OutputScript"));
 }
 public void AddNotification(string activityName, string toProperty, string subjectLine)
 {
     Trace.WriteLine(String.Format("Attempting to add notification with ToProperty: {0} to activity: {1} with subjectLine: '{2}'", toProperty, activityName, subjectLine));
     var imageLink = new Button(By.XPath("//a[text()='" + activityName + "']/../../td[7]/table/tbody/tr/td/a[3]/img[1]"));
     imageLink.Click();
     var popup = new ActivityNotificationPopup();
     popup.SwitchTo();
     popup.AddNotification(toProperty, subjectLine);
     popup.BtnOk.Click();
     popup.SwitchBackToParent();
 }
 /// <summary>
 /// Simply adds a property with '=' criteria and value
 /// </summary>
 public void AddChangeProperty(string activityName, string property, string value)
 {
     Trace.WriteLine(String.Format("Adding property: {0} to activity: {1} with value: '{2}'", property, activityName, value));
     var imageLink = new Button(By.XPath("//a[text()='" + activityName + "']/../../td[7]/table/tbody/tr/td/a[2]/img"));
     imageLink.Click();
     var popup = new ChangeProperties();
     popup.SwitchTo();
     popup.AddChangeProperties(property, value);
     popup.SwitchBackToParent();
     Thread.Sleep(1500);
     WaitForPageLoad();
 }
 public void EditNoteInPopup(Int32 index, String noteType, String newText)
 {
     var btnOpenPopup = new Button(By.XPath(XpathPrefix + "//tr[@data-drsv-row='" + index + "']//img[contains(@src, 'ReviewNote.gif')]"));
     var popup = new ReviewerNotePopup(ReviewerNotePopup.PopupMode.Edit);
     btnOpenPopup.Click();
     popup.SwitchTo();
     popup.SelNoteType.SelectOption(noteType);
     popup.TxtNote.Value = newText;
     popup.BtnOk.Click();
     popup.SwitchBackToParent();
     Wait.Until(d => new Container(By.XPath("//div[contains(text(), '" + newText + "')]")).Displayed);
 }
 public void EditNoteInline(Int32 index, String noteType, String newText)
 {
     var lnkTitle = new Link(By.XPath(XpathPrefix + "//tr[@data-drsv-row='" + index + "']//a[contains(@class, 'ReviewTitle')]"));
     lnkTitle.Click();
     var noteArea = new TextBox(By.XPath(XpathPrefix + "//tr[@data-drsv-row='" + index + "']//textArea"));
     var btnEditOk = new Button(By.XPath(XpathPrefix + "//tr[@data-drsv-row='" + index + "']//input[@value = 'OK']"));
     var selType = new Select(By.XPath(XpathPrefix + "//tr[@data-drsv-row='" + index + "']//select"));
     Wait.Until(d => noteArea.Displayed);
     selType.SelectOption(noteType);
     noteArea.Value = newText;
     btnEditOk.Click();
     Wait.Until(d => new Container(By.XPath("//div[contains(text(), '" + newText + "')]")).Displayed);
 }
 public void ModifyEntityName(string entityName, string newName)
 {
     Trace.WriteLine(String.Format("Modifying data entity for CDT called '{0}'", entityName));
     var dataTypeCenterWindow = CurrentWindowTitle;
     var match = Regex.Match(dataTypeCenterWindow, @"Data Type \((.*)\)");
     if (!match.Success) throw new Exception("Unable to determine data type");
     var dataTypeName = match.Groups[1].Value;
     var targetImage = new Button(By.XPath("//td[text()='" + entityName + "']/../td[2]/a"));
     targetImage.Click();
     PopUpWindow.SwitchTo("Edit " + dataTypeName);
     EntityDataPopup.SetDisplayString(newName);
     EntityDataPopup.BtnOk.Click();
     PopUpWindow.SwitchTo(dataTypeCenterWindow);
 }
 public void CopyBranching(String sourceStepName, string targetStepName, String copyType = "all", Boolean eraseAll = false)
 {
     var btnAddBranch = new Button(
         By.XPath("(//*[@id='_webrRSV_DIV_0']/table/tbody/tr/td[3]/a[text()='" + sourceStepName +
                  "'])[1]/../../td[6]/input[@value='Copy Branches']"));
     btnAddBranch.Click();
     var popup = new CopyBranchesPopup();
     popup.SwitchTo();
     var chkTarget = new Checkbox(By.XPath("//span[text()='" + targetStepName + "']/../../td[1]/input[@type='checkbox']"));
     chkTarget.Click();
     var rdoCopyType = copyType == "smart" ? popup.RdoSmartCopy : popup.RdoAllBranches;
     rdoCopyType.Click();
     popup.ChkEraseExisting.Checked = eraseAll;
     popup.BtnOk.Click();
     popup.SwitchBackToParent(WaitForPopupToClose.Yes);
     Thread.Sleep(1500);
     WaitForPageLoad(5000);
 }
 public void AddBranch(String stepName, String targetStepName)
 {
     var btnAddBranch = new Button(
         By.XPath("(//*[@id='_webrRSV_DIV_0']/table/tbody/tr/td[3]/a[text()='" + stepName +
                  "'])[1]/../../td[6]/input[@value='Add Branch']"));
     var parentWindow = CurrentWindowTitle;
     btnAddBranch.Click();
     PopUpWindow.SwitchTo("Edit SmartForm Branch");
     var selNextStep = new Select(By.Name("WizardBranch.nextPage"));
     selNextStep.SelectOption(targetStepName);
     var btnOk = new Button(By.CssSelector("input[value='OK']"));
     btnOk.Click();
     PopUpWindow.SwitchTo(parentWindow);
     var spanExpected = new Container(
         By.XPath("(//*[@id='_webrRSV_DIV_0']/table/tbody/tr/td[3]/a[text()='" + stepName + "" +
                  "'])[1]/../../td[4]/table/tbody/tr/td/table/tbody/tr/td[2]/span[text()='" + targetStepName + "']"));
     Wait.Until(d => spanExpected.Exists);
 }
 /// <summary>
 /// Validates the contents of the validation script.  Assumes you are on the Views tab.
 /// </summary>
 public bool VerifyValidationScriptExists(string viewName, string validationScript)
 {
     Trace.WriteLine(String.Format("Validating validation script window contains script:  '{0}'", validationScript));
     var scriptButton = new Button(By.XPath("//a[text()='" + viewName + "']/../..//td[6]/a/img"));
     scriptButton.Click();
     var popup = new WorkflowScriptEditor();
     popup.SwitchTo();
     var value = popup.TxtScript.Value;
     var returnValue = value == validationScript;
     popup.BtnCancel.Click();
     popup.SwitchBackToParent();
     return returnValue;
 }
 /// <summary>
 /// Simply verifies that the property appears in selection criteria field
 /// </summary>
 public bool VerifyProperty(string activityName, string property)
 {
     var returnValue = false;
     var imageLink = new Button(By.XPath("//a[text()='" + activityName + "']/../../td[7]/table/tbody/tr/td/a[2]/img"));
     imageLink.Click();
     var popup = new ChangeProperties();
     popup.SwitchTo();
     if (popup.SelCriteriaBox.Contains(property)) {
         Trace.WriteLine(String.Format("Verified change property: {0} within activity: {1}", property,
             activityName));
         returnValue = true;
     } else {
         Trace.WriteLine(String.Format("Change property: {0} within activity: {1} could not be found.", property,
             activityName));
     }
     popup.SwitchBackToParent();
     return returnValue;
 }
 /// <summary>
 /// Validates the contents of the pre-script editor.  Assumes you are on the Activity tab.
 /// </summary>
 public bool VerifyPreScriptExists(string activityName, string validationScript)
 {
     var returnValue = false;
     Trace.WriteLine(String.Format("Validating workflow script window contains script:  '{0}'", validationScript));
     var imageLink = new Button(By.XPath("//a[text()='" + activityName + "']/../../td[7]/table/tbody/tr/td/a[1]/img"));
     imageLink.Click();
     var popup = new WorkflowScriptEditor();
     popup.SwitchTo();
     if (popup.TxtScript.Value == validationScript) {
         returnValue = true;
     }
     popup.BtnOk.Click();
     popup.SwitchBackToParent();
     return returnValue;
 }
 public bool VerifyActivityEntityViewName(string activityName, string displayName)
 {
     Trace.WriteLine(String.Format("For activity:  '{0}', verifying the display name:  '{1}' in entity view editor", activityName, displayName));
     var parentWindow = GetTitle();
     var imageLink = new Button(By.XPath("//a[text()='" + activityName + "']/../../td[9]/a[1]/img"));
     imageLink.Click();
     var popup = new EntityViewEditorPopup();
     popup.SwitchTo();
     var returnValue = popup.TxtDisplayName.Value == displayName;
     popup.BtnOk.Click();
     PopUpWindow.SwitchTo(parentWindow);
     return returnValue;
 }
 public void EditActivityViewEditorName(string activityName, string entityViewName)
 {
     Trace.WriteLine(String.Format("Attempting to edit the entity view name of activity: {0} with display name: '{1}'", activityName, entityViewName));
     var imageLink = new Button(By.XPath("//a[text()='" + activityName + "']/../../td[9]/a[1]/img"));
     imageLink.Click();
     var popup = new EntityViewEditorPopup();
     popup.SwitchTo();
     popup.TxtDisplayName.Value = entityViewName;
     popup.BtnOk.Click();
     popup.SwitchBackToParent();
 }
 /// <summary>
 /// Enter a post-script for post processing with an activity
 /// </summary>
 public void AddPostScriptPostProcessing(string activityName, string script)
 {
     Trace.WriteLine(String.Format("Creating a post-script for post processing with '{0}'", activityName));
     var imageLink = new Button(By.XPath("//a[text()='" + activityName + "']/../../td[7]/table/tbody/tr/td/a[4]/img"));
     imageLink.Click();
     var popup = new WorkflowScriptEditor();
     popup.SwitchTo();
     popup.TxtScript.Value = script;
     popup.BtnOk.Click();
     popup.SwitchBackToParent();
 }
 public void RespondInline(Int32 index, String responseType, String response)
 {
     var lnkRespond = new Link(By.XPath(XpathPrefix + "//tr[@data-drsv-row='" + index + "']//a[contains(@id, 'CreateResponse')]"));
     lnkRespond.Click();
     var txtResponse = new TextBox(By.XPath(XpathPrefix + "//tr[@data-drsv-row='" + index + "']//div[@class='ResponseNote']//textarea"));
     var btnRespondOk = new Button(By.XPath(XpathPrefix + "//tr[@data-drsv-row='" + index + "']//div[@class='ResponseNote']//input[@value = 'OK']"));
     var selType = new Select(By.XPath(XpathPrefix + "//tr[@data-drsv-row='" + index + "']//div[@class='ResponseTitle']//select"));
     Wait.Until(d => txtResponse.Displayed);
     selType.SelectOption(responseType);
     txtResponse.Value = response;
     btnRespondOk.Click();
     Wait.Until(d => new Container(By.XPath("//div[contains(text(), '" + response + "')]")).Displayed);
 }
 public DataTypeCenter()
 {
     BtnDelete = new Button(By.CssSelector("input[value='Delete']"));
     BtnNew = new Button(By.CssSelector("input[value='New']"));
     Table = new Container(By.XPath("html/body/table[4]/tbody/tr[2]/td/form/table[2]"));
 }