Example #1
0
 public void FirstTest()
 {
     driver.Url = "http://www.google.com/";
     driver.FindElement(By.Name("q")).SendKeys("webdriver");
     driver.FindElement(By.Name("btnK")).Click();
     wait.Until(ExpectedConditions.TitleIs("webdriver - חיפוש ב-Google"));
 }
Example #2
0
        private A_CatalogPage DoSave()
        {
            _saveButton.Click();

            _wait.Until(ExpectedConditions.TitleIs("Catalog | My Store"));
            return(new A_CatalogPage(_driver, _wait));
        }
Example #3
0
        public void FithfTest()
        {
            driver.Url = "http://localhost/litecart/admin/?app=geo_zones&doc=geo_zones";
            driver.FindElement(By.Name("username")).SendKeys("admin");
            driver.FindElement(By.Name("password")).SendKeys("admin");
            driver.FindElement(By.Name("login")).Click();
            wait.Until(ExpectedConditions.TitleIs("Geo Zones | My Store"));

            int all = driver.FindElements(By.CssSelector(".row")).Count();

            for (int i = 0; i < all; i++)
            {
                List <IWebElement> menu = null;
                menu = new List <IWebElement>(driver.FindElements(By.CssSelector(".row")));

                List <IWebElement> country = null;
                country = new List <IWebElement>(menu[i].FindElements(By.TagName("td")));
                country[2].FindElement(By.CssSelector("a")).Click();
                wait.Until(ExpectedConditions.TitleIs("Edit Geo Zone | My Store"));
                List <IWebElement> statelist = null;
                statelist = new List <IWebElement>(driver.FindElements(By.CssSelector("#table-zones td:nth-child(3)")));
                foreach (IWebElement staterow in statelist)
                {
                    rowrow.Add(staterow.FindElement(By.CssSelector("[selected=selected]")).Text);
                }
                Letters(rowrow);

                driver.Navigate().Back();
            }
            driver.Close();
        }
Example #4
0
 public void FirstTest()
 {
     driver.Url = "http://www.google.com/";
     driver.FindElement(By.Name("q")).SendKeys("webdriver");
     driver.FindElement(By.Name("btnK")).Click();
     Assert.IsTrue(IsElementPresent(By.CssSelector(".rc")));
     wait.Until(ExpectedConditions.TitleIs("webdriver - Пошук Google"));
 }
Example #5
0
 public void Task8_Setup()
 {
     driver = new ChromeDriver();
     wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(WAIT_TIMEOUT));
     driver.Manage().Window.Maximize();
     driver.Navigate().GoToUrl(ADMIN_URL);
     wait.Until(ExpectedConditions.TitleIs(EXPECTED_TITLE));
 }
 public void FirstTest()
 {
     driver.Url = "http://localhost/litecart/admin/login.php?redirect_url=%2Flitecart%2Fadmin%2F";
     driver.FindElement(By.Name("username")).SendKeys("admin");
     driver.FindElement(By.Name("password")).SendKeys("admin");
     driver.FindElement(By.Name("login")).Click();
     wait.Until(ExpectedConditions.TitleIs("My Store"));
 }
 public void FirstTest()
 {
     driver.Url = "https://www.google.com/";
     driver.FindElement(By.Name("q")).SendKeys("webdriver");
     wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@jsname='VlcLAe']//*[@value='Поиск в Google']")));
     driver.FindElement(By.XPath("//div[@jsname='VlcLAe']//*[@value='Поиск в Google']")).Click();
     wait.Until(ExpectedConditions.TitleIs("webdriver - Поиск в Google"));
 }
Example #8
0
 public void ClickToAllSections()
 {
     OpenMainPage();
     Login("admin", "admin");
     wait.Until(ExpectedConditions.TitleIs("My Store"));
     AssertLogin();
     ClickAllMenus();
 }
