public void TestSetup()
        {
            driver = webDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver)
            .AddSingleton(new PageOptions
            {
                Url = Startup.ServerUrl
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);

            widgetPage = pageObjectFactory.PreparePage <HomePage>()
                         .GoToWidget(
                "Bootstrap",
                "4.1",
                "Collapsable");

            collaspableComponent = pageObjectFactory.PrepareComponent(
                new CollapsableComponent <WidgetPage>(
                    new CollapsableOptions(
                        By.CssSelector("#multiCollapseExample1"),
                        new[] { By.CssSelector("#toggle-first") }),
                    driver,
                    widgetPage));
        }
        public static void Setup(TestContext testContext)
        {
            webDriverFactory = new WebDriverFactory();

            driver = webDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver)
            .AddSingleton(new PageOptions
            {
                Url = Startup.ServerUrl
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);

            widgetPage = pageObjectFactory.PreparePage <HomePage>()
                         .GoToWidget(
                "jQueryUI",
                "1.12",
                "TagEditor");

            tagEditor = pageObjectFactory.PrepareComponent(
                new TagEditorComponent <WidgetPage>(
                    By.CssSelector("#tageditor"),
                    driver,
                    widgetPage,
                    new TagEditorConfiguration()));
        }
Пример #3
0
        public void TestStartup()
        {
            driver = webDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver);
            serviceCollection.AddSingleton(new PageOptions
            {
                Url = Startup.ServerUrl
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);

            var homePage = pageObjectFactory.PreparePage <HomePage>();

            widgetPage = homePage.GoToWidget(
                "kendo",
                "2014.1.318",
                "KDatePicker");

            kDatePicker = pageObjectFactory.PrepareComponent(
                new KDatePickerComponent <WidgetPage>(
                    new KDatePickerConfiguration(),
                    By.CssSelector("#datepicker"),
                    driver,
                    widgetPage));
        }
        public void TestInitialize()
        {
            driver = WebDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver);
            serviceCollection.AddSingleton(new PageSettings
            {
                BaseUrl = new Uri("http://nopcommerce410.local/")
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);
            var homePage = pageObjectFactory.PreparePage <IHomePage>();

            // This verifies that there are at least two products in the cart.
            cartPage = homePage
                       .Login("*****@*****.**", "admin")
                       .Search("adidas consortium")
                       .GetResults()
                       .First()
                       .GoToProductPage()
                       .SetAttribute(
                term =>
            {
                return(term.TextHelper().InnerText.StartsWith(
                           "size",
                           StringComparison.OrdinalIgnoreCase));
            },
                detail =>
            {
                var select = new SelectElement(
                    detail.FindElement(
                        By.CssSelector("select")));

                select.SelectByIndex(2);
            })
                       .AddToCart()
                       .SetAttribute(
                term =>
            {
                return(term.TextHelper().InnerText.StartsWith(
                           "color",
                           StringComparison.OrdinalIgnoreCase));
            },
                detail =>
            {
                var blueColor = detail.FindElement(
                    By.CssSelector("li:nth-child(2) label"));

                blueColor.Click();
            })
                       .SetQuantity(4)
                       .AddToCart()
                       .GoToShoppingCart();

            orderSummary = cartPage.OrderSummary;
        }
        public void TestStartup()
        {
            driver = webDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver);
            serviceCollection.AddSingleton(new PageOptions
            {
                Url = Startup.ServerUrl
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);

            var homePage = pageObjectFactory.PreparePage <HomePage>();

            widgetPage = homePage.GoToWidget(
                "Bootstrap",
                "4.1",
                "NavsTab");

            navsTabComponent = pageObjectFactory.PrepareComponent(
                new NavsTabComponent <WidgetPage>(
                    By.CssSelector(".container.body-content"),
                    Array.Empty <ILoadableComponent>(),
                    driver,
                    new NavsTabComponentConfiguration(),
                    widgetPage));
        }
        public void TestStartup()
        {
            driver = webDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver);
            serviceCollection.AddSingleton(new PageOptions
            {
                Url = Startup.ServerUrl
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);

            var homePage = pageObjectFactory.PreparePage<HomePage>();

            widgetPage = homePage.GoToWidget(
                "kendo",
                "2014.1.318",
                "KDropDown");

            kDropDownComponent = new KDropDownComponent<WidgetPage>(
                new BaseKendoConfiguration
                {
                    ControlWithKeyboardInsteadOfMouse = true,
                    DataSource = new DataSourceOptions()
                },
                By.CssSelector("#dropdown"),
                driver,
                new KDropDownAnimationOptions(),
                widgetPage);
        }
