82 lines
3.4 KiB
C#
82 lines
3.4 KiB
C#
using OpenQA.Selenium;
|
||
|
||
namespace TestProject
|
||
{
|
||
public class HomePage : BasePage
|
||
{
|
||
private By AuthLink = By.XPath("//a[@href='/ru/entrance']");
|
||
private By showMoreButton = By.XPath("//button[contains(@class, 'button___xFkMg') and contains(., 'Показать еще варианты')]");
|
||
private By emailAuthButton = By.XPath("//div[contains(@class, 'normal___w8_y9')]//a[contains(@href, '/ru/entrance/signin')]");
|
||
private By emailInput = By.XPath("//input[@name='email']");
|
||
private By passwordInput = By.XPath("//input[@name='password']");
|
||
private By submitButton = By.XPath("//button[@type='submit']//div[contains(@class, 'caption___L78vz') and contains(., 'Войти')]");
|
||
|
||
private By searchInput = By.ClassName("input___OsSf0");
|
||
private By searchButton = By.ClassName("submitButton___iZDz3");
|
||
|
||
private By sortButton = By.XPath("//button[contains(@class, 'content___hcPVc') and contains(., 'Cортировка')]");
|
||
private By sortByPriceAscending = By.XPath("//a[contains(@href, '/s.origPrice.asc')]");
|
||
|
||
private By filterButton = By.XPath("//button[contains(@class, 'content___hcPVc') and contains(., 'Цена')]");
|
||
private By minPriceInput = By.XPath("//input[@name='min']");
|
||
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 profileButton = By.XPath("//button[contains(@class, 'button___BfISQ')]//div[contains(@class, 'text___lAaAj') and contains(text(), 'Профиль')]");
|
||
private By favoritesLink = By.XPath("//a[contains(@class, 'item___tZDUe clickable___Yuycq largeText___H5mAO') and contains(text(), 'Мое избранное')]");
|
||
|
||
public HomePage(IWebDriver driver) : base(driver) { }
|
||
|
||
public void Auth(string email, string password)
|
||
{
|
||
Click(AuthLink);
|
||
Click(showMoreButton);
|
||
Click(emailAuthButton);
|
||
Type(emailInput, email);
|
||
Type(passwordInput, password);
|
||
Click(submitButton);
|
||
}
|
||
|
||
public void Open()
|
||
{
|
||
OpenUrl("https://www.joom.ru/");
|
||
}
|
||
|
||
public void SearchForProduct(string productName)
|
||
{
|
||
Type(searchInput, productName);
|
||
Click(searchButton);
|
||
}
|
||
|
||
public void SortByPriceAscending()
|
||
{
|
||
Click(sortButton);
|
||
|
||
Click(sortByPriceAscending);
|
||
}
|
||
|
||
public void FilterByPrice(int minPrice, int maxPrice)
|
||
{
|
||
Click(filterButton);
|
||
|
||
Type(minPriceInput, minPrice.ToString());
|
||
|
||
Type(maxPriceInput, maxPrice.ToString());
|
||
|
||
Click(applyFilterButton);
|
||
}
|
||
|
||
public void AddToFavorites()
|
||
{
|
||
Click(heartButton);
|
||
Click(profileButton);
|
||
Click(favoritesLink);
|
||
}
|
||
}
|
||
}
|