Example #9
0
 public void TestOnLitecart()
 {
     driver.Url = "http://localhost/litecart/en/";
     driver.FindElement(By.ClassName("active")).Click();
     //driver.FindElement(By.XPath(".//*[@data-name='Red Duck']")).Click();
     driver.FindElement(By.LinkText("Regional Settings")).Click();
     wait.Until(ExpectedConditions.TitleIs("Regional Settings | My Store"));
 }
 public void RemoteWebDriver()
 {
     driver.Url = "http://www.google.com/";
     driver.FindElement(By.Name("q")).SendKeys("webdriver");
     driver.FindElement(By.Name("q")).Submit();
     Thread.Sleep(10000);
     wait.Until(ExpectedConditions.TitleIs("webdriver - Google Search"));
 }
Example #11
0
 // Проверка заголовка страницы после авторизации
 // Верный логин и пароль, нажатие enter, чекбокс не отмечен
 public void ValidLoginAndEnterRedirectToPageWithDashboardTitle()
 {
     driver.Url = loginPage;
     driver.FindElement(By.Name("username")).SendKeys("admin");
     driver.FindElement(By.Name("password")).SendKeys("admin");
     driver.FindElement(By.Name("password")).SendKeys(Keys.Enter);
     wait.Until(ExpectedConditions.TitleIs("Dashboard | My Store"));
 }
 public void ThenIShouldSeeAvatarButtonOnReloadedHomePage()
 {
     Assert.Multiple(() =>
     {
         Assert.IsTrue(_conciseApi.AssertThat(ExpectedConditions.TitleIs(_homePage.Title)));
         Assert.IsTrue(_homePage.IsLoginAvatarButtonDisplayed());
     });
 }
Example #13
0
 static void login(IWebDriver driver, WebDriverWait wait)
 {
     driver.Url = "http://localhost/litecart/admin/login.php";
     driver.FindElement(By.Name("username")).SendKeys("admin");
     driver.FindElement(By.Name("password")).SendKeys("admin");
     driver.FindElement(By.Name("login")).Click();
     wait.Until(ExpectedConditions.TitleIs("My Store"));
 }
Example #14
0
 public void liteCartAdminLoginTest()
 {
     driver.Url = "http://localhost/litecart/admin/";
     driver.FindElement(By.Name("username")).SendKeys("admin");
     driver.FindElement(By.Name("password")).SendKeys("admin");
     driver.FindElement(By.Name("login")).Click();
     wait.Until(ExpectedConditions.TitleIs("My Store"));
 }
Example #15
0
 public void LogInTest()
 {
     OpenMainPage();
     Login("admin", "admin");
     wait.Until(ExpectedConditions.TitleIs("My Store"));
     AssertLogin();
     Logout();
 }
Example #16
0
        public void TestSwitchBrowserWindowNull()
        {
            Driver.Navigate().GoToUrl(IndexPage.Url);
            var index = new IndexPage(Driver);

            index.AjaxyControlNewWindowLink.Click();
            Assert.IsNull(Driver.SwitchBrowserWindow(ExpectedConditions.TitleIs("false")));
        }
Example #17
0
 public void TestSetup()
 {
     driver = new ChromeDriver();
     wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(timeout));
     driver.Navigate().GoToUrl(m_baseURL);
     driver.Manage().Window.Maximize();
     wait.Until(ExpectedConditions.TitleIs(m_expectedTitle));
 }
 public void FirstTest()
 {
     driver.Url = " http://localhost/litecart/admin/";
     driver.FindElement(By.Name("username")).SendKeys("admin");
     driver.FindElement(By.Name("password")).SendKeys("admin");
     driver.FindElement(By.Name("login")).Click();
     wait.Until(ExpectedConditions.TitleIs("webdriverghjghjghjghjfgh - Поиск в Google"));
 }