Пример #7
0
        public void TestInitialize()
        {
            driver = WebDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver);
            serviceCollection.AddSingleton(new PageSettings
            {
                BaseUrl = new Uri("http://nopcommerce410.local/")
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);
            var loginPage = pageObjectFactory.PreparePage <PublicPO.Customer.ILoginPage>();

            // Login and go to the admin page. Then go to the admin customers
            // list page.
            editPage = loginPage
                       .Login("*****@*****.**", "password")
                       .AdminHeaderLinks
                       .GoToAdmin()
                       .MainSideBar
                       .GetItems()
                       .First(i => i.GetName() == "Customers")
                       .Expand()
                       .GetItems()
                       .First(i => i.GetName() == "Customers")
                       .Select <AdminPO.Customers.IListPage>()
                       .GetListedCustomers()
                       .First()
                       .Edit();
        }
        public void TestStartup()
        {
            driver = WebDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver)
            .AddSingleton(new PageOptions
            {
                Url = Startup.ServerUrl
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);

            pageObjectFactory.PreparePage <HomePage>()
            .GoToWidget(
                "TinyMCE",
                "4.0",
                "TinyMCE");

            tinyMCE = pageObjectFactory.PrepareComponent(
                new TinyMCEComponent(
                    By.CssSelector("textarea"),
                    pageObjectFactory,
                    driver,
                    new TinyMCEOptions()));

            menu = tinyMCE.Menu;
        }
Пример #9
0
        public void TestInitialize()
        {
            driver = WebDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver);
            serviceCollection.AddSingleton(new PageSettings
            {
                BaseUrl = new Uri("http://nopcommerce410.local/")
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);
            var homePage = pageObjectFactory.PreparePage <PublicPO.Home.IHomePage>();

            // Login and go to the admin page.
            this.homePage = homePage
                            .Login("*****@*****.**", "admin")
                            .AdminHeaderLinks
                            .GoToAdmin();

            mainHeaderComponent = this.homePage.NavigationBar;
        }
Пример #10
0
        public void TestSetup()
        {
            driver = WebDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver)
            .AddSingleton(new PageOptions
            {
                Url = Startup.ServerUrl
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);

            widgetPage = pageObjectFactory.PreparePage <HomePage>()
                         .GoToWidget(
                "jQueryUI",
                "1.12",
                "Accordian");

            accordionComponent = pageObjectFactory.PrepareComponent(
                new AccordionComponent <WidgetPage>(
                    new AccordionComponentOptions(),
                    By.CssSelector("#accordion"),
                    pageObjectFactory,
                    driver,
                    widgetPage));
        }
        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();
                });
            }
        }
Пример #12
0
        public IWebDriver InitDriver()
        {
            var webDriver     = TestContext.Parameters["WebDriverType"];
            var webDriverType = String.IsNullOrEmpty(webDriver) ? WebDriverType.Local : (WebDriverType)Enum.Parse(typeof(WebDriverType), webDriver);
            var browser       = TestContext.Parameters["Browser"];
            var browserType   = String.IsNullOrEmpty(browser) ? BrowserType.Chrome : (BrowserType)Enum.Parse(typeof(BrowserType), browser);

            return(WebDriverFactory.CreateDriver(webDriverType, browserType, TestContext.CurrentContext));
        }
Пример #13
0
        public void RetryRefused(bool retry)
        {
            WebDriverFactory.CreateDriver(() =>
            {
                throw new WebDriverTimeoutException("refused");
            }, retry);

            Assert.Fail("Exception should have been thrown ");
        }
