/// <summary>
        /// Enters the information into the container element.
        /// </summary>
        /// <param name="containerElement">The container element.</param>
        /// <exception cref="NotImplementedException"></exception>
        public void EnterInformation(IWebElement containerElement)
        {
            if (containerElement == null)
            {
                throw new ArgumentNullException(nameof(containerElement));
            }

            // Leave card type as default (visa).

            // Card holder name.
            var cardHolderNameEl = new InputElement(
                containerElement.FindElement(
                    cardholderNameSelector));

            cardHolderNameEl.SetValue("John Smith");

            // Card number.
            var cardNumberEl = new InputElement(
                containerElement.FindElement(
                    cardNumberSelector));

            cardNumberEl.SetValue("4111111111111111");

            // Expiration date.
            var yearDropDown = new SelectElement(
                containerElement.FindElement(
                    expirationDateYearSelector));
        }
        public void FluidTest()
        {
            var factory = new WebDriverFactory();
            var driver  = factory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            pageObjectFactory = new PageObjectFactory(driver);

            using (driver)
            {
                pageObjectFactory
                .StartWithPage <IMockAPage>()
                .ContinueWithPage <IMockAPage, IMockBPage>(
                    pageA =>
                {
                    var searchBar = new InputElement(
                        pageA.WrappedDriver.FindElement(
                            By.CssSelector("*[name='q']")));

                    searchBar.SetValue("Testing 1 2 3");
                    searchBar.SendKeys(Keys.Enter);
                },
                    pageA => pageObjectFactory.PreparePage <IMockBPage>())
                .ContinueWithPage <IMockBPage, IMockDPage>(
                    pageB =>
                {
                    Console.WriteLine("Testing with IMockB.");
                },
                    pageB =>
                {
                    var pageA = pageObjectFactory.PreparePage <IMockAPage>();
                    var pageD = new MockDPage(pageA,
                                              pageB,
                                              pageObjectFactory,
                                              pageB.WrappedDriver);

                    pageD.Load(
                        new Dictionary <string, string>
                    {
                        { "q", "selenium" }
                    });

                    return(pageD);
                })
                .ContinueWithPage <IMockDPage>(
                    pageC =>
                {
                    Console.WriteLine("Testing with IMockC.");

                    pageC.WrappedDriver
                    .Navigate()
                    .GoToUrl("https://www.google.com/search?q=testing");

                    Console.WriteLine("Should not reach here.");
                    throw new InternalTestFailureException();
                });
            }
        }
Example #3
0
 /// <summary>
 /// Sets the <see cref="TabNavigationProperty"/> for a container.
 /// </summary>
 /// <param name="element">The container.</param>
 /// <param name="value">The <see cref="KeyboardNavigationMode"/> for the container.</param>
 public static void SetTabNavigation(InputElement element, KeyboardNavigationMode value)
 {
     element.SetValue(TabNavigationProperty, value);
 }
Example #4
0
 /// <summary>
 /// Sets the <see cref="IsTabStopProperty"/> for an element.
 /// </summary>
 /// <param name="element">The container.</param>
 /// <param name="value">Value indicating whether the container is a tab stop.</param>
 public static void SetIsTabStop(InputElement element, bool value)
 {
     element.SetValue(IsTabStopProperty, value);
 }
Example #5
0
 /// <summary>
 /// Sets the <see cref="TabOnceActiveElementProperty"/> for a container.
 /// </summary>
 /// <param name="element">The container.</param>
 /// <param name="value">The active element for the container.</param>
 public static void SetTabOnceActiveElement(InputElement element, IInputElement?value)
 {
     element.SetValue(TabOnceActiveElementProperty, value);
 }
Example #6
0
 /// <summary>
 /// Sets the <see cref="TabNavigationProperty"/> for a container.
 /// </summary>
 /// <param name="element">The container.</param>
 /// <param name="value">The <see cref="KeyboardNavigationMode"/> for the container.</param>
 public static void SetTabNavigation(InputElement element, KeyboardNavigationMode value)
 {
     element.SetValue(TabNavigationProperty, value);
 }
Example #7
0
 /// <summary>
 /// Sets the <see cref="TabOnceActiveElementProperty"/> for a container.
 /// </summary>
 /// <param name="element">The container.</param>
 /// <param name="value">The active element for the container.</param>
 public static void SetTabOnceActiveElement(InputElement element, IInputElement value)
 {
     element.SetValue(TabOnceActiveElementProperty, value);
 }
Example #8
0
 /// <summary>
 /// Setter for IsInputMethodEnabled AvaloniaProperty
 /// </summary>
 public static void SetIsInputMethodEnabled(InputElement target, bool value)
 {
     target.SetValue(IsInputMethodEnabledProperty, value);
 }
Example #9
0
        /// <summary>
        /// Adds the new associated products.
        /// </summary>
        /// <param name="productName">Name of the product.</param>
        /// <returns></returns>
        public virtual AssociatedProductsVariantsComponent AddNewAssociatedProducts(
            string productName)
        {
            var productNameSelector = By.CssSelector("#SearchProductName");
            var searchSelector      = By.CssSelector("#search-products");
            var saveSelector        = By.CssSelector("*[name='save']");

            var currentWindowHandle = WrappedDriver.CurrentWindowHandle;
            var windowHandles       = WrappedDriver.WindowHandles;
            var newWindowHandle     = default(string);

            AddNewAssociatedProductElement.Click();

            // Wait for the new window to appear.
            WrappedDriver
            .Wait(TimeSpan.FromSeconds(5))
            .Until(d => newWindowHandle = d.WindowHandles
                                          .Except(windowHandles)
                                          .FirstOrDefault());

            // Switch to new window.
            WrappedDriver.SwitchTo().Window(newWindowHandle);

            var productNameEl = new InputElement(
                WrappedDriver.FindElement(
                    productNameSelector));

            var searchElement = WrappedDriver.FindElement(searchSelector);

            var productsGrid = pageObjectFactory.PrepareComponent(
                new KGridComponent <AssociatedProductsVariantsComponent>(
                    new BaseKendoConfiguration(),
                    By.CssSelector("#products-grid"),
                    pageObjectFactory,
                    WrappedDriver,
                    this));

            var saveElement = WrappedDriver.FindElement(saveSelector);

            productNameEl.SetValue(productName);
            searchElement.Click();

            // Wait until ajax request finishes.
            WrappedDriver
            .Wait(TimeSpan.FromSeconds(10))
            .Until(d => !productsGrid.IsBusy());

            // Select the first product that appears.
            var firstCheckbox = productsGrid
                                .GetCell(0, 0)
                                .FindElement(By.TagName("input"));

            var checkbox = new CheckboxElement(firstCheckbox);

            checkbox.Check(true);

            // Save.
            saveElement.Click();

            // Wait until the window handle no longer exists.
            WrappedDriver
            .Wait(TimeSpan.FromSeconds(10))
            .Until(d => !d.WindowHandles.Contains(newWindowHandle));

            // Switch back to the main window.
            WrappedDriver.SwitchTo().Window(currentWindowHandle);

            // Wait for the ajx request to finish.
            WrappedDriver
            .Wait(TimeSpan.FromSeconds(10))
            .UntilChain(d => AssociatedProductsGridComponent.IsBusy())
            .UntilChain(d => !AssociatedProductsGridComponent.IsBusy());

            return(this);
        }