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 void DeleteTemplate(String templateName)
 {
     var checkbox = new Checkbox(By.XPath("//a[text()='" + templateName + "']/../../td[1]/input[@type='checkbox']"));
     checkbox.Checked = true;
     BtnDelete.Click();
     var alert = Web.PortalDriver.SwitchTo().Alert();
     alert.Accept();
     var link = new Link(By.LinkText(templateName));
     ClickPortalUI.Wait.Until(d => !link.Exists);
 }
 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 CreateNewTemplate(String templateName, String layout, String descr = "", bool useAsynchTabs = false, bool isDefault = false)
 {
     BtnNew.Click();
     var popup = new ProjectTypeCenterTemplatePropertiesPopup();
     popup.SwitchTo();
     popup.TxtName.Value = templateName;
     popup.TxtDescription.Value = descr;
     popup.SelLayout.SelectOption(layout);
     popup.ChkUseAsynchTabs.Checked = useAsynchTabs;
     popup.ChkIsDefault.Checked = isDefault;
     popup.BtnOk.Click();
     popup.SwitchBackToParent(WaitForPopupToClose.Yes);
     var link = new Link(By.LinkText(templateName));
     ClickPortalUI.Wait.Until(d => link.Exists);
 }
 /// <summary>
 /// Verify the first link the history log
 /// </summary>
 /// <param name="textLink"></param>
 /// <returns></returns>
 public bool VerifyFirstRowLink(string textLink)
 {
     HistoryTab.Click();
     //Link firstLink = new Link(By.XPath(".//tr[@data-drsv-row='0']/td[2]/span/a"));
     //Link firstLink = new Link(By.XPath("//a[text()='" + textLink + "']"));
     Link firstLink = new Link(By.XPath("//a[contains(text(),'" + textLink + "')]"));
     Wait.Until(h => firstLink.Exists);
     if (firstLink.Exists)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
 public void EditReviewerNoteInline(Int32 index, String newType, String newNote)
 {
     if (BtnExpandNotes.Exists) {
         BtnExpandNotes.Click();
         Wait.Until(d => BtnCollapseNotes.Exists);
     }
     // accept index starting at 0, xpath index start at 1, and the first row is the filter, so
     // add 2 to index argument
     var editLink = new Link(By.XPath("//*[@id='_webrRSV_DIV_0']/table/tbody/tr[" + (index + 2) + "]/td[2]/div[1]/strong/a"));
     editLink.Click();
     var inlineSelect =
         new Select(By.XPath("//*[@id='_webrRSV_DIV_0']/table/tbody/tr[" + (index + 2) + "]/td[2]/div[1]/div/select"));
     var inlineNoteText =
         new TextBox(By.XPath("//*[@id='_webrRSV_DIV_0']/table/tbody/tr[" + (index + 2) + "]/td[2]/div[3]/textarea"));
     inlineSelect.SelectOption(newType);
     inlineNoteText.Value = newNote;
     BtnInlineReviewerNoteOk.Click();
     Wait.Until(d => new Container(By.XPath("//div[text()='" + newNote + "']")).Exists);
 }
 public void EditReviewerNoteWithPopup(Int32 index, String newType, String newNote)
 {
     if (BtnExpandNotes.Exists) {
         BtnExpandNotes.Click();
         Wait.Until(d => BtnCollapseNotes.Exists);
     }
     // accept index starting at 0, xpath index start at 1, and the first row is the filter, so
     // add 2 to index argument
     var popupLink = new Link(By.XPath("//*[@id='_webrRSV_DIV_0']/table/tbody/tr[" + (index + 2) + "]/td[1]/a/img"));
     popupLink.Click();
     var popup = new ReviewerNotePopup(ReviewerNotePopup.PopupMode.Edit);
     popup.SwitchTo();
     popup.SelNoteType.SelectOption(newType);
     popup.TxtNote.Value = newNote;
     popup.BtnOk.Click();
     popup.SwitchBackToParent(WaitForPopupToClose.Yes);
     Thread.Sleep(1500);
     WaitForPageLoad();
 }
 public void OpenTemplateComponentsPopup(String templateName)
 {
     var link = new Link(By.XPath("//a[text()='" + templateName + "']/../../td[5]/nobr[1]/a"));
     link.Click();
 }
 public bool VerifyNotificationExists(string name)
 {
     var activityLink = new Link(By.LinkText(name));
     return activityLink.Exists;
 }
 public PersonEntity(string attribute)
     : base(attribute)
 {
     //This link shows up when typing the name in the text box, of the person that is not in the store
     LnkAddUser = new Link(By.LinkText("Add User"));
 }
        public void SetProperties(String templateName, String newTemplateName = null, String layout = null,
			String descr = null, bool? useAsynchTabs = null, bool? isDefault = null)
        {
            var link = new Link(By.XPath("//*[@id='_webrRSV_DIV_0']/table/tbody/tr/td/a[text()='" + templateName + "']"));
            link.Click();
            var popup = new ProjectTypeCenterTemplatePropertiesPopup();
            popup.SwitchTo();
            if (newTemplateName != null) popup.TxtName.Value = newTemplateName;
            if (descr != null) popup.TxtDescription.Value = descr;
            if (layout != null) popup.SelLayout.SelectOption(layout);
            if (useAsynchTabs != null) popup.ChkUseAsynchTabs.Checked = useAsynchTabs.Value;
            if (isDefault != null) popup.ChkIsDefault.Checked = isDefault.Value;
            popup.BtnOk.Click();
            popup.SwitchBackToParent(WaitForPopupToClose.Yes);
            var newLink = new Link(By.LinkText(newTemplateName ?? templateName));
            ClickPortalUI.Wait.Until(d => newLink.Exists);
        }
 public void ModifyStateName(String stateToModify, String newStateName)
 {
     var stateNoteLink = new Link(By.LinkText(stateToModify));
     stateNoteLink.Click();
     var popup = new ProjectStateForm();
     popup.SwitchTo();
     popup.TxtName.Value = newStateName;
     popup.BtnOk.Click();
     popup.SwitchBackToParent(WaitForPopupToClose.Yes);
 }
 /// <summary>
 /// Enter a validation script for a project type view.
 /// </summary>
 public void SetValidationScript(string viewName, string validationScript)
 {
     Trace.WriteLine(String.Format("Creating a validation script for '{0}'", viewName));
     var scriptButton = new Link(By.XPath("//a[text()='" + viewName + "']/../..//td[6]/a/img"));
     scriptButton.Click();
     var popup = new WorkflowScriptEditor();
     popup.SwitchTo();
     popup.TxtScript.Value = validationScript;
     popup.BtnOk.Click();
     popup.SwitchBackToParent();
 }
 public void OpenView(string viewName)
 {
     var link = new Link(By.LinkText(viewName));
     link.Click();
 }
 public void ModifyActivityGroupName(string origName, string newName)
 {
     var targetLink = new Link(By.LinkText(origName));
     targetLink.Click();
     var popup = new ActivityGroupEditor();
     popup.SwitchTo();
     popup.TxtGroupName.Value = newName;
     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 IEnumerable<String> GetBranchCriteria(String stepName, string targetStepName)
 {
     var lnkBranchCriteria = new Link(
         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 +
                  "']/../../td[1]/a"));
     var parentWindow = CurrentWindowTitle;
     var popup = new BranchCriteriaPopup();
     lnkBranchCriteria.Click();
     PopUpWindow.SwitchTo(popup.Title);
     Thread.Sleep(1500);
     var result = popup.SelCriteriaBox.GetOptionsText();
     PopUpWindow.SwitchTo(parentWindow);
     return result;
 }
        public void EditStep(String name, String newName = null, String viewName = null, String defaultNextStep = null,
			Double? displayOrder = null, Boolean? showInJumpTo = null, Boolean? showInPrinting = null)
        {
            var parentWindow = CurrentWindowTitle;
            var lnkStep = new Link(By.LinkText(name));
            lnkStep.Click();
            var stepPopup = new NewStepPopup();
            PopUpWindow.SwitchTo("SmartForm Step");
            if (newName != null) stepPopup.TxtName.Value = newName;
            if (viewName != null) {
                stepPopup.BtnSelectView.Click();
                PopUpWindow.SwitchTo("Select View");
                ViewChooserPopup.SelectView(viewName);
                ViewChooserPopup.BtnOk.Click();
                PopUpWindow.SwitchTo("SmartForm Step");
            }
            if (defaultNextStep != null) stepPopup.SelDefaultNextStep.SelectOption(defaultNextStep);
            if (displayOrder != null) stepPopup.TxtDisplayOrder.Value = Convert.ToString(displayOrder, CultureInfo.InvariantCulture);
            if (showInJumpTo != null) stepPopup.ChkShowInJumpTo.Checked = showInJumpTo.Value;
            if (showInPrinting != null) stepPopup.ChkShowInPrinting.Checked = showInPrinting.Value;
            stepPopup.BtnOk.Click();
            PopUpWindow.SwitchTo(parentWindow);
            Wait.Until(d => new Link(By.LinkText(newName)).Exists);
        }
 public void AddBranchCriteria(String stepName, string targetStepName, string propertyName, string criteriaValue)
 {
     var lnkBranchCriteria = new Link(
         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 +
                  "']/../../td[1]/a"));
     var parentWindow = CurrentWindowTitle;
     var popup = new BranchCriteriaPopup();
     lnkBranchCriteria.Click();
     PopUpWindow.SwitchTo(popup.Title);
     popup.AddBranchCriterion(propertyName, criteriaValue);
     PopUpWindow.SwitchTo(parentWindow);
     Wait.Until(d => !PopUpWindow.IsOpen(popup.Title));
     Thread.Sleep(1500);
     WaitForPageLoad();
 }
        public void EditSection(String sectionName, String newSectionName, String description = null,
			Boolean? showInJumpTo = null, IEnumerable<String> stepNames = null)
        {
            var sectionLink = new Link(By.LinkText(sectionName));
            sectionLink.Click();
            var popup = new SmartFormSectionPropertiesPopup();
            popup.SwitchTo();
            if (newSectionName != null) popup.TxtName.Value = newSectionName;
            if (!String.IsNullOrWhiteSpace(description)) popup.TxtDescription.Value = description;
            if (showInJumpTo != null) popup.ChkShowInJumpTo.Checked = showInJumpTo.Value;
            if (stepNames != null) {
                // clear existing list of steps
                var form = new Container(By.Id("_webrRSV_DIV_0"));
                var checkboxes = form.GetDescendants(".//table/tbody/tr/td[1]/input[@type='checkbox']");
                foreach (var checkbox in checkboxes) {
                    checkbox.SetCheckBox(false);
                }

                // setup new list of steps
                foreach (var chkBox in stepNames.Select(step => new Checkbox(By.XPath("//span[text()='" + step + "']/../../td[1]/input[@type='checkbox']")))) {
                    chkBox.Checked = true;
                }
            }
            popup.BtnOk.Click();
            popup.SwitchBackToParent(WaitForPopupToClose.Yes);
            Thread.Sleep(1500);
            WaitForPageLoad(5000);
        }
 /// <summary>
 /// Verifies that a view exists.
 /// </summary>
 public bool VerifyViewExists(string name)
 {
     var link = new Link(By.LinkText(name));
     var returnValue = link.Exists;
     Trace.WriteLine(String.Format("View '{0}' exists? {1}", name, returnValue));
     return returnValue;
 }
 public bool ProjectTypeExists(string projName)
 {
     var ele = new Link(By.PartialLinkText(projName));
     return ele.Exists;
 }
 // the sort indicators make it slightly harder to find the header links, so
 // we have to grab them in a round-about way
 public static void SortColumn(this IDynamicResultSetView component, UInt16 columnIdx)
 {
     var displayName = ((RoomComponent) component).DisplayName;
     //var prefix = "//div[@data-display-name= '" + displayName + "']";
     var prefix = "//span[text()='" + WebUtility.HtmlEncode(displayName) + "']";
     //var path = prefix + "/../../../../../table[2]//table[contains(@id,'_filterTable')]//div[contains(@id, 'component') and not(contains(@id, '_paging'))]/table/tbody/tr[1]/td[" + (columnIdx + 1) + "]/a";
     var path = prefix + "/../../../../../table[2]//div[contains(@id, 'component')]/table/tbody/tr[1]/td[" + (columnIdx + 1) + "]/a";
     var link = new Link(By.XPath(path));
     link.Click();
     Wait.Until(d => component.TxtPage.Enabled);
 }
        /// <summary>
        /// Get a data structure holding page elements for the row, indexing starts at 1
        /// </summary>
        /// <param name="rowIndex">Starts at 1</param>
        /// <param name="getLastRow">Set to true to get the bottom row</param>
        public StateTransitionTableRowValues(int rowIndex = -1, bool getLastRow = false)
        {
            var xpath = rowIndex > 0 && !getLastRow
                ? "//*[@id='_webrRSV_DIV_0']/table/tbody/tr[" + rowIndex + "]"
                : "//*[@id='_webrRSV_DIV_0']/table/tbody/tr[last()]";

            ChkBox = new Checkbox(By.XPath(xpath + "/td[1]/input[@type='checkbox']"));
            LnkCurrentState = new Link(By.XPath(xpath + "/td[4]/a"));
            LnkNextState = new Link(By.XPath(xpath + "/td[5]/a"));
            LnkActivityCriteria = new Link(By.XPath(xpath + "/td[6]/a[1]"));
            LnkPropertiesCriteria = new Link(By.XPath(xpath + "/td[6]/a[2]"));
            LnkScriptCriteria = new Link(By.XPath(xpath + "/td[6]/a[3]"));
            LnkPreProcessingScript = new Link(By.XPath(xpath + "/td[8]/a[1]"));
            LnkChangeProperties = new Link(By.XPath(xpath + "/td[8]/a[2]"));
            LnkNotifications = new Link(By.XPath(xpath + "/td[8]/a[3]"));
            LnkPostProcessingScript = new Link(By.XPath(xpath + "/td[8]/a[4]"));

            CurrentState = LnkCurrentState.Text;
            NextState = LnkNextState.Text;

            var incrementActionText = new Container(By.XPath(xpath + "/td[9]/span")).Text;
            if (incrementActionText == "None") VersionIncrementAction = StateTransitionVersionIncrementAction.None;
            if (incrementActionText == "Minor") VersionIncrementAction = StateTransitionVersionIncrementAction.Minor;
            if (incrementActionText == "Major") VersionIncrementAction = StateTransitionVersionIncrementAction.Major;

            var priorityText = new Container(By.XPath(xpath + "/td[10]/span")).Text;
            Priority = Convert.ToDouble(priorityText);
        }
 public void OpenBackgroundOperationDetails(String name)
 {
     var link = new Link(By.PartialLinkText(name));
     link.Click();
 }
 public void ModifyViewName(string viewToModify, string newViewName)
 {
     // click on hyperlink (if null), bail on test
     var reviewNoteLink = new Link(By.LinkText(viewToModify));
     if (reviewNoteLink == null) {
         throw new Exception(String.Format("Cannot select reviewerNote {0} because it is not displayed or exists.",
                 viewToModify));
     }
     reviewNoteLink.Click();
     var popup = new EntityViewEditorPopup();
     popup.SwitchTo();
     Trace.WriteLine(String.Format("Modifying View name to: {0}", newViewName));
     popup.TxtDisplayName.Value = newViewName;
     popup.BtnOk.Click();
     popup.SwitchBackToParent();
 }
 /// <summary>
 /// Use this to find if a person exists in displayed search results
 /// TODO 
 /// </summary>
 /// <param name="lastName"></param>
 /// <returns></returns>
 public bool PersonExists(string lastName)
 {
     Web.PortalDriver.SwitchTo().Frame("ifrmResults");
     Link result = new Link(By.PartialLinkText(lastName));
     return result.Exists;
 }
 public OrganizationEntity(string attribute)
     : base(attribute)
 {
     //This link shows up when typing the name in the text box, of the organization that is not in the store
     LnkAddOrganization = new Link(By.LinkText("Add Organization"));
 }