done?
This commit is contained in:
parent
6e884063cf
commit
3258fcc37d
@ -34,7 +34,7 @@ namespace TestProject
|
|||||||
public void WaitUntilElementIsVisible(By locator, int time = 100)
|
public void WaitUntilElementIsVisible(By locator, int time = 100)
|
||||||
{
|
{
|
||||||
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(time));
|
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(time));
|
||||||
wait.Until(ExpectedConditions.ElementIsVisible(locator));
|
wait.Until(ExpectedConditions.ElementToBeClickable(locator));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenUrl(string url)
|
public void OpenUrl(string url)
|
||||||
|
@ -11,6 +11,16 @@ namespace TestProject
|
|||||||
private By passwordInput = By.XPath("//input[@name='password']");
|
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 submitButton = By.XPath("//button[@type='submit']//div[contains(@class, 'caption___L78vz') and contains(., 'Войти')]");
|
||||||
|
|
||||||
|
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(), 'Мой баланс')]");
|
||||||
|
|
||||||
private By searchInput = By.ClassName("input___OsSf0");
|
private By searchInput = By.ClassName("input___OsSf0");
|
||||||
private By searchButton = By.ClassName("submitButton___iZDz3");
|
private By searchButton = By.ClassName("submitButton___iZDz3");
|
||||||
|
|
||||||
@ -27,11 +37,16 @@ namespace TestProject
|
|||||||
private By cartButton = By.XPath("//a[@href='/ru/cart']");
|
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 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 heartDeleteButton = By.XPath("//svg[@class='root___Z1kvz filled___PLueY']");
|
||||||
private By favoritesLink = By.XPath("//a[contains(@class, 'item___tZDUe clickable___Yuycq largeText___H5mAO') and contains(text(), 'Мое избранное')]");
|
private By favoritesLink = By.XPath("//a[@href='/ru/favorites']");
|
||||||
|
|
||||||
public HomePage(IWebDriver driver) : base(driver) { }
|
public HomePage(IWebDriver driver) : base(driver) { }
|
||||||
|
|
||||||
|
public void Open()
|
||||||
|
{
|
||||||
|
OpenUrl("https://www.joom.ru/");
|
||||||
|
}
|
||||||
|
|
||||||
public void Auth(string email, string password)
|
public void Auth(string email, string password)
|
||||||
{
|
{
|
||||||
Click(AuthLink);
|
Click(AuthLink);
|
||||||
@ -40,11 +55,53 @@ namespace TestProject
|
|||||||
Type(emailInput, email);
|
Type(emailInput, email);
|
||||||
Type(passwordInput, password);
|
Type(passwordInput, password);
|
||||||
Click(submitButton);
|
Click(submitButton);
|
||||||
|
Thread.Sleep(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Open()
|
public void AuthMy()
|
||||||
{
|
{
|
||||||
OpenUrl("https://www.joom.ru/");
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SearchForProduct(string productName)
|
public void SearchForProduct(string productName)
|
||||||
@ -56,26 +113,43 @@ namespace TestProject
|
|||||||
public void SortByPriceAscending()
|
public void SortByPriceAscending()
|
||||||
{
|
{
|
||||||
Click(sortButton);
|
Click(sortButton);
|
||||||
|
|
||||||
Click(sortByPriceAscending);
|
Click(sortByPriceAscending);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FilterByPrice(int minPrice, int maxPrice)
|
public void FilterByPrice(int minPrice, int maxPrice)
|
||||||
{
|
{
|
||||||
Click(filterButton);
|
Click(filterButton);
|
||||||
|
|
||||||
Type(minPriceInput, minPrice.ToString());
|
Type(minPriceInput, minPrice.ToString());
|
||||||
|
|
||||||
Type(maxPriceInput, maxPrice.ToString());
|
Type(maxPriceInput, maxPrice.ToString());
|
||||||
|
|
||||||
Click(applyFilterButton);
|
Click(applyFilterButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddToFavorites()
|
public void AddFavorites(string productName)
|
||||||
{
|
{
|
||||||
|
AuthMy();
|
||||||
|
|
||||||
|
Type(searchInput, productName);
|
||||||
|
Click(searchButton);
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
|
||||||
Click(heartButton);
|
Click(heartButton);
|
||||||
Click(profileButton);
|
Click(profileButton);
|
||||||
Click(favoritesLink);
|
Click(favoritesLink);
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,19 +25,66 @@ namespace TestProject
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test, Order(1)]
|
[Test, Order(1)]
|
||||||
public void TestAuth()
|
public void TestEditAboutMe()
|
||||||
{
|
{
|
||||||
HomePage homePage = new HomePage(driver);
|
HomePage homePage = new HomePage(driver);
|
||||||
homePage.Open();
|
homePage.Open();
|
||||||
homePage.Auth("ПОЧТА", "ПАРОЛЬ");
|
|
||||||
|
|
||||||
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(100));
|
homePage.EditAboutMe("123");
|
||||||
var profileButton = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//button[contains(@class, 'button___BfISQ')]//div[contains(@class, 'text___lAaAj') and contains(text(), 'Профиль')]")));
|
|
||||||
|
|
||||||
Assert.That(profileButton.Displayed, Is.True);
|
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
|
||||||
|
var aboutMe = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='description___mK5Ei']")));
|
||||||
|
|
||||||
|
string aboutMeText = aboutMe.Text;
|
||||||
|
Assert.That(aboutMeText, Is.EqualTo("123"), "Текст 'Обо мне' не обновился корректно");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Order(2)]
|
[Test, Order(2)]
|
||||||
|
public void TestChechMyOrders()
|
||||||
|
{
|
||||||
|
HomePage homePage = new HomePage(driver);
|
||||||
|
homePage.Open();
|
||||||
|
|
||||||
|
homePage.ChechMyOrders();
|
||||||
|
|
||||||
|
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
|
||||||
|
var ordersMy = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//h1[@class='title___cqhOe']")));
|
||||||
|
|
||||||
|
string ordersMyText = ordersMy.Text;
|
||||||
|
Assert.That(ordersMyText, Is.EqualTo("Ваша история заказов пуста!"), "Ваша история заказов не пуста");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, Order(3)]
|
||||||
|
public void TestChechMyFavorites()
|
||||||
|
{
|
||||||
|
HomePage homePage = new HomePage(driver);
|
||||||
|
homePage.Open();
|
||||||
|
|
||||||
|
homePage.ChechMyFavorites();
|
||||||
|
|
||||||
|
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
|
||||||
|
var favoritesMy = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//span[@class='tabCount___uTpw6']")));
|
||||||
|
|
||||||
|
string favoritesMyText = favoritesMy.Text;
|
||||||
|
Assert.That(favoritesMyText, !Is.EqualTo("0"), "Ваши избранные пусты");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, Order(4)]
|
||||||
|
public void TestCheckMyBalance()
|
||||||
|
{
|
||||||
|
HomePage homePage = new HomePage(driver);
|
||||||
|
homePage.Open();
|
||||||
|
|
||||||
|
homePage.CheckMyBalance();
|
||||||
|
|
||||||
|
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
|
||||||
|
var balanceMy = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//span[@class='balanceTitle____rGLb']")));
|
||||||
|
|
||||||
|
string balanceMyText = balanceMy.Text;
|
||||||
|
Assert.That(balanceMyText, Is.EqualTo("У вас 0 ₽"), "Ваш баланс не нулевой пусты");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, Order(5)]
|
||||||
public void TestSearchProduct_positive()
|
public void TestSearchProduct_positive()
|
||||||
{
|
{
|
||||||
HomePage homePage = new HomePage(driver);
|
HomePage homePage = new HomePage(driver);
|
||||||
@ -50,7 +97,7 @@ namespace TestProject
|
|||||||
Assert.That(firstProduct.Displayed, Is.True);
|
Assert.That(firstProduct.Displayed, Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Order(3)]
|
[Test, Order(6)]
|
||||||
public void TestSearchProduct_negative()
|
public void TestSearchProduct_negative()
|
||||||
{
|
{
|
||||||
HomePage homePage = new HomePage(driver);
|
HomePage homePage = new HomePage(driver);
|
||||||
@ -63,7 +110,7 @@ namespace TestProject
|
|||||||
Assert.That(noResultsMessage.Displayed, Is.True);
|
Assert.That(noResultsMessage.Displayed, Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Order(4)]
|
[Test, Order(7)]
|
||||||
public void TestSortByPriceAscending()
|
public void TestSortByPriceAscending()
|
||||||
{
|
{
|
||||||
HomePage homePage = new HomePage(driver);
|
HomePage homePage = new HomePage(driver);
|
||||||
@ -78,7 +125,7 @@ namespace TestProject
|
|||||||
Assert.That(firstProductPrice.Text.Contains("По возрастающей цене"), Is.True);
|
Assert.That(firstProductPrice.Text.Contains("По возрастающей цене"), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Order(5)]
|
[Test, Order(8)]
|
||||||
public void TestFilterByPrice()
|
public void TestFilterByPrice()
|
||||||
{
|
{
|
||||||
HomePage homePage = new HomePage(driver);
|
HomePage homePage = new HomePage(driver);
|
||||||
@ -93,25 +140,31 @@ namespace TestProject
|
|||||||
Assert.That(priceRangeMessage.Displayed, Is.True);
|
Assert.That(priceRangeMessage.Displayed, Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Order(6)]
|
[Test, Order(9)]
|
||||||
public void TestAddToFavorites()
|
public void TestAddToFavorites()
|
||||||
{
|
{
|
||||||
HomePage homePage = new HomePage(driver);
|
HomePage homePage = new HomePage(driver);
|
||||||
homePage.Open();
|
homePage.Open();
|
||||||
homePage.Auth("ПОЧТА", "ПАРОЛЬ");
|
|
||||||
Thread.Sleep(5000);
|
|
||||||
homePage.SearchForProduct("25 игл из нержавеющей стали с большим ушком для вышивания");
|
|
||||||
|
|
||||||
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
|
|
||||||
|
|
||||||
var heartButton = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//div[@class='actionButton___tq_Iy active___Rc9Go']//div[contains(@class, 'favoriteButton___z3oh3')]")));
|
|
||||||
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", heartButton);
|
|
||||||
|
|
||||||
heartButton.Click();
|
|
||||||
|
|
||||||
|
homePage.AddFavorites("25 игл из нержавеющей стали с большим ушком для вышивания");
|
||||||
|
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
|
||||||
var favoriteItem = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(@class, 'product___F_mly withFavorite___BnFAs product___crBKK')]")));
|
var favoriteItem = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(@class, 'product___F_mly withFavorite___BnFAs product___crBKK')]")));
|
||||||
|
|
||||||
Assert.That(favoriteItem.Displayed, Is.True);
|
Assert.That(favoriteItem.Displayed, Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test, Order(9)]
|
||||||
|
public void TestDeleteToFavorites()
|
||||||
|
{
|
||||||
|
HomePage homePage = new HomePage(driver);
|
||||||
|
homePage.Open();
|
||||||
|
|
||||||
|
homePage.DeleteFavorites();
|
||||||
|
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
|
||||||
|
var favoriteItem = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[contains(@class, 'name___asFfu')]")));
|
||||||
|
|
||||||
|
string favoriteItemMyText = favoriteItem.Text;
|
||||||
|
Assert.That(favoriteItemMyText, !Is.EqualTo("25 игл из нержавеющей стали с большим ушком для вышивания"), "В избранных присутствует данный товар");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user