public bool CheckZonesAndCountriesOrder()
        {
            var indexZones    = GetIndexZones();
            var indexName     = GetIndexCountryName();
            var countriesList = new List <string>();

            // Проходим по всему списку таблицы стран
            for (var i = 0; i < BaseSelenium.GetCountRowsInTable(); i++)
            {
                // Выделяем страну и кол-во зон в стране
                var row        = BaseSelenium.GetTableRowOfIndex(i);
                var zonesCount = BaseSelenium.GetElementOfIndexFromRow(row, indexZones).Text;
                var country    = BaseSelenium.GetElementOfIndexFromRow(row, indexName).Text;
                countriesList.Add(country);
                // Заходим в страну и проверяем порядок зон
                if (Convert.ToInt32(zonesCount) == 0)
                {
                    continue;
                }
                BaseSelenium.Click(BaseSelenium.GetElementOfIndexFromRow(row, indexName)
                                   .FindElement(By.CssSelector("a")));
                if (!Page.AdminEditCountry.CheckZonesOrder())
                {
                    return(false);
                }
                WebDriver.Driver.Navigate().Back();
            }
            return(Compare.CompareLists(countriesList));
        }
示例#2
0
 public void OpenAllFolders()
 {
     while (BaseAsserts.IsElementPresent(By.CssSelector(".fa-folder")))
     {
         BaseSelenium.Click(WebDriver.Driver.FindElement(By.XPath("//*[@class='fa fa-folder']/../a")));
     }
 }
示例#3
0
        public void AttachFile()
        {
            var path = Path.GetDirectoryName(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory)) +
                       "\\Images\\Product.png";

            BaseSelenium.FillText(_file, path);
        }
示例#4
0
        public bool MenuChecker()
        {
            // Идем по списку всех элементов меню
            for (var i = 0; i < WebDriver.Driver.FindElements(By.Id("app-")).Count; i++)
            {
                var menuItem = WebDriver.Driver.FindElements(By.Id("app-"))[i];
                BaseSelenium.Click(menuItem);

                // Если есть подменю, то проходим и по нему
                if (BaseAsserts.IsElementPresent(By.CssSelector("ul.docs li")))
                {
                    for (var j = 0; j < WebDriver.Driver.FindElements(By.CssSelector("ul.docs li")).Count; j++)
                    {
                        menuItem = WebDriver.Driver.FindElements(By.CssSelector("ul.docs li"))[j];
                        BaseSelenium.Click(menuItem);
                        if (!BaseAsserts.IsElementPresent(By.CssSelector("h1")))
                        {
                            return(false);
                        }
                    }
                }
                if (!BaseAsserts.IsElementPresent(By.CssSelector("h1")))
                {
                    return(false);
                }
            }
            return(true);
        }
示例#5
0
 public void RemoveAllProducts()
 {
     while (BaseAsserts.IsElementPresent(By.CssSelector("[name=remove_cart_item]")))
     {
         BaseSelenium.Click(WebDriver.Driver.FindElement(By.CssSelector("[name=remove_cart_item]")));
         WebDriver.Wait.Until(ExpectedConditions.StalenessOf(_ordersList.First()));
     }
 }
示例#6
0
        public void ClickAddToCart()
        {
            var count = Convert.ToInt32(_quantityInCart.Text);

            if (BaseAsserts.IsElementPresent(By.CssSelector("[name*=Size]")))
            {
                SelectProductSize("Medium");
            }
            BaseSelenium.Click(_addToCart);
            BaseWaitings.WaitTextPresent(_quantityInCart, (count + 1).ToString());
        }
        public bool CheckZonesOrder()
        {
            var indexZone = GetIndexZone();
            var zonesList = new List <string>();

            for (var i = 0; i < _rowsList.Count - 1; i++)
            {
                zonesList.Add(BaseSelenium.GetElementOfIndexFromRow(_rowsList[i], indexZone)
                              .FindElement(By.CssSelector("option[selected='selected']")).Text);
            }
            return(Compare.CompareLists(zonesList));
        }
