コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <summary>
 /// Clicks on any tab within the main page (this does not include popups) of the Learner page
 /// </summary>
 /// <param name="tabElem">The tab element</param>
 /// <param name="by">The element as it exists in the By type. For examples, <see cref="Bys.CBDLearnerPage"/></param>
 public void SwitchToTab(IWebElement tabElem, By by)
 {
     Browser.WaitForElement(Bys.RCPPage.LoadIcon, TimeSpan.FromSeconds(3), ElementCriteria.AttributeValue("class", "page-splash dissolve-animation ng-hide")
                            .OR(ElementCriteria.AttributeValue("class", "page-splash dissolve-animation ng-animate ng-hide")));
     tabElem.Click();
     this.WaitForElement(by, ElementCriteria.IsEnabled, ElementCriteria.IsVisible);
     this.WaitUntil(TimeSpan.FromSeconds(60), Criteria.CBDLearnerPage.GenericTableEnabled);
 }
コード例 #3
0
        /// <summary>
        /// Clicks on the Competence Committee tab if that page is not in view, then creates an upcoming agenda with a random date.
        /// It opens the Create New Agenda window, assigns the date and clicks Create to create the new agenda. It will then pick this
        /// new agenda in the Meeting Agenda dropdown
        /// </summary>
        public void CreateUpcomingAgendaThenSelectIt()
        {
            string agendaToSelect = "";

            // If we are not on the Competence Committee tab, then click on it to go there
            if (!Browser.Exists(Bys.CBDProgDirectorPage.FinalizeAgendaBtn, ElementCriteria.IsEnabled))
            {
                ClickAndWait(CompCommiteeTab);
            }

            agendaToSelect = CreateUpcomingAgendaWithRandomDate();

            ElemSet.SelElem_SelectItemContainingText(MeetingAgendaSelElem, agendaToSelect);
            Browser.WaitForElement(Bys.RCPPage.LoadIcon, TimeSpan.FromMinutes(3), ElementCriteria.AttributeValue("class", "page-splash dissolve-animation ng-hide")
                                   .OR(ElementCriteria.AttributeValue("class", "page-splash dissolve-animation ng-animate ng-hide")));
        }
コード例 #4
0
        /// <summary>
        /// Clicks the user-specified element and then waits for a window to close or open, or a page to load,
        /// depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The button element</param>
        public void ClickAndWait(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.CBDObserverPage.AccDecAssgnMntFormAcceptBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AccDecAssgnMntFormAcceptBtn.GetAttribute("outerHTML"))
                {
                    AccDecAssgnMntFormAcceptBtn.Click();
                    this.WaitForInitialize();
                    // 9/18/17 Commented the following line. Im pretty sure this is not needed anymore, because I implemented this wait in the PageCriteria class
                    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")));
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.CBDTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CBDTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(Criteria.CBDObserverPage.PageReady);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDObserverPage.AccDecAssgnMntFormDeclineBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AccDecAssgnMntFormDeclineBtn.GetAttribute("outerHTML"))
                {
                    AccDecAssgnMntFormDeclineBtn.Click();
                    Browser.WaitForElement(Bys.CBDObserverPage.ConfirmFormCompleteAssessYesBtn, ElementCriteria.IsEnabled);
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDObserverPage.ConfirmFormRemoveAssessOkBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ConfirmFormRemoveAssessOkBtn.GetAttribute("outerHTML"))
                {
                    ConfirmFormRemoveAssessOkBtn.Click();
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDObserverPage.ConfirmFormDeclineAssessYesBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ConfirmFormDeclineAssessYesBtn.GetAttribute("outerHTML"))
                {
                    ConfirmFormDeclineAssessYesBtn.Click();
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDObserverPage.CompleteAssessFormSubmitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CompleteAssessFormSubmitBtn.GetAttribute("outerHTML"))
                {
                    CompleteAssessFormSubmitBtn.Click();
                    this.WaitForInitialize();
                    Browser.WaitForElement(Bys.CBDObserverPage.ConfirmFormCompleteAssessYesBtn, ElementCriteria.IsEnabled);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDObserverPage.ConfirmFormCompleteAssessYesBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ConfirmFormCompleteAssessYesBtn.GetAttribute("outerHTML"))
                {
                    ConfirmFormCompleteAssessYesBtn.Click();
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.RCPPage.LogoutLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LogoutLnk.GetAttribute("outerHTML"))
                {
                    LogoutLnk.Click();
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("login"));
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDObserverPage.AddObservationBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddObservationBtn.GetAttribute("outerHTML"))
                {
                    AddObservationBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDObserverPage.AddObsFormSearchBtn);
                    this.WaitForInitialize();
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDObserverPage.AddObsFormSearchBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddObsFormSearchBtn.GetAttribute("outerHTML"))
                {
                    AddObsFormSearchBtn.Click();
                    WaitUtils.WaitForPopup(Browser, TimeSpan.FromSeconds(30), Bys.CBDObserverPage.AddObsFormObsTblFacultyColHdr);
                    this.WaitForInitialize();
                    Thread.Sleep(1000);
                    return;
                }
            }

            if (Browser.Exists(Bys.CBDObserverPage.AddObsFormNextBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddObsFormNextBtn.GetAttribute("outerHTML"))
                {
                    AddObsFormNextBtn.Click();
                    Browser.WaitForElement(Bys.CBDObserverPage.AddObsFormBackBtn, ElementCriteria.IsEnabled);
                    Browser.WaitForElement(Bys.CBDObserverPage.AddObsFormBackBtn, ElementCriteria.IsVisible);
                    Browser.WaitForElement(Bys.CBDObserverPage.AddObsFormBackBtn, ElementCriteria.HasText);
                    this.WaitForInitialize();
                    return;
                }
            }

            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, " +
                                    "or if the button is already added, then the page you were on did not contain the button.");
            }
        }