Example #19
0
 public void LitecartLoginNightly()
 {
     NightlyDriver.Url = "http://localhost:8080/litecart/admin/login.php";
     NightlyDriver.FindElement(By.Name("username")).SendKeys("admin");
     NightlyDriver.FindElement(By.Name("password")).SendKeys("admin");
     NightlyDriver.FindElement(By.Name("login")).Click();
     wait.Until(ExpectedConditions.TitleIs("My Store"));
 }
 public void EasyTest()
 {
     driver.Manage().Window.Maximize();
     driver.Url = ("http://Google.com");
     driver.FindElement(By.Name("q")).SendKeys("WebDriver");
     driver.FindElement(By.Name("btnG")).Click();
     wait.Until(ExpectedConditions.TitleIs("WebDriver - Google Search"));
 }
Example #21
0
 public void FirstTest()
 {
     driver.Navigate().GoToUrl("http://www.google.com/");
     driver.FindElement(By.Name("q")).SendKeys("webdriver");
     //driver.FindElement(By.Name("q")).Click();
     driver.FindElement(By.Name("q")).SendKeys(Keys.Enter);
     wait.Until(ExpectedConditions.TitleIs("webdriver - Поиск в Google"));
 }
Example #22
0
        private void Test10(IWebDriver driver, WebDriverWait wait, string fontWeight)
        {
            driver.Url = "http://localhost:8080/litecart/";

            var productName     = driver.FindElements(By.CssSelector("div#box-campaigns div.content div.name"));
            var productNameText = productName[0].Text;

            var RegularPrice            = driver.FindElement(By.CssSelector("div#box-campaigns div.content div.price-wrapper s.regular-price"));
            var RegularPriceText        = RegularPrice.Text;
            var RegularPriceColorString = RegularPrice.GetCssValue("color");
            var RegularPriceColor       = GetColorFromStringRgb(RegularPriceColorString);
            var RegularPriceDecoration  = RegularPrice.GetCssValue("text-decoration").Contains("line-through");
            var RegularPriceFontSize    = RegularPrice.GetCssValue("font-size");

            var CampaignPrice            = driver.FindElement(By.CssSelector("div#box-campaigns div.content div.price-wrapper strong.campaign-price"));
            var CampaignPriceText        = CampaignPrice.Text;
            var CampaignPriceColorString = CampaignPrice.GetCssValue("color");
            var CampaignPriceColor       = GetColorFromStringRgb(CampaignPriceColorString);
            var CampaignPriceDecoration  = CampaignPrice.GetCssValue("font-weight").Contains(fontWeight);
            var CampaignPriceFontSize    = CampaignPrice.GetCssValue("font-size");

            var divElements = driver.FindElements(By.CssSelector("div#box-campaigns div.image-wrapper"));

            divElements[0].Click();
            wait.Until(ExpectedConditions.TitleIs("Yellow Duck | Subcategory | Rubber Ducks | My Store"));
            var productNameUpd     = driver.FindElement(By.CssSelector("div#box-product h1.title"));
            var productNameUpdText = productNameUpd.Text;

            var RegularPriceUpd            = driver.FindElement(By.CssSelector("div#box-product div.content div.information div.price-wrapper s.regular-price"));
            var RegularPriceUpdText        = RegularPriceUpd.Text;
            var RegularPriceUpdColorString = RegularPriceUpd.GetCssValue("color");
            var RegularPriceUpdColor       = GetColorFromStringRgb(RegularPriceUpdColorString);
            var RegularPriceUpdDecoration  = RegularPriceUpd.GetCssValue("text-decoration").Contains("line-through");
            var RegularPriceFontSizeUpd    = RegularPriceUpd.GetCssValue("font-size");

            var CampaignPriceUpd            = driver.FindElement(By.CssSelector("div#box-product div.content div.information div.price-wrapper strong.campaign-price"));
            var CampaignPriceUpdText        = CampaignPriceUpd.Text;
            var CampaignPriceUpdColorString = CampaignPriceUpd.GetCssValue("color");
            var CampaignPriceUpdColor       = GetColorFromStringRgb(CampaignPriceUpdColorString);
            var CampaignPriceUpdDecoration  = CampaignPriceUpd.GetCssValue("font-weight").Contains("700");
            var CampaignPriceFontSizeUpd    = CampaignPriceUpd.GetCssValue("font-size");

            Assert.AreEqual(productNameText, productNameUpdText);
            Assert.AreEqual(RegularPriceText, RegularPriceUpdText);
            Assert.AreEqual(CampaignPriceText, CampaignPriceUpdText);
            Assert.IsTrue(RegularPriceColor.R == RegularPriceColor.G &&
                          RegularPriceColor.R == RegularPriceColor.B);
            Assert.IsTrue(RegularPriceUpdColor.R == RegularPriceUpdColor.G &&
                          RegularPriceUpdColor.R == RegularPriceUpdColor.B);
            Assert.IsTrue(CampaignPriceColor.G == 0 && CampaignPriceColor.B == 0);
            Assert.IsTrue(CampaignPriceUpdColor.G == 0 && CampaignPriceUpdColor.B == 0);
            Assert.IsTrue(RegularPriceDecoration);
            Assert.IsTrue(RegularPriceUpdDecoration);
            Assert.IsTrue(CampaignPriceDecoration);
            Assert.IsTrue(CampaignPriceUpdDecoration);
            Assert.Greater(CampaignPriceFontSize, RegularPriceFontSize);
            Assert.Greater(CampaignPriceFontSizeUpd, RegularPriceFontSizeUpd);
        }
