public bool AddLaptopsToWishList() { _navPanel = new NavigationPanel(driver); _navPanel.OpenCatalogPage(wait).SelectCategory(LaptopsCategoryTitle, wait); LaptopsCategory lapCat = new LaptopsCategory(driver); ProductsListPage productsList = lapCat.OpenAllLaptopsProductsList(wait); productsList.OpenSortPanel(wait). RbtnExpensiveCheap.Click(); foreach (var item in _laptopsModels) { AndroidElement currentProduct = productsList.GetProduct(item, wait); //if (currentProduct != null) new ProductCompactView(driver, currentProduct).AddToWishList(wait); //else continue; new ProductCompactView(driver, currentProduct).AddToWishList(wait); } driver.PressKeyCode(AndroidKeyCode.Back); var prodElemsInWishList = _navPanel. OpenWishLists(wait). OpenGuestWishList(wait). WishedProductsList; // _laptopsModels.Reverse(); var matchNames = new bool[3]; var count = 0; foreach (var item in prodElemsInWishList) { matchNames[count] = new ProductCompactView(driver, item).ProductName.Text.Contains(_laptopsModels[count]); count++; } return(matchNames[0] && matchNames[1] && matchNames[2]); }
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]); }
public bool AddLaptopsToWishList() { 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); //if (currentProduct != null) new ProductCompactView(driver, currentProduct).AddToWishList(wait); //else continue; new ProductCompactView(driver, currentProduct).AddToWishList(wait); } IList <AndroidElement> prodElemsInWishList = navPanel. Open(wait). OpenWishLists(wait). OpenGuestWishList(wait). WishedProductsList; bool[] matchNames = new bool[3]; int count = 0; foreach (var item in prodElemsInWishList) { matchNames[count] = new ProductCompactView(driver, item).ProductName.Text.Contains(laptopsModels[count]); count++; } return(matchNames[0] & matchNames[1] & matchNames[2]); }