protected PageElement(By byLocator)
 {
     BaseElement = new CCElement(byLocator);
     if (ValidTags != null && !ValidTags.Contains(BaseElement.TagName.ToLower())) {
         throw new Exception("Tag '" + BaseElement.TagName + "' is not valid");
     }
 }
 protected PageElement(By byLocator)
 {
     BaseElement = new CCElement(byLocator);
     if (ValidTags != null && !ValidTags.Contains(BaseElement.TagName.ToLower()))
     {
         throw new Exception("Tag '" + BaseElement.TagName + "' is not valid");
     }
 }
예제 #3
0
 public void OpenStudy(string name, bool partialMatch = false)
 {
     if (partialMatch)
     {
         var targetLink = new CCElement(By.PartialLinkText(name));
         targetLink.Click();
         Wait.Until(h => Web.PortalDriver.Title == name);
     }
     else
     {
         var targetLink = new CCElement(By.LinkText(name));
         targetLink.Click();
         Wait.Until(h => Web.PortalDriver.Title == name);
     }
 }
예제 #4
0
        /// <summary>
        /// Gets List of descendants matching the XPath
        /// </summary>
        /// <param name="xPath">The XPath to match the descendant elements. Must start with '.' to specify current element.</param>
        /// <returns>The found descendant elements</returns>
        public List <CCElement> GetDescendants(string xPath)
        {
            Initialize();
            Trace.WriteLine(String.Format("Attempting to find descendants of '{0}'.", ElementIdentifier));
            List <CCElement> elements = new List <CCElement>();

            foreach (IWebElement iWebElement in webElement.FindElements(By.XPath(xPath)))
            {
                CCElement element = new CCElement();
                element.webElement = iWebElement;
                elements.Add(element);
            }

            return(elements);
        }
        /// <summary>
        /// Does not support projects yet TODO
        /// </summary>
        /// <param name="category"></param>
        /// <param name="firstName"></param>
        /// <param name="lastName"></param>
        /// <param name="organization"></param>
        public void Search(FastFind.SearchCategory category, string firstName = "", string lastName = "", string organization = "")
        {
            //FastFindCell.Click();
            //LnkFastFind.Click();
            this.SwitchToFrame();

            CCElement element = new CCElement(By.LinkText("Projects"));

            LnkFastFindId.Click();

            //JavascriptExecutor.Execute("document.getElementById('TabLink2').click();");

            switch (category)
            {
                case SearchCategory.Contacts:
                {
                    SelSearchType.SelectOption("Contacts");
                    TxtOrganization.Value = organization;
                    TxtContactFirstName.Value = firstName;
                    TxtContactLastName.Value = lastName;
                    BtnFindNow.Click();
                    Wait.Until(d => BtnFindNow.Enabled);
                    break;
                    }

                case SearchCategory.Organizations:
                {
                    SelSearchType.SelectOption("Organizations");
                    TxtOrganization.Value = organization;
                    TxtContactFirstName.Value = firstName;
                    TxtContactLastName.Value = lastName;
                    BtnFindNow.Click();
                    Wait.Until(d => BtnFindNow.Enabled);
                    break;
                    }

                case SearchCategory.Projects:
                    // TODO implement this
                    {
                        throw new NotImplementedException();

                    }

            }
        }
예제 #6
0
        public CCElement GetParent()
        {
            Initialize();
            Trace.WriteLine(String.Format("Attempting to find parent of '{0}.", ElementIdentifier));
            IWebElement iwebElement = webElement.FindElement(By.XPath(".."));
            CCElement   element     = new CCElement();

            element.webElement = iwebElement;

            if (webElement != null)
            {
                return(element);
            }
            else
            {
                throw new Exception(String.Format("There was no parent of '{0}'", ElementIdentifier));
            }
        }