Пример #14
0
        public static void FactoryMethodWithWebDriverExample()
        {
            Console.WriteLine("Please select what driver do you want to use?");
            string driverName = Console.ReadLine();

            ICustomWebDriver driver = WebDriverFactory.CreateDriver(driverName);

            driver.GetTitle();
            driver.Quit();
        }
Пример #15
0
        public void SetUpForEveryTestMethod()
        {
            ReportHelper.AddTestMethodMetadataToReport(TestContext.CurrentContext);
            var webDriver = TestContext.Parameters["WebDriverType"];

            WebDriverType = String.IsNullOrEmpty(webDriver) ? WebDriverType.Local : (WebDriverType)Enum.Parse(typeof(WebDriverType), webDriver);
            var browser = TestContext.Parameters["Browser"];

            BrowserType = String.IsNullOrEmpty(browser) ? BrowserType.Chrome : (BrowserType)Enum.Parse(typeof(BrowserType), browser);
            Driver      = WebDriverFactory.CreateDriver(WebDriverType, BrowserType, TestContext.CurrentContext);
        }
Пример #16
0
        public void Load()
        {
            var factory = new WebDriverFactory();
            var driver  = factory.CreateDriver(MajorWebDriver.Firefox,
                                               new Size(1000, 1001));

            using (driver)
            {
                var page = new DemoPage(driver);
                page.Load();
            }
        }