Example #23
0
        public void UserRegistration()
        {
            driver.Url = "http://localhost/litecart/";
            wait.Until(ExpectedConditions.TitleIs("Online Store | My Store"));

            driver.FindElement(By.LinkText("New customers click here")).Click();

            Dictionary <string, string> accountInformation = new Dictionary <string, string>();

            accountInformation.Add("tax_id", "0000001");
            accountInformation.Add("company", "Sherlock LTD");
            accountInformation.Add("firstname", "Sherlock");
            accountInformation.Add("lastname", "Holmes");
            accountInformation.Add("address1", "Baker Street 221B");
            accountInformation.Add("address2", "W1 6XE");
            accountInformation.Add("postcode", "WC2N 5DU");
            accountInformation.Add("city", "London");

            foreach (KeyValuePair <string, string> entry in accountInformation)
            {
                string element = entry.Key;
                string val     = entry.Value;

                IWebElement regText = driver.FindElement(By.Name(element));
                regText.SendKeys(val);
            }

            SelectElement country = new SelectElement(driver.FindElement(By.Name("country_code")));

            country.SelectByText("United Kingdom");

            driver.FindElement(By.Name("email")).SendKeys("*****@*****.**");
            driver.FindElement(By.Name("phone")).SendKeys("+4498752264999");
            driver.FindElement(By.Name("password")).SendKeys("sherlock999");
            driver.FindElement(By.Name("confirmed_password")).SendKeys("sherlock999");

            driver.FindElement(By.Name("create_account")).Click();

            IWebElement isUserLogged = driver.FindElement(By.LinkText("Logout"));

            NUnit.Framework.Assert.AreEqual(isUserLogged.Text, "Logout");

            isUserLogged.Click();

            driver.FindElement(By.Name("email")).SendKeys("*****@*****.**");
            driver.FindElement(By.Name("password")).SendKeys("sherlock999");

            driver.FindElement(By.Name("login")).Click();
            IWebElement isUserLoggedAfterLogin = driver.FindElement(By.LinkText("Logout"));

            NUnit.Framework.Assert.AreEqual(isUserLoggedAfterLogin.Text, "Logout");

            isUserLoggedAfterLogin.Click();

            IWebElement isUserLoggedOut = driver.FindElement(By.CssSelector(".success"));

            NUnit.Framework.Assert.AreEqual(isUserLoggedOut.Text, "You are now logged out.");
        }
