コード例 #1
0
        /// <summary>
        /// If you add an activity which gives you credits, this method can be called to wait for a user-specified label on your application
        /// to get updated with those credits after that activity was added. Once an activity is submitted, a record gets put into a windows service
        /// queue, and then waits for that service to push the activity through, because of this, we need to wait in our code. Note that there
        /// is not database flag to check instead of just randomly refreshing every couple of seconds. Right now, we will refresh every 4 seconds,
        /// 30 times. If your application ever takes longer than that, then increase the For loop below
        /// Note: This method is a workaround to be able to refresh this page. It can be removed when/if defect
        /// https://code.premierinc.com/issues/browse/RCPSC-793 is fixed. If that gets fixed, then
        /// we will remove this method, and just use the regular <see cref="ApplicationUtils.WaitForCreditsToBeApplied(Page, By, string)"/>
        /// </summary>
        /// <param name="Page">The page to refresh</param>
        /// <param name="creditLabelBy">the label which stores the amount of credits that you are waiting to be refreshed</param>
        /// <param name="amountOfCredits">The amount of credits that will show when the windows service is complete</param>
        public static void WaitForCreditsToBeApplied(IWebDriver Browser, Page page, By creditLabelBy, string amountOfCredits)
        {
            MyMOCPage       MP = new MyMOCPage(Browser);
            MyDashboardPage DP = new MyDashboardPage(Browser);

            DP.ClickAndWaitBasePage(DP.MyMOCTab);
            DP.ClickAndWaitBasePage(DP.MyDashboardTab);

            ApplicationUtils.WaitForCreditsToBeApplied(page, creditLabelBy, amountOfCredits);
        }
コード例 #2
0
ファイル: RCPPage.cs プロジェクト: mikej411/Backup-18_02_05
        /// <summary>
        /// Clicks the user-specified element that exists on every page of RCP, 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 element to click on</param>
        public dynamic ClickAndWaitBasePage(IWebElement buttonOrLinkElem)
        {
            // Error handler to make sure that the button that the tester passed in the parameter is actually on the page
            if (Browser.Exists(Bys.RCPPage.PERAFCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == PERAFCTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    PERCredentialStaffPage page = new PERCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDiplomaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDiplomaTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    DiplomaCredentialStaffPage page = new DiplomaCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDashboardTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDashboardTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyDashboardPage page = new MyDashboardPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyCPDActivitiesTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyCPDActivitiesTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyCPDActivitiesListPage page = new MyCPDActivitiesListPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyMOCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyMOCTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyMOCPage page = new MyMOCPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyHoldingAreaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyHoldingAreaTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyHoldingAreaPage page = new MyHoldingAreaPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.CBDTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CBDTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    // We dont want wait criteria here, because clicking this tab can be on any role within RCP, so there can be many things to wait for
                    return(null);
                }
            }


            if (Browser.Exists(Bys.RCPPage.LogoutLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LogoutLnk.GetAttribute("outerHTML"))
                {
                    LogoutLnk.Click();
                    this.WaitForElement(Bys.RCPPage.LoginLnk, ElementCriteria.IsVisible);
                    return(null);
                }
            }

            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.");
            }

            return(null);
        }
コード例 #3
0
        /// <summary>
        /// Clicks the user-specified element that exists on every page of RCP, 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 dynamic ClickAndWaitBasePage(IWebElement buttonOrLinkElem)
        {
            // Error handler to make sure that the button that the tester passed in the parameter is actually on the page
            if (Browser.Exists(Bys.RCPPage.PERAFCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == PERAFCTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    PERCredentialStaffPage page = new PERCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDiplomaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDiplomaTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    DiplomaCredentialStaffPage page = new DiplomaCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDashboardTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDashboardTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyDashboardPage page = new MyDashboardPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyCPDActivitiesTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyCPDActivitiesTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyCPDActivitiesListPage page = new MyCPDActivitiesListPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyMOCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyMOCTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyMOCPage page = new MyMOCPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyHoldingAreaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyHoldingAreaTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyHoldingAreaPage page = new MyHoldingAreaPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            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.");
            }

            return(null);
        }