Пример #17
0
        public void KendoPagerComponentTest(MajorWebDriver driverType)
        {
            var driver = WebDriverFactory.CreateDriver(
                driverType,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver);
            serviceCollection.AddSingleton(new PageOptions
            {
                Url = Startup.ServerUrl
            });

            PageObjectFactory = new PageObjectFactory(serviceCollection, true);

            using (driver)
            {
                var homePage = PageObjectFactory.PreparePage <HomePage>();

                widgetPage = homePage.GoToWidget("kendo",
                                                 "2014.1.318",
                                                 "KPager");

                var pagerComponent = PageObjectFactory.PrepareComponent(
                    new KPagerComponent <WidgetPage>(
                        new BaseKendoConfiguration(),
                        By.CssSelector("#pager"),
                        PageObjectFactory,
                        driver,
                        widgetPage));

                pagerComponent.Refresh();
                var availbleSizes     = pagerComponent.GetAvailableItemsPerPage();
                var activePageSize    = pagerComponent.GetItemsPerPage();
                var totalItems        = pagerComponent.GetTotalItems();
                var initialActivePage = pagerComponent.GetActivePage();
                pagerComponent.NextPage();
                var secondActivePage = pagerComponent.GetActivePage();
                pagerComponent.PrevPage();
                pagerComponent.LastPage();
                pagerComponent.FirstPage();

                CollectionAssert.AreEqual(new[] { 2, 4 }, availbleSizes.ToArray());
                Assert.AreEqual(totalItems, 4);
                Assert.IsTrue(pagerComponent.HasNextPage);
                Assert.IsFalse(pagerComponent.HasPreviousPage);
                Assert.AreEqual(initialActivePage, 1);
                Assert.AreEqual(secondActivePage, 2);
                Assert.AreEqual(2, activePageSize);
            }
        }
        public void TestInitialize()
        {
            driver = WebDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver);
            serviceCollection.AddSingleton(new PageSettings
            {
                BaseUrl = new Uri("http://nopcommerce410.local/")
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);
        }
        public void TestSetup()
        {
            driver = webDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver);
            serviceCollection.AddSingleton(new PageOptions
            {
                Url = Startup.ServerUrl
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);
            homePage          = pageObjectFactory.PreparePage <HomePage>();
        }
        public static void ClassSetup(TestContext testContext)
        {
            webDriverFactory = new WebDriverFactory();
            driver           = webDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection
            .AddSingleton(driver)
            .AddSingleton(new PageOptions {
                Url = Startup.ServerUrl
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);
            pageObjectFactory.PreparePage <HomePage>();
        }
Пример #21
0
        private void initializeSenators()
        {
            List <Thread> webDriverThreads = new List <Thread>();

            foreach (Senator senator in senators)
            {
                Thread webDriverThread = new Thread(() => {
                    senator.driver = factory.CreateDriver();
                    senator.driver.Navigate().GoToUrl(mainPage);
                    senator.pages.pageLogin = new PageLogin(senator.driver);
                    senator.pages.pageLogin.login(senator.username, loginPass);
                    senator.pages.pageMainMenu = new PageMainMenu(senator.driver);
                    senatorsLogged++;
                });
                webDriverThread.Start();
                webDriverThreads.Add(webDriverThread);
            }
            foreach (Thread thread in webDriverThreads)
            {
                thread.Join();
            }
        }
Пример #22
0
        public void TestInitialize()
        {
            driver = webDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver);
            serviceCollection.AddSingleton(new PageOptions
            {
                Url = Startup.ServerUrl
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);

            var homePage = pageObjectFactory.PreparePage <HomePage>();

            widgetPage = homePage.GoToWidget(
                "kendo",
                "2014.1.318",
                "KMultiSelect");

            kMultiSelect = pageObjectFactory.PrepareComponent(
                new KMultiSelectComponent <WidgetPage>(
                    By.CssSelector("#my-multiselect"),
                    driver,
                    new KMultiSelectConfiguration
            {
                AutoClose        = false,
                AnimationOptions = new KMultiSelectAnimationOptions
                {
                    AnimationDuration = TimeSpan.FromSeconds(1),
                    AnimationsEnabled = true
                }
            },
                    widgetPage));
        }
        public void TestStartup()
        {
            driver = WebDriverFactory.CreateDriver(
                MajorWebDriver.Chrome,
                WindowSize.DefaultDesktop);

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddSingleton(driver)
            .AddSingleton(new PageOptions
            {
                Url = Startup.ServerUrl
            });

            pageObjectFactory = new PageObjectFactory(serviceCollection);

            widgetPage = pageObjectFactory.PreparePage <HomePage>()
                         .GoToWidget(
                "jQueryUI",
                "1.12",
                "DatePicker");

            datepickerInline = pageObjectFactory.PrepareComponent(
                new DatePickerComponent <WidgetPage>(
                    By.CssSelector("#datepicker1"),
                    new DatePickerComponentOptions(),
                    driver,
                    widgetPage));

            datepickerPopUp = pageObjectFactory.PrepareComponent(
                new DatePickerComponent <WidgetPage>(
                    By.CssSelector("#datepicker2"),
                    new DatePickerComponentOptions(),
                    driver,
                    widgetPage));
        }
Пример #24
0
 public void Setup()
 {
     _driver = WebDriverFactory.CreateDriver(Browser.Chrome);
     _form   = new Form(_driver);
 }
Пример #25
0
 public void Setup()
 {
     _driver = WebDriverFactory.CreateDriver(Browser.Chrome);
     _grid   = new Grid(_driver);
 }
Пример #26
0
 private void BeforeScenario()
 {
     driver = WebDriverFactory.CreateDriver((DriverType)Enum.Parse(typeof(DriverType), ConfigurationManager.AppSettings["DriverType"]));
 }
Пример #27
0
        public void SetupBeforeEveryTest()
        {
            var factory = new WebDriverFactory();

            Driver = factory.CreateDriver(TypeOfDriver.Chrome);
        }
Пример #28
0
 private static void Setup()
 {
     driver = WebDriverFactory.CreateDriver((DriverType)Enum.Parse(typeof(DriverType), ConfigurationManager.AppSettings["DriverType"]));
 }
Пример #29
0
 public static void Init(string driverName)
 {
     _driver = WebDriverFactory.CreateDriver(driverName);
     Page    = new Page(_driver);
     App     = new App(_driver, false);
 }
        private void CreateDriver()
        {
            WebDriverFactory factory = new WebDriverFactory();

            Driver = factory.CreateDriver(TypeOfDriver.Chrome);
        }