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 void ChooseSomeNotebooks() { navPan = new NavigationPanel(driver); navPan.OpenCatalogPage(wait).SelectCategory("Ноутбуки и компьютеры", wait); LaptopsCategory lapCat = new LaptopsCategory(driver); ProductsListPage productsList = lapCat.OpenAllLaptopsProductsList(wait); List <String> laptopsToAddNames = new List <String> { "90NB0HS1-M00450", "90NR0GN1-M03880", "80XL03UJRA" }; foreach (var item in laptopsToAddNames) { AndroidElement currentProduct = productsList.GetProduct(item, wait); new ProductCompactView(driver, currentProduct).BtnAddToWishList.Click(); } IList <AndroidElement> prodElemsInWishList = navPan. Open(wait). OpenWishLists(wait). OpenGuestWishList(wait). WishedProductsList; //List<String> wishListProductsNames = new List<String>(); bool[] result = new bool[3]; int count = 0; foreach (var item in prodElemsInWishList) { //wishListProductsNames.Add(new ProductCompactView(driver, item).ProductName.Text); result[count] = new ProductCompactView(driver, item).ProductName.Text.Contains(laptopsToAddNames[count]); count++; } //CollectionAssert.AreEquivalent(wishListProductsNames, laptopsToAddNames); Assert.IsTrue(result[0] & result[1] & result[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]); }