its done
This commit is contained in:
parent
967e0ff4e6
commit
0fcfa9dd7c
@ -29,6 +29,7 @@ namespace TestProject
|
||||
{
|
||||
WaitUntilElementIsVisible(locator);
|
||||
FindElement(locator).Click();
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
|
||||
public void WaitUntilElementIsVisible(By locator, int time = 100)
|
||||
|
@ -32,14 +32,18 @@ namespace TestProject
|
||||
private By maxPriceInput = By.XPath("//input[@name='max']");
|
||||
private By applyFilterButton = By.XPath("//button[contains(@class, 'button___HN4kv') and contains(., 'Применить')]");
|
||||
|
||||
private By productLink = By.XPath("//a[contains(@href, '/ru/products/645ba6bfc5f80701f93cead6')]");
|
||||
private By addToCartButton = By.XPath("//button[.//span[contains(text(), 'В корзину')]]");
|
||||
private By cartButton = By.XPath("//a[@href='/ru/cart']");
|
||||
|
||||
private By heartButton = By.XPath("//div[@class='actionButton___tq_Iy active___Rc9Go']//div[contains(@class, 'favoriteButton___z3oh3')]");
|
||||
private By heartDeleteButton = By.XPath("//svg[@class='root___Z1kvz filled___PLueY']");
|
||||
private By favoritesLink = By.XPath("//a[@href='/ru/favorites']");
|
||||
|
||||
private By productItem = By.XPath("//div[contains(@class, 'name___asFfu') and contains(., '25 игл из нержавеющей стали с большим ушком для вышивания')]");
|
||||
private By addToCart = By.XPath("//span[contains(@class, 'label___CQCKv') and contains(., 'В корзину')]");
|
||||
private By cartButton = By.XPath("//a[@href='/ru/cart']");
|
||||
|
||||
private By AddCountToCart = By.XPath("//button[@class='increase___T5SMf']");
|
||||
private By deleteButton = By.XPath("//button[contains(@class, 'trash___gQVfp color-placeholder___eHEn5')]");
|
||||
private By confirmDeleteButton = By.XPath("//button[contains(@class, 'button___Fogz2 rounded-rect___bviwL medium___fKhsq accent___SFpoh medium___fKhsq fullWidth___YCBfX')]");
|
||||
|
||||
public HomePage(IWebDriver driver) : base(driver) { }
|
||||
|
||||
public void Open()
|
||||
@ -67,25 +71,17 @@ namespace TestProject
|
||||
{
|
||||
AuthMy();
|
||||
Click(profileButton);
|
||||
|
||||
Click(reviewsLink);
|
||||
Thread.Sleep(3000);
|
||||
|
||||
Click(editButton);
|
||||
Thread.Sleep(2000);
|
||||
|
||||
FindElement(descriptionTextarea).Clear();
|
||||
Type(descriptionTextarea, newDescription);
|
||||
|
||||
Click(saveButton);
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
|
||||
public void ChechMyOrders()
|
||||
{
|
||||
AuthMy();
|
||||
Click(ordersLink);
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
|
||||
public void ChechMyFavorites()
|
||||
@ -93,7 +89,6 @@ namespace TestProject
|
||||
AuthMy();
|
||||
Click(profileButton);
|
||||
Click(favoritesLink);
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
|
||||
public void CheckMyBalance()
|
||||
@ -101,14 +96,12 @@ namespace TestProject
|
||||
AuthMy();
|
||||
Click(profileButton);
|
||||
Click(balanceLink);
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
|
||||
public void SearchForProduct(string productName)
|
||||
{
|
||||
Type(searchInput, productName);
|
||||
Click(searchButton);
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
|
||||
public void SortByPriceAscending()
|
||||
@ -131,12 +124,11 @@ namespace TestProject
|
||||
|
||||
Type(searchInput, productName);
|
||||
Click(searchButton);
|
||||
Thread.Sleep(5000);
|
||||
|
||||
Click(heartButton);
|
||||
Click(profileButton);
|
||||
Click(favoritesLink);
|
||||
Thread.Sleep(3000);
|
||||
|
||||
}
|
||||
|
||||
public void DeleteFavorites()
|
||||
@ -145,12 +137,37 @@ namespace TestProject
|
||||
|
||||
Click(profileButton);
|
||||
Click(favoritesLink);
|
||||
Thread.Sleep(3000);
|
||||
Click(heartButton);
|
||||
Thread.Sleep(3000);
|
||||
|
||||
driver.Navigate().Refresh();
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
|
||||
public void AddToCart()
|
||||
{
|
||||
AuthMy();
|
||||
|
||||
OpenUrl("https://www.joom.ru/ru/products/645ba6bfc5f80701f93cead6?variant_id=645ba6bfc5f8072cf93cead8");
|
||||
Thread.Sleep(3000);
|
||||
Click(addToCart);
|
||||
Click(cartButton);
|
||||
}
|
||||
|
||||
public void UpdateCountProduct()
|
||||
{
|
||||
AuthMy();
|
||||
|
||||
Click(cartButton);
|
||||
Click(AddCountToCart);
|
||||
}
|
||||
|
||||
public void DeleteProductToCart()
|
||||
{
|
||||
AuthMy();
|
||||
|
||||
Click(cartButton);
|
||||
Click(deleteButton);
|
||||
Click(confirmDeleteButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,5 +166,50 @@ namespace TestProject
|
||||
string favoriteItemMyText = favoriteItem.Text;
|
||||
Assert.That(favoriteItemMyText, !Is.EqualTo("25 игл из нержавеющей стали с большим ушком для вышивания"), "В избранных присутствует данный товар");
|
||||
}
|
||||
|
||||
[Test, Order(11)]
|
||||
public void TestAddToCart()
|
||||
{
|
||||
HomePage homePage = new HomePage(driver);
|
||||
homePage.Open();
|
||||
|
||||
homePage.AddToCart();
|
||||
|
||||
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
|
||||
var cartItem = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//label[contains(@for, 'cartitem-645ba6bfc5f8072cf93cead8') and contains(., '25 игл из нержавеющей стали с большим ушком для вышивания')]")));
|
||||
|
||||
string cartItemText = cartItem.Text;
|
||||
Assert.That(cartItemText, Is.EqualTo("25 игл из нержавеющей стали с большим ушком для вышивания"), "В корзине отсутствует данный товар");
|
||||
}
|
||||
|
||||
[Test, Order(12)]
|
||||
public void TestUpdateCountProduct()
|
||||
{
|
||||
HomePage homePage = new HomePage(driver);
|
||||
homePage.Open();
|
||||
|
||||
homePage.UpdateCountProduct();
|
||||
|
||||
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
|
||||
var countItem = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(@class, 'count___WGjOX')]")));
|
||||
|
||||
string countItemText = countItem.Text;
|
||||
Assert.That(countItemText, Is.EqualTo("2"), "В корзине другое количество товара");
|
||||
}
|
||||
|
||||
[Test, Order(13)]
|
||||
public void TestDeleteProductToCart()
|
||||
{
|
||||
HomePage homePage = new HomePage(driver);
|
||||
homePage.Open();
|
||||
|
||||
homePage.DeleteProductToCart();
|
||||
|
||||
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
|
||||
var cartItem = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//h1[contains(@class, 'header___ohk0y') and contains(., 'Ваша корзина пуста')]")));
|
||||
|
||||
string cartItemText = cartItem.Text;
|
||||
Assert.That(cartItemText, Is.EqualTo("Ваша корзина пуста"), "Ваша корзина не пуста");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user