2025-02-15 19:42:01 +04:00
|
|
|
|
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(., 'Войти')]");
|
|
|
|
|
|
2025-02-15 23:11:44 +04:00
|
|
|
|
private By profileButton = By.XPath("//button[contains(@class, 'button___BfISQ')]//div[contains(@class, 'text___lAaAj') and contains(text(), 'Профиль')]");
|
|
|
|
|
private By reviewsLink = By.XPath("//a[contains(@class, 'item___tZDUe clickable___Yuycq largeText___H5mAO') and contains(text(), 'Мои обзоры')]");
|
|
|
|
|
|
|
|
|
|
private By editButton = By.XPath("//button[@testid='SocialUserEditButton']");
|
|
|
|
|
private By descriptionTextarea = By.XPath("//textarea[@name='description']");
|
|
|
|
|
private By saveButton = By.XPath("//button[@testid='SocialUserProfilePopupSubmitButton']");
|
|
|
|
|
|
|
|
|
|
private By ordersLink = By.XPath("//a[contains(@href, '/ru/orders')]");
|
|
|
|
|
private By balanceLink = By.XPath("//a[contains(@class, 'item___tZDUe clickable___Yuycq largeText___H5mAO') and contains(text(), 'Мой баланс')]");
|
|
|
|
|
|
2025-02-15 19:42:01 +04:00
|
|
|
|
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')]");
|
2025-02-15 23:11:44 +04:00
|
|
|
|
private By heartDeleteButton = By.XPath("//svg[@class='root___Z1kvz filled___PLueY']");
|
|
|
|
|
private By favoritesLink = By.XPath("//a[@href='/ru/favorites']");
|
2025-02-15 19:42:01 +04:00
|
|
|
|
|
|
|
|
|
public HomePage(IWebDriver driver) : base(driver) { }
|
|
|
|
|
|
2025-02-15 23:11:44 +04:00
|
|
|
|
public void Open()
|
|
|
|
|
{
|
|
|
|
|
OpenUrl("https://www.joom.ru/");
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-15 19:42:01 +04:00
|
|
|
|
public void Auth(string email, string password)
|
|
|
|
|
{
|
|
|
|
|
Click(AuthLink);
|
|
|
|
|
Click(showMoreButton);
|
|
|
|
|
Click(emailAuthButton);
|
|
|
|
|
Type(emailInput, email);
|
|
|
|
|
Type(passwordInput, password);
|
|
|
|
|
Click(submitButton);
|
2025-02-15 23:11:44 +04:00
|
|
|
|
Thread.Sleep(5000);
|
2025-02-15 19:42:01 +04:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-15 23:11:44 +04:00
|
|
|
|
public void AuthMy()
|
2025-02-15 19:42:01 +04:00
|
|
|
|
{
|
2025-02-15 23:11:44 +04:00
|
|
|
|
Auth("ЛОГИН", "ПАРОЛЬ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void EditAboutMe(string newDescription)
|
|
|
|
|
{
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
AuthMy();
|
|
|
|
|
Click(profileButton);
|
|
|
|
|
Click(favoritesLink);
|
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void CheckMyBalance()
|
|
|
|
|
{
|
|
|
|
|
AuthMy();
|
|
|
|
|
Click(profileButton);
|
|
|
|
|
Click(balanceLink);
|
|
|
|
|
Thread.Sleep(3000);
|
2025-02-15 19:42:01 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SearchForProduct(string productName)
|
|
|
|
|
{
|
|
|
|
|
Type(searchInput, productName);
|
|
|
|
|
Click(searchButton);
|
2025-02-15 23:23:22 +04:00
|
|
|
|
Thread.Sleep(3000);
|
2025-02-15 19:42:01 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-15 23:11:44 +04:00
|
|
|
|
public void AddFavorites(string productName)
|
2025-02-15 19:42:01 +04:00
|
|
|
|
{
|
2025-02-15 23:11:44 +04:00
|
|
|
|
AuthMy();
|
|
|
|
|
|
|
|
|
|
Type(searchInput, productName);
|
|
|
|
|
Click(searchButton);
|
|
|
|
|
Thread.Sleep(5000);
|
|
|
|
|
|
2025-02-15 19:42:01 +04:00
|
|
|
|
Click(heartButton);
|
|
|
|
|
Click(profileButton);
|
|
|
|
|
Click(favoritesLink);
|
2025-02-15 23:11:44 +04:00
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DeleteFavorites()
|
|
|
|
|
{
|
|
|
|
|
AuthMy();
|
|
|
|
|
|
|
|
|
|
Click(profileButton);
|
|
|
|
|
Click(favoritesLink);
|
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
|
Click(heartButton);
|
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
|
|
|
|
|
|
driver.Navigate().Refresh();
|
|
|
|
|
Thread.Sleep(5000);
|
2025-02-15 19:42:01 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|