Example #24
0
        public void ThirdTest()
        {
            driver.Url = "http://localhost/litecart/admin/?app=countries&doc=countries";
            driver.FindElement(By.Name("username")).SendKeys("admin");
            driver.FindElement(By.Name("password")).SendKeys("admin");
            driver.FindElement(By.Name("login")).Click();

            wait.Until(ExpectedConditions.TitleIs("Countries | My Store"));


            int countryCount = driver.FindElements(By.CssSelector("tr.row td:nth-of-type(5) > a")).Count;

            string[] CountryTitles     = new string[countryCount];
            string[] CountryToBeSorted = new string[countryCount];


            for (int i = 0; i <= countryCount - 1; i++)
            {
                List <IWebElement> Countries = driver.FindElements(By.CssSelector("tr.row td:nth-of-type(5) > a")).ToList();
                string             text      = Countries[i].Text;
                CountryTitles[i]     = text;
                CountryToBeSorted[i] = text;
            }

            Array.Sort <string>(CountryToBeSorted);
            if (!CountryTitles.SequenceEqual(CountryToBeSorted))
            {
                throw new Exception("Countries are in not alphabetical order ");
            }


            for (int i = 0; i <= countryCount - 1; i++)
            {
                List <IWebElement> Countries          = driver.FindElements(By.CssSelector("tr.row td:nth-of-type(5) > a")).ToList();
                List <IWebElement> CountriesWithZones = driver.FindElements(By.CssSelector("tr.row td:nth-of-type(6)")).ToList();
                int NofZones = Int32.Parse(CountriesWithZones[i].GetAttribute("innerText"));
                if (NofZones > 0)
                {
                    Countries[i].Click();
                    int      ZoneCount      = driver.FindElements(By.CssSelector("tr td:nth-of-type(3) > input[type=hidden]")).Count;
                    string[] ZoneTitles     = new string[ZoneCount];
                    string[] ZoneToBeSorted = new string[ZoneCount];
                    for (int k = 0; k <= ZoneCount - 1; k++)
                    {
                        List <IWebElement> Zones = driver.FindElements(By.CssSelector("tr td:nth-of-type(3) > input[type=hidden]")).ToList();
                        string             text  = Zones[k].GetAttribute("value");
                        ZoneTitles[k]     = text;
                        ZoneToBeSorted[k] = text;
                    }
                    Array.Sort <string>(ZoneToBeSorted);
                    if (!ZoneTitles.SequenceEqual(ZoneToBeSorted))
                    {
                        throw new Exception("Zones are in not alphabetical order ");
                    }
                    driver.Navigate().Back();
                }
            }
        }
 public void TestCase()
 {
     driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(WAIT_TIMEOUT);
     driver.Manage().Timeouts().PageLoad     = TimeSpan.FromSeconds(60);
     driver.Manage().Window.Maximize();
     driver.Navigate().GoToUrl(URL);
     System.Threading.Thread.Sleep(5000);
     wait.Until(ExpectedConditions.TitleIs(EXPECTED_TITLE));
 }
