Exemple #1
0
        public bool AddLaptopsToCart()
        {
            navPanel = new NavigationPanel(driver);
            navPanel.OpenCatalogPage(wait).SelectCategory("Ноутбуки и компьютеры", wait);
            LaptopsCategory  lapCat       = new LaptopsCategory(driver);
            ProductsListPage productsList = lapCat.OpenAllLaptopsProductsList(wait);

            productsList.OpenSortPanel(wait).
            RbtnExpensiveCheap.Click();

            List <String> laptopsModels = new List <String> {
                "GT75VR7RE-230UA", "GT758RF-239UA", "MPTU35/Z0UE"
            };

            foreach (var item in laptopsModels)
            {
                AndroidElement currentProduct = productsList.GetProduct(item, wait);
                new ProductCompactView(driver, currentProduct).AddToCart(wait);
            }

            IList <AndroidElement> cartItems = navPanel.
                                               Open(wait).
                                               OpenCart(wait).
                                               GetCartItems(wait);

            laptopsModels.Reverse();

            bool[] matchNames = new bool[3];
            int    count      = 0;

            foreach (var item in cartItems)
            {
                var currText = new CartItemView(driver, item).GetTitle(wait);
                matchNames[count] = currText.Contains(laptopsModels[count]);
                Console.WriteLine(currText + " = " + laptopsModels[count]);
                count++;
            }
            return(matchNames[0] & matchNames[1] & matchNames[2]);
        }
Exemple #2
0
        private bool AddLaptopsToCart()
        {
            _navPanel = new NavigationPanel(driver);
            _navPanel
            .OpenCatalogPage(wait)
            .SelectCategory(LaptopsCategoryTitle, wait);
            var lapCat       = new LaptopsCategory(driver);
            var productsList = lapCat.OpenAllLaptopsProductsList(wait);

            productsList.OpenSortPanel(wait).RbtnExpensiveCheap.Click();

            foreach (var item in _laptopsModels)
            {
                var currentProduct = productsList.GetProduct(item, wait);
                new ProductCompactView(driver, currentProduct).AddToCart(wait);
            }

            driver.PressKeyCode(AndroidKeyCode.Back);
            var cartItems = _navPanel
                            .OpenCart(wait)
                            .GetCartItems(wait);
            // _laptopsModels.Reverse();

            var matchNames = new bool[3];
            var count      = 0;

            foreach (var item in cartItems)
            {
                var currText = new CartItemView(driver, item).GetTitle(wait);
                matchNames[count] = currText.Contains(_laptopsModels[count]);
                Console.WriteLine(currText + " = " + _laptopsModels[count]);
                count++;
            }

            return(matchNames[0] && matchNames[1] && matchNames[2]);
        }