public void SpecifyResearchTypes(params TypeOfResearch[] researchTypes)
        {
            string name = "";
            foreach (var type in researchTypes)
            {
                switch (type)
                {
                    case TypeOfResearch.BiomedicalClinical:
                    {
                        name = "Biomedical";
                        break;
                    }
                    case TypeOfResearch.SocialBehavioralEducation:
                    {
                        name = "Social";
                        break;
                    }
                    case TypeOfResearch.Other:
                    {
                        name = "Other";
                        break;
                    }
                }
                var chkbox = new Checkbox(By.XPath(".//td[contains(.,'" + name + "')]/../td/table/tbody/tr/td/input[1]"));
                chkbox.Click();
                Trace.WriteLine("Checking option: " + type);

            }
        }
 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);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="option"></param>
 public void SelectDetermination(Determinations value)
 {
     string name = "";
     switch (value)
     {
         case Determinations.UnanticipatedProblem: { name = "Unanticipated problem involving risks to subjects or others"; break; }
         case Determinations.SuspensionOrTermination: { name = "Suspension or termination of IRB approval"; break; }
         case Determinations.SeriousNonCompliance: { name = "Serious non-compliance"; break; }
         case Determinations.ContinuingNonCompliance: { name = "Continuing non-compliance"; break; }
         case Determinations.NonComplianceNotSerious: { name = "Non-compliance that is neither serious nor continuing"; break; }
         case Determinations.AllegationOfNonCompliance: { name = "Allegation of non-compliance with no basis in fact"; break; }
         case Determinations.NoneOfTheAbove: { name = "None of the above"; break; }
         case Determinations.AdditionalReviewRequired: { name = "Additional review required"; break; }
     }
     var chkbox = new Checkbox(By.XPath(".//td[text()='" + name + "']/../td/table/tbody/tr/td/input[1]"));
     chkbox.Click();
     Trace.WriteLine("Checking option: " + value);
 }
        public void SelectRoles(params Roles[] roles)
        {
            string name = "";

            foreach (var role in roles)
            {
                switch (role)
                {
                    case Roles.CoInvestigator:
                    {
                        name = "Co-investigator";
                        break;
                    }
                    case Roles.DataAnalyst:
                    {
                        name = "Data Analyst";
                        break;
                    }
                    case Roles.ResearchAssistant:
                    {
                        name = "Research Assistant";
                        break;
                    }
                    case Roles.Statistician:
                    {
                        name = "Statistician";
                        break;
                    }
                    case Roles.LayObserver:
                    {
                        name = "Lay Observer";
                        break;
                    }
                }
                var chkbox = new Checkbox(By.XPath(".//td[contains(.,'" + name + "')]/../td/table/tbody/tr/td/input[1]"));
                chkbox.Click();
                Trace.WriteLine("Checking option: " + role);
            }
        }
        /// <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 DeleteBackgroundOperation(String name)
 {
     var checkbox = new Checkbox(By.XPath("//a[text()='" + name + "']/../../td[1]/input"));
     checkbox.Click();
     BtnDelete.Click();
 }
 public void DeleteStep(String name)
 {
     var chkStep = new Checkbox(
         By.XPath("(//*[@id='_webrRSV_DIV_0']/table/tbody/tr/td[3]/a[text()='" + name +
                  "'])[1]/../../td[1]/input[@type='checkbox']"));
     chkStep.Checked = true;
     BtnDelete.Click();
     Web.PortalDriver.SwitchTo().Alert().Accept();
     Wait.Until(d => !new Link(By.LinkText(name)).Exists);
 }
 public void ChooseModificationScope(Scope scope)
 {
     string name = "";
     if (scope == Scope.OtherPartsOfTheStudy)
     {
         name = "Other parts of the study";
     }
     if (scope == Scope.StudyTeamMemberInformation)
     {
         name = "Study team member information";
     }
     Checkbox scopePurpose = new Checkbox(By.XPath(".//td[text()='" + name + "']/../td[1]/table/tbody/tr/td/input[1]"));
     scopePurpose.Click();
 }
 public void DeleteSection(String sectionName)
 {
     var checkbox = new Checkbox(By.XPath("//a[text()='" + sectionName + "']/../../td[1]/input[@type='checkbox']"));
     checkbox.Checked = true;
     BtnDelete.Click();
     var alert = Web.PortalDriver.SwitchTo().Alert();
     alert.Accept();
     Wait.Until(d => !new Link(By.LinkText(sectionName)).Exists);
 }
        public void CreateSection(String sectionName, String description = null, Boolean showInJumpTo = false,
			IEnumerable<String> stepNames = null)
        {
            BtnNew.Click();
            var popup = new SmartFormSectionPropertiesPopup();
            popup.SwitchTo();
            popup.TxtName.Value = sectionName;
            if (!String.IsNullOrWhiteSpace(description))
                popup.TxtDescription.Value = description;
            popup.ChkShowInJumpTo.Checked = showInJumpTo;
            if (stepNames != null) {
                foreach (var step in stepNames) {
                    var chkBox = 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>
 /// Checks the checkbox associated with chooser row
 /// </summary>
 public void SelectChooser(string chooserName)
 {
     var tdCheckBox = new Checkbox(By.XPath("//a[text()='" + chooserName + "']/../../td[1]/input[@type='checkbox']"));
     tdCheckBox.Checked = true;
 }
        public void CreateActivityGroup(string name, string[] activities)
        {
            BtnNew.Click();
            var popup = new ActivityGroupEditor();
            popup.SwitchTo();

            popup.TxtGroupName.Value = name;

            foreach (var activity in activities) {
                var targetCheckBox = new Checkbox(By.XPath("//span[contains(.,'" + activity + "')]/../../td[1]/input[@type='checkbox']"));
                popup.BtnClear.Click();
                popup.SelFilterAttribute.SelectOption("Activity Name");
                popup.TxtFilterValue.Value = activity;
                popup.BtnGo.Click();
                Wait.Until(d => targetCheckBox.Exists);
                targetCheckBox.Checked = true;
            }
            popup.BtnOk.Click();
            popup.SwitchBackToParent();
        }
 public void CheckActivityRowCheckBox(string activityName)
 {
     var targetCheckBox = new Checkbox(By.XPath("//a[text() = '" + activityName + "']/../../td[1]/input[@type='checkbox']"));
     targetCheckBox.Checked = true;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="option"></param>
 public void ChooseResearchMilestone(params MileStones[] value)
 {
     string name = "";
     foreach (var milestone in value)
     {
         switch (milestone)
         {
             case MileStones.StudyPermanentlyClosedToEnrollment:
             {
                 name = "Study is permanently closed to enrollment OR was never open for enrollment";
                 break;
             }
             case MileStones.AllSubjectCompletedStudyRelatedInterventions:
             {
     //                        name = @"
     //	                    All subjects have completed all study-related interventions OR not applicable (e.g. study did not include interventions, no subjects were enrolled)";
                 name = @"All subjects have completed";
                 break;
             }
             case MileStones.CollectionOfPrivateInfoComplete:
             {
                 //name =
                 //    @"Collection of private identifiable information is complete OR not applicable (no subjects were enrolled)";
                 name = @"Collection of private";
                 break;
             }
             case MileStones.AnalysisOfPrivateInfoComplete:
             {
                 //name =
                 //    @"Analysis of private identifiable information is complete OR not applicable (no subjects were enrolled)";
                 name = @"Analysis of private";
                 break;
             }
             case MileStones.RemainingStudyActivitiesLimited:
             {
                 name = @"Remaining study activities are limited to data analysis";
                 break;
             }
             case MileStones.StudyRemainsActive:
             {
                 name = @"Study remains active only for long-term follow-up of subjects";
                 break;
             }
         }
         //var chkbox = new Checkbox(By.XPath(".//td[text()='" + name + "']/../td/table/tbody/tr/td/input[1]"));
         var chkbox = new Checkbox(By.XPath(".//td[contains(.,'" + name + "')]/../td/table/tbody/tr/td/input[1]"));
         chkbox.Click();
         Trace.WriteLine("Checking option: " + value);
     }
 }
 /// <summary>
 /// Checks the checkbox for a view in the test table
 /// </summary>
 public void CheckViewTableRow(string viewName)
 {
     var tdCheckBox = new Checkbox(By.XPath("//a[text()='" + viewName + "']/../../td[1]/input[@type='checkbox']"));
     tdCheckBox.Checked = true;
 }
 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 SelectEntityRow(string name)
 {
     var tdCheckBox = new Checkbox(By.XPath("//td[text()='" + name + "']/../td[1]/input[@type='checkbox']"));
     tdCheckBox.Checked = true;
 }