Example #26
0
        public void Admin_AddProduct()
        {
//Задание 12. Сделайте сценарий добавления товара
//Сделайте сценарий для добавления нового товара (продукта) в учебном приложении litecart (в админке).

//Для добавления товара нужно открыть меню Catalog, в правом верхнем углу нажать кнопку "Add New Product", заполнить поля с информацией о товаре и сохранить.

//Достаточно заполнить только информацию на вкладках General, Information и Prices. Скидки (Campains) на вкладке Prices можно не добавлять.
// есть выпадающие списки с одним вариантом выбора -- конечно их можно пропустить
//После сохранения товара нужно убедиться, что он появился в каталоге (в админке). Клиентскую часть магазина можно не проверять.
            _driver.Navigate().GoToUrl("http://localhost/litecard/admin");
            _wait.Until(ExpectedConditions.TitleIs("My Store"));

            var testProduct = new Product()
            {
                Status          = "Enabled",
                Name            = "Test Duck_" + Base.GetRandomString(10), // можно timestamp вкрутить, как вариант
                Code            = "test",
                Categories      = new[] { "Rubber Ducks", "Subcategory" },
                DefaultCategory = "Subcategory",
                ProductGroups   = new [] { "Female", "Unisex" },
                Quantity        = 10,
                SoldOutStatus   = "Temporary sold out",
                ImagesUrls      = new [] { @"c:\\TEMP\\test_duck.png" },
                DateValidFrom   = "01122016",
                DateValidTo     = "01122017",

                //Information
                Manufacturer     = "ACME Corp.",
                Keywords         = "keywords data text",
                ShortDescription = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                Description      = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n Suspendisse sollicitudin ante massa, eget ornare libero porta congue. Cras scelerisque dui non consequat sollicitudin. Sed pretium tortor ac auctor molestie. Nulla facilisi. ",
                HeadTitle        = "Head title text",
                MetaDescription  = "meta text",
                //Prices
                PurchasePriceValue    = 9.5f,
                PurchasePriceCurrency = "Euros",
                PriceUsd = 11,
                PriceEur = 10.12f,
            };


            var newPoductPage = new LoginPage(_driver, _wait)
                                .DoLogin(@"admin", @"admin")
                                .OpenCatalog()
                                .OpenAddNewProduct();

            newPoductPage
            .FillNewProductData(testProduct);

            //После сохранения товара нужно убедиться, что он появился в каталоге (в админке). Клиентскую часть магазина можно не проверять.
            var productList = new A_CatalogPage(_driver, _wait)
                              .SearchProduct(testProduct.Name)
                              .GetProductNamesList();

            Assert.That(productList.Count == 1, "Продукт не найден");  // уникальность имени обеспечивается функцией Base.GetRandomString, на поиск товара в списке уже не хватило сил :)
        }
Example #27
0
        public void FirstTest()
        {
            driver.Url = "http://www.google.com/";
            IWebElement element = wait.Until(d => d.FindElement(By.Name("q")));

            driver.FindElement(By.Name("q")).SendKeys("webdriver");
            driver.FindElement(By.Name("btnG")).Click();
            wait.Until(ExpectedConditions.TitleIs("webdriver - Поиск в Google"));
        }
Example #28
0
        public void TestPractice()
        {
            driver.Url = "https://www.google.com/";
            IWebElement element = wait.Until(d => d.FindElement(By.Name("q")));

            element.SendKeys("webdriver" + Keys.Escape);
            driver.FindElement(By.Name("btnK")).Click();
            wait.Until(ExpectedConditions.TitleIs("webdriver - Пошук Google"));
        }
Example #29
0
        public void FirstTest()
        {
            driver.Url = "http://www.google.com/";
            driver.FindElement(By.Name("q")).SendKeys("webdriver");
            driver.FindElement(By.Name("btnK")).Submit();

            // явное ожидание появления элемента
            wait.Until(ExpectedConditions.TitleIs("webdriver - Поиск в Google"));
        }
Example #30
0
 // Проверка заголовка страницы после авторизации
 // Верный логин и пароль, нажатие на кнопку, чекбокс отмечен
 public void ValidLoginCheckBoxAndButtonClickRedirectToPageWithDashboardTitle()
 {
     driver.Url = loginPage;
     driver.FindElement(By.Name("username")).SendKeys("admin");
     driver.FindElement(By.Name("password")).SendKeys("admin");
     driver.FindElement(By.Name("remember_me")).Click();
     driver.FindElements(By.Name("login")).Last().Click();
     wait.Until(ExpectedConditions.TitleIs("Dashboard | My Store"));
 }