示例#8
0
 public void TestProductsInCart()
 {
     Page.Main.ClickMostPopularProductByIndex(0);
     Page.Product.ClickAddToCart();
     BaseSelenium.BackToPage();
     Page.Main.ClickMostPopularProductByIndex(0);
     Page.Product.ClickAddToCart();
     BaseSelenium.BackToPage();
     Page.Main.ClickMostPopularProductByIndex(0);
     Page.Product.ClickAddToCart();
     Page.Product.CheckoutCart();
     Page.Cart.RemoveAllProducts();
     Assert.IsTrue(Page.Cart.CheckEmptyCart());
 }
 public bool CheckExternalLinks()
 {
     foreach (var v in _externalLinksList)
     {
         var oldWins = WebDriver.Driver.WindowHandles;
         var curWin  = WebDriver.Driver.CurrentWindowHandle;
         BaseSelenium.Click(v);
         BaseWaitings.WaitOpenNewWindow(oldWins);
         BaseSelenium.SwitchToWindow(WebDriver.Driver.WindowHandles.Last());
         WebDriver.Driver.Close();
         BaseSelenium.SwitchToWindow(curWin);
     }
     return(true);
 }
示例#10
0
        public bool CheckLogsWhenProductOpen()
        {
            var count = WebDriver.Driver.FindElements(By.CssSelector("td > img")).Count;

            for (var i = 0; i < count; i++)
            {
                IList <IWebElement> list = WebDriver.Driver.FindElements(By.XPath("//td/img/../a"));
                BaseSelenium.Click(list[i]);
                if (WebDriver.CheckBrowserLog())
                {
                    WebDriver.PrintBrowserLog();
                    return(false);
                }
                WebDriver.Driver.Navigate().Back();
            }
            return(true);
        }
示例#11
0
        public bool CheckZonesOfCountriesOrder()
        {
            var countryIndex = GetIndexCountryName();

            // Проходим по всему списку таблицы стран
            for (var i = 0; i < BaseSelenium.GetCountRowsInTable(); i++)
            {
                var row = BaseSelenium.GetTableRowOfIndex(i);
                // Переходим в редактирование гео зон
                BaseSelenium.Click(BaseSelenium.GetElementOfIndexFromRow(row, countryIndex)
                                   .FindElement(By.CssSelector("a")));
                // Проверяем сортировку гео зон по стране
                if (!Page.AdminEditGeoZone.CheckZonesOrder())
                {
                    return(false);
                }
                WebDriver.Driver.Navigate().Back();
            }
            return(true);
        }
示例#12
0
 public void FillPostcode(string text)
 {
     BaseSelenium.FillText(_postcode, text);
 }
示例#13
0
 public void FillAdress1(string text)
 {
     BaseSelenium.FillText(_adress1, text);
 }
示例#14
0
 public void FillLastname(string text)
 {
     BaseSelenium.FillText(_lastname, text);
 }
示例#15
0
 public void FillFirstname(string text)
 {
     BaseSelenium.FillText(_firstname, text);
 }
示例#16
0
 public void FillPhone(string phone)
 {
     BaseSelenium.FillText(_phone, phone);
 }
示例#17
0
 public void SelectZone(string zone)
 {
     BaseSelenium.SelectByTextClicks(_zone, zone);
 }
示例#18
0
 public void ClickLogout()
 {
     BaseSelenium.Click(_logout);
 }
示例#19
0
 public void ClickLogin()
 {
     BaseSelenium.Click(_login);
 }
示例#20
0
 public void CheckoutCart()
 {
     BaseSelenium.Click(_checkoutCart);
 }
示例#21
0
 public void ClickAddProduct()
 {
     BaseSelenium.Click(_addNewProduct);
 }
示例#22
0
 public int GetCountRowsInTable()
 {
     return(BaseSelenium.GetCountRowsInTable());
 }
示例#23
0
 public void ClickAddContry()
 {
     BaseSelenium.Click(_addCountry);
 }
示例#24
0
 public void FillCity(string text)
 {
     BaseSelenium.FillText(_city, text);
 }
示例#25
0
 public void SelectCountry(string country)
 {
     BaseSelenium.SelectByText(_country, country);
 }
示例#26
0
 public void FillPassword(string password)
 {
     BaseSelenium.FillText(_password, password);
 }
示例#27
0
 public void FillEmail(string email)
 {
     BaseSelenium.FillText(_email, email);
 }
示例#28
0
 public void FillConfirmPassword(string password)
 {
     BaseSelenium.FillText(_confirmedPassword, password);
 }
示例#29
0
 public void SelectProductSize(string size)
 {
     BaseSelenium.SelectByValue(_selectSize, size);
 }
示例#30
0
 public void ClickCreate()
 {
     BaseSelenium.Click(_create);
 }