예제 #1
0
        public void PassForMatchingPath()
        {
            string        path              = "/path/to/a/resource";
            Uri           testUri           = new Uri($"https://any.cxm{path}");
            PageAssertion pageAssertion     = new PagePathAssertion($"{nameof(PassForMatchingPath)}_Test", path);
            bool?         passedEventRaised = false;

            pageAssertion.AssertionPassed += (sender, args) => passedEventRaised = true;
            IAutomationPage page = Substitute.For <IAutomationPage>();

            page.Url.Returns(testUri.ToString());
            PageAssertionResult result = pageAssertion.Execute(page);

            result.Passed.Should().BeTrue();
            passedEventRaised.Should().BeTrue();
        }
예제 #2
0
        /// <summary>
        /// Navigates to a page.
        /// </summary>
        /// <param name="browser">The browser.</param>
        /// <param name="page">The page.</param>
        public static void NavigateTo(this IWebDriver browser, IAutomationPage page)
        {
            browser.Navigate().GoToPage(page);

            if (page.Url.Contains("https") && (browser.GetType() == typeof (InternetExplorerDriver)))
            {
                BypassHttpsWarning(browser as InternetExplorerDriver);
            }
        }
예제 #3
0
        /// <summary>
        /// Navigates directly to a provided page object.
        /// </summary>
        /// <param name="navigation">The navigation item to navigate with.</param>
        /// <param name="page">The page to navigate to.</param>
        /// <exception cref="System.ArgumentNullException">The parameter is null.</exception>
        public static void GoToPage(this INavigation navigation, IAutomationPage page)
        {
            if (navigation == null) throw new ArgumentNullException("navigation");
            if (page == null) throw new ArgumentNullException("page");

            navigation.GoToUrl(page.Url);
        }