예제 #7
0
        public CCElement GetDescendant(string xPath)
        {
            Initialize();
            Trace.WriteLine(String.Format("Attempting to find descendant of '{0}.", ElementIdentifier));
            IWebElement iwebElement = webElement.FindElement(By.XPath(xPath));
            CCElement   element     = new CCElement();

            element.webElement = iwebElement;

            if (webElement != null)
            {
                return(element);
            }
            else
            {
                throw new Exception(String.Format("There was no descendant found for '{0}'", ElementIdentifier));
            }
        }
 protected PageElement(CCElement baseElement)
 {
     BaseElement = baseElement;
 }
        public CCElement GetDescendant(string xPath)
        {
            Initialize();
            Trace.WriteLine(String.Format("Attempting to find descendant of '{0}.", ElementIdentifier));
            IWebElement iwebElement = webElement.FindElement(By.XPath(xPath));
            CCElement element = new CCElement();
            element.webElement = iwebElement;

            if (webElement != null)
            {
                return element;
            }
            else
            {
                throw new Exception(String.Format("There was no descendant found for '{0}'", ElementIdentifier));
            }
        }
 public void OpenSubmissionByAllSubmissions(string name, bool partialMatch = false)
 {
     this.AllSubmissionsTab.NavigateTo();
     this.AllSubmissionsTab.ProjectsComponent.LnkAdvanced.Click();
     this.AllSubmissionsTab.ProjectsComponent.SetCriteria("Name", name);
     if (partialMatch)
     {
         Wait.Until(h => new CCElement(By.PartialLinkText(name)).Exists);
         var targetLink = new CCElement(By.PartialLinkText(name));
         targetLink.Click();
         Wait.Until(h => Web.PortalDriver.Title == name);
     }
     else
     {
         Wait.Until(h => new CCElement(By.LinkText(name)).Exists);
         var targetLink = new CCElement(By.LinkText(name));
         targetLink.Click();
         Wait.Until(h => Web.PortalDriver.Title == name);
     }
 }
 //public CCElement DivProjectListing = new CCElement(By.Id("component3A410C7E87F5F749BC8AD015360F38AB"));
 /// <summary>
 /// Opens a submission by navigating to all submissions tab
 /// </summary>
 /// <param name="name"></param>
 /// <param name="partialMatch"></param>
 public void OpenSubmission(string name, bool partialMatch = false)
 {
     if (partialMatch)
     {
         Wait.Until(h => new CCElement(By.PartialLinkText(name)).Exists);
         var targetLink = new CCElement(By.PartialLinkText(name));
         targetLink.Click();
     }
     else
     {
         Wait.Until(h => new CCElement(By.PartialLinkText(name)).Exists);
         var targetLink = new CCElement(By.LinkText(name));
         targetLink.Click();
     }
 }
        public CCElement GetParent()
        {
            Initialize();
            Trace.WriteLine(String.Format("Attempting to find parent of '{0}.", ElementIdentifier));
            IWebElement iwebElement = webElement.FindElement(By.XPath(".."));
            CCElement element = new CCElement();
            element.webElement = iwebElement;

            if (webElement != null)
            {
                return element;
            }
            else
            {
                throw new Exception(String.Format("There was no parent of '{0}'", ElementIdentifier));
            }
        }
        public void CopySubmission()
        {
            string targetStudy = "AutoTest-" + DataGen.String(5);
            CloneEntity("STUDY00000017", targetStudy);

            var ActionsNav = new ActivitiesNav();
            var CopySubmissionPage = new CopySubmission("STUDY-" + targetStudy, "Copy Submission");
            //var CopySubmissionPage = new CopySubmission("STUDY-AutoTest-iyULl", "Copy Submission");

            Store.LoginAsUser(Users.Irbd);

            var studyForReview = new CCElement(By.LinkText(targetStudy));
            studyForReview.Click();

            string copyId = "Auto-SubmissionCopy" + DataGen.String(5);

            ActionsNav.LnkCopySubmission.Click();
            CopySubmissionPage.SwitchTo();
            CopySubmissionPage.TxtNewSubmissionName.Value = copyId;
            CopySubmissionPage.BtnOk.Click();
            CopySubmissionPage.SwitchBackToParent();

            Wait.Until(h => new CCElement(By.LinkText("Copied Submission")).Exists);
            Assert.IsTrue(new CCElement(By.LinkText("Copied Submission")).Exists, "Copied Submission not found for:  " + targetStudy);

            // Move this validation logic to page object
            Container divContainer = new Container(By.XPath("//div[@class='Component_ProjectLog_Notes'][\"Auto-SubmissionCopy\"]"));
            int i = 0;
            const int maxRetries = 15;
            while (!(divContainer.Text.Contains(copyId)) && i < maxRetries)
            {
                System.Threading.Thread.Sleep(1000);
                // have to manually refresh
                Web.PortalDriver.Navigate().Refresh();
                i++;
            }
            Assert.IsTrue(divContainer.Text.Contains(copyId), "Cannot find the 'submission copy':  " + copyId);
        }
        public void AssignIRB()
        {
            string targetStudy = "AutoTest-" + DataGen.String(5);
            CloneEntity("STUDY00000017", targetStudy);

            var ActionsNav = new ActivitiesNav();
            var AssignIRBPage = new AssignIRB("STUDY-" + targetStudy, "Assign IRB");

            Store.LoginAsUser(Users.Irbd);

            var studyForReview = new CCElement(By.LinkText(targetStudy));
            studyForReview.Click();

            ActionsNav.LnkAssignIRB.Click();

            AssignIRBPage.SwitchTo();
            AssignIRBPage.SelIrbOffice.SelectOption("IRB 1");
            AssignIRBPage.BtnOk.Click();
            //AssignIRBPage.SwitchBackToParent();
            PopUpWindow.SwitchTo(targetStudy);

            Wait.Until(h => new CCElement(By.LinkText("Assigned IRB office")).Exists);
            Assert.IsTrue(new CCElement(By.LinkText("Assigned IRB office")).Exists, "Assigned IRB office not found for:  " + targetStudy);
        }
        public void AssignPrimaryContact()
        {
            string targetStudy = "AutoTest-" + DataGen.String(5);
            CloneEntity("STUDY00000017", targetStudy);

            var ActionsNav = new ActivitiesNav();
            var workspace = new IRBWorkspace();
            var SelectPersonPage = new SelectPerson("Person");

            Store.LoginAsUser(Users.Irbd);

            var studyForReview = new CCElement(By.LinkText(targetStudy));
            studyForReview.Click();
            var assignPrimaryContact = new AssignPrimaryContact(workspace.GetStudyID(), "Assign Primary Contact");
            ActionsNav.LnkAssignPrimaryContact.Click();
            assignPrimaryContact.SwitchTo();
            PopUpWindow.SwitchTo("Execute \"Assign Primary Contact\"",true);
            assignPrimaryContact.SelectPrimaryContact("Bivens (pi2)");

            PopUpWindow.SwitchTo(targetStudy);
            Wait.Until(h => new CCElement(By.LinkText("Assigned Primary Contact")).Exists);
            Assert.IsTrue(new CCElement(By.LinkText("Assigned Primary Contact")).Exists, "Assigned primary contact not found for:  " + targetStudy);
        }
        public void AddRelatedGrant()
        {
            string targetStudy = "AutoTest-" + DataGen.String(5);
            CloneEntity("STUDY00000017", targetStudy);

            var ActionsNav = new ActivitiesNav();
            var AddRelatedGrantPopup = new AddRelatedGrant("STUDY-" + targetStudy, "Add Related Grant");
            var ClickIRBGrantInfoPopup = new AddClickIRBGrantInfo();
            var Inbox = new Inbox();
            //var SelectPersonsPage = new ChooserPopup("Persons", true);

            Store.LoginAsUser(Users.Irbd);
            ActionsNav.LnkSubmissions.Click();
            Inbox.LnkAdvanced.Click();
            Wait.Until(h => Inbox.QueryField1.Displayed);
            Inbox.QueryField1.SelectByInnerText("Name");
            Wait.Until(h => Inbox.QueryCriteria1.Enabled);
            Inbox.QueryCriteria1.Text = targetStudy;
            Wait.Until(d => Inbox.BtnGo.Enabled);
            Inbox.BtnGo.Click();
            Wait.Until(d => Inbox.BtnGo.Enabled);

            var studyForReview = new CCElement(By.LinkText(targetStudy));
            studyForReview.Click();

            ActionsNav.LnkAddRelatedGrant.Click();
            AddRelatedGrantPopup.SwitchTo();
            AddRelatedGrantPopup.BtnAdd.Click();
            ClickIRBGrantInfoPopup.SwitchTo();
            ClickIRBGrantInfoPopup.TxtGrantId.Value = "Grant-" + DataGen.String(4);
            ClickIRBGrantInfoPopup.TxtGrantTitle.Value = "Grant Title Automation Test" + DataGen.String(4);
            ClickIRBGrantInfoPopup.BtnOk.Click();
            ClickIRBGrantInfoPopup.SwitchBackToParent();
            AddRelatedGrantPopup.BtnOk.Click();
            AddRelatedGrantPopup.SwitchBackToParent();

            Wait.Until(h => new CCElement(By.LinkText("Related Grants Updated")).Exists);
            Assert.IsTrue(new CCElement(By.LinkText("Related Grants Updated")).Exists, "'Related Grants Updated' activity not found for:  " + targetStudy);
        }
        public void AddPrivateComment()
        {
            string targetStudy = "AutoTest-" + DataGen.String(5);
            CloneEntity("STUDY00000017", targetStudy);

            var ActionsNav = new ActivitiesNav();
            var AddPrivateCommentsPage = new AddPrivateComments("STUDY-" + targetStudy, "Add Private Comment");

            Store.LoginAsUser(Users.Irbd);

            var studyForReview = new CCElement(By.LinkText(targetStudy));
            studyForReview.Click();

            ActionsNav.LnkAddPrivateComment.Click();
            AddPrivateCommentsPage.SwitchTo();
            AddPrivateCommentsPage.TxtComment.Value = "This is a private comment";
            AddPrivateCommentsPage.BtnOk.Click();
            AddPrivateCommentsPage.SwitchBackToParent();

            Wait.Until(h => new CCElement(By.LinkText("Private Comment Added")).Exists);
            Assert.IsTrue(new CCElement(By.LinkText("Private Comment Added")).Exists, "Private Comment Added not found for:  " + targetStudy);
        }
 public Container(CCElement baseElement) : base(baseElement)
 {
     ValidTags = new List <string> {
         "div", "span", "form", "table", "tr", "td"
     };
 }
 protected PageElement(CCElement baseElement)
 {
     BaseElement = baseElement;
 }
        public void ManageGuestList()
        {
            string targetStudy = "AutoTest-" + DataGen.String(5);
            CloneEntity("STUDY00000017", targetStudy);

            var ActionsNav = new ActivitiesNav();
            var ManageGuestListPagePopup = new ManageGuestList("STUDY-" + targetStudy, "Manage Guest List");
            var SelectPersonsPage = new ChooserPopup("Persons", true);

            Store.LoginAsUser(Users.Irbd);

            var studyForReview = new CCElement(By.LinkText(targetStudy));
            studyForReview.Click();

            ActionsNav.LnkManageGuestList.Click();
            ManageGuestListPagePopup.SwitchTo();
            ManageGuestListPagePopup.BtnAddGuest.Click();

            SelectPersonsPage.SwitchTo();
            SelectPersonsPage.SelectValue("Jones (irbc2)", "Last");
            SelectPersonsPage.BtnOk.Click();
            SelectPersonsPage.SwitchBackToParent();

            ManageGuestListPagePopup.BtnOk.Click();
            ManageGuestListPagePopup.SwitchBackToParent();

            Wait.Until(h => new CCElement(By.LinkText("Guest List Updated")).Exists);
            Assert.IsTrue(new CCElement(By.LinkText("Guest List Updated")).Exists, "'Guest List Updated' activity not found for:  " + targetStudy);
        }
 // helper methods for frequently used operations
 public string GetStudyID()
 {
     CCElement container = new CCElement(By.Id("__IRBSubmission.ID_container"));
     CCElement ID = container.GetDescendant((".//span[3]"));
     return ID.Text;
 }
        public void TerminateStudy()
        {
            // use STUDY00000024 as template
            string targetStudy = "AutoTest-" + DataGen.String(5);
            CloneEntity("STUDY00000024", targetStudy);

            var ActionsNav = new ActivitiesNav();
            var TerminatePopup = new Terminate("STUDY-" + targetStudy, "Terminate");
            var Inbox = new Inbox();

            Store.LoginAsUser(Users.Irbd);
            ActionsNav.LnkSubmissions.Click();
            Inbox.LnkAdvanced.Click();
            Wait.Until(h => Inbox.QueryField1.Displayed);
            Inbox.QueryField1.SelectByInnerText("Name");
            Wait.Until(h => Inbox.QueryCriteria1.Enabled);
            Inbox.QueryCriteria1.Text = targetStudy;
            Wait.Until(d => Inbox.BtnGo.Enabled);
            Inbox.BtnGo.Click();
            Wait.Until(d => Inbox.BtnGo.Enabled);

            var studyForReview = new CCElement(By.LinkText(targetStudy));
            studyForReview.Click();
            ActionsNav.LnkTerminate.Click();
            TerminatePopup.SwitchTo();
            TerminatePopup.TxtComments.Value = "Terminating this study for automation!";
            TerminatePopup.BtnOk.Click();
            TerminatePopup.SwitchBackToParent();

            Wait.Until(h => new CCElement(By.LinkText("Terminated")).Exists);
            Assert.IsTrue(new CCElement(By.LinkText("Terminated")).Exists, "'Terminated' activity not found for:  " + targetStudy);
        }
        public void ManageAncillaryReviews()
        {
            string targetStudy = "AutoTest-" + DataGen.String(5);
            CloneEntity("STUDY00000017", targetStudy);

            var ActionsNav = new ActivitiesNav();
            var ManageAncillaryReviewsPage = new ManageAncillaryReviews("STUDY-" + targetStudy,"Manage Ancillary Reviews");
            var SelectPersonPage = new SelectPerson("Person");
            var AddAncillaryReviewPage = new AddAncillaryReview();

            Store.LoginAsUser(Users.Irbd);

            var studyForReview = new CCElement(By.LinkText(targetStudy));
            studyForReview.Click();

            ActionsNav.LnkManageAncillaryReviews.Click();
            ManageAncillaryReviewsPage.SwitchTo();
            ManageAncillaryReviewsPage.BtnAdd.Click();
            AddAncillaryReviewPage.SwitchTo();
            AddAncillaryReviewPage.SelectPerson("Max (irbc)");
            //AddAncillaryReviewPage.BtnSelectPerson.Click();
            //SelectPersonPage.SwitchTo();
            //SelectPersonPage.SelectFirstUser();
            //PopUpWindow.SwitchTo("Add Ancillary Review",true);
            AddAncillaryReviewPage.SelReviewType.SelectOption("Faculty");
            AddAncillaryReviewPage.RdoResponseRequiredNo.Click();
            AddAncillaryReviewPage.BtnOk.Click();
            PopUpWindow.SwitchTo("Manage Ancillary Review", true);
            ManageAncillaryReviewsPage.BtnOk.Click();
            PopUpWindow.SwitchTo(targetStudy);

            Wait.Until(h => new CCElement(By.LinkText("Managed Ancillary Reviews")).Exists);
            Assert.IsTrue(new CCElement(By.LinkText("Managed Ancillary Reviews")).Exists, "Managed Ancillary Reviews not found for:  " + targetStudy);
        }
        /// <summary>
        /// Gets List of descendants matching the XPath
        /// </summary>
        /// <param name="xPath">The XPath to match the descendant elements. Must start with '.' to specify current element.</param>
        /// <returns>The found descendant elements</returns>
        public List<CCElement> GetDescendants(string xPath)
        {
            Initialize();
            Trace.WriteLine(String.Format("Attempting to find descendants of '{0}'.", ElementIdentifier));
            List<CCElement> elements = new List<CCElement>();
            foreach (IWebElement iWebElement in webElement.FindElements(By.XPath(xPath)))
            {
                CCElement element = new CCElement();
                element.webElement = iWebElement;
                elements.Add(element);
            }

            return elements;
        }