Exemple #1
0
        public void MenuElementPresenceTest(string menuName)
        {
            try
            {
                // Only navigate to page if necessary.
                if (!String.Equals(WebDriver.Url, Args.AppURL))
                {
                    WebDriver.Navigate().GoToUrl(Args.AppURL);
                }

                SeleniumTestUtils.WaitForPageToLoad(WebDriver, Args.PageTimeout);

                string menuXPath = "//*[@class='cgh-link-tag' and descendant-or-self::text()[normalize-space(.)='" +
                                   menuName + "']]";

                var         wait = new WebDriverWait(WebDriver, Args.ElementTimeout);
                IWebElement menu = wait.Until(
                    SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath(menuXPath)));

                Actions actions = new Actions(WebDriver);
                actions.MoveToElement(menu).Perform();

                SeleniumTestUtils.HighlightElement(WebDriver, menu);

                if (Args.DelayMillis > 0)
                {
                    Thread.Sleep(Args.DelayMillis);
                }
            }
            catch (Exception e)
            {
                Assert.Fail($"Could not find toolbar menu '{menuName}'; reason: '{e.Message}'");
            }
        }
Exemple #2
0
        public void HyperlinkPresenceTest(string pageSegment, string title, string text, int position)
        {
            try
            {
                string pageUrl = Args.AppURL;

                if (!pageSegment.Equals("home"))
                {
                    pageUrl = Tests.Common.TestUtils.AppendUrl(Args.AppURL, pageSegment);
                }

                // Only navigate to new page if necessary.
                if (!String.Equals(WebDriver.Url, pageUrl))
                {
                    WebDriver.Navigate().GoToUrl(pageUrl);
                }

                SeleniumTestUtils.WaitForPageToLoad(WebDriver, Args.PageTimeout);

                SeleniumVerificationUtils.VerifyHyperlinkElementExistence(WebDriver, Args.ElementTimeout, title, text, position);

                if (Args.DelayMillis > 0)
                {
                    Thread.Sleep(Args.DelayMillis);
                }
            }
            catch (Exception e)
            {
                Assert.Fail($"Could not find hyperlink element page='{pageSegment}', " +
                            $"title='{title}', text='{text}', position='{position}'; reason: '{e.Message}'");
            }
        }