Edit tests3
This commit is contained in:
parent
d458c53a17
commit
50dac2dd23
@ -1,16 +1,21 @@
|
|||||||
package pages;
|
package pages;
|
||||||
|
|
||||||
import com.github.javafaker.Faker;
|
import com.github.javafaker.Faker;
|
||||||
|
import helpers.Context;
|
||||||
|
import org.openqa.selenium.By;
|
||||||
import org.openqa.selenium.Keys;
|
import org.openqa.selenium.Keys;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.support.FindBy;
|
import org.openqa.selenium.support.FindBy;
|
||||||
import org.openqa.selenium.support.PageFactory;
|
import org.openqa.selenium.support.PageFactory;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
public class Email {
|
public class Email {
|
||||||
|
|
||||||
private WebDriver driver;
|
private WebDriver driver;
|
||||||
|
private Context context;
|
||||||
Faker faker = new Faker();
|
Faker faker = new Faker();
|
||||||
|
|
||||||
public Email(WebDriver driver) {
|
public Email(WebDriver driver) {
|
||||||
@ -52,11 +57,9 @@ public class Email {
|
|||||||
submitButton.click();
|
submitButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSuccsessAlert() {
|
public boolean setSuccsessAlert() {
|
||||||
if (succsessAlert != null || succsessAlert.isDisplayed()) {
|
return driver.findElement(By.xpath("//*[@id=\"subscribePopup\"]/div[1]")).isDisplayed();
|
||||||
} else {
|
|
||||||
throw new IllegalStateException("something went wrong");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logInLinkCLick() {
|
public void logInLinkCLick() {
|
||||||
@ -68,5 +71,16 @@ public class Email {
|
|||||||
passwordField.sendKeys(password);
|
passwordField.sendKeys(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logInButtonClick() {logInButton.click(); }
|
public void logInButtonClick() {
|
||||||
|
logInButton.click();
|
||||||
|
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canClickLogInButton() {
|
||||||
|
return driver.findElement(By.id("loginPopupButtonID")).isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean logInButtonDisplayed() {
|
||||||
|
return logInButton.isDisplayed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,20 +42,20 @@ public class Navigation {
|
|||||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div/div[1]/div/div[1]/a")
|
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div/div[1]/div/div[1]/a")
|
||||||
private WebElement womenSales;
|
private WebElement womenSales;
|
||||||
|
|
||||||
public void setMainTitle() {
|
public boolean womaneSalesLink() {
|
||||||
String title = mainTitle.getAttribute("InnerText");
|
return womenSales.isDisplayed();
|
||||||
if (title.equals("Распродажа женской одежды O`STIN")) {
|
|
||||||
} else {
|
|
||||||
throw new IllegalStateException("something went wrong");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPageName() {
|
public boolean setMainTitle() {
|
||||||
String title = pageName.getAttribute("InnerText");
|
return mainTitle.isDisplayed();
|
||||||
if (title.equals("O'STIN | ОСТИН")) {
|
|
||||||
} else {
|
|
||||||
throw new IllegalStateException("something went wrong");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean setDisplayedPromo() {
|
||||||
|
return displayedPromo.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean setPageName() {
|
||||||
|
return pageName.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCurrentCity() {
|
private void setCurrentCity() {
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
package pages;
|
package pages;
|
||||||
|
|
||||||
|
import helpers.Context;
|
||||||
|
import org.openqa.selenium.By;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.support.FindBy;
|
import org.openqa.selenium.support.FindBy;
|
||||||
import org.openqa.selenium.support.PageFactory;
|
import org.openqa.selenium.support.PageFactory;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class Recyclebin {
|
public class Recyclebin {
|
||||||
|
|
||||||
private WebDriver driver;
|
private WebDriver driver;
|
||||||
|
private Context context;
|
||||||
|
|
||||||
public Recyclebin(WebDriver driver) {
|
public Recyclebin(WebDriver driver) {
|
||||||
PageFactory.initElements(driver, this);
|
PageFactory.initElements(driver, this);
|
||||||
@ -40,11 +45,25 @@ public class Recyclebin {
|
|||||||
}
|
}
|
||||||
public void colorClick() {
|
public void colorClick() {
|
||||||
color.click();
|
color.click();
|
||||||
|
context.getDriver().manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToCartButtonClick() {
|
public void addToCartButtonClick() {
|
||||||
addToCartButton.click();
|
addToCartButton.click();
|
||||||
}
|
}
|
||||||
public void toCartClick() {followCart.click(); }
|
|
||||||
public void removeItem() { removeLink.click(); }
|
|
||||||
|
|
||||||
|
public boolean afterClick() {
|
||||||
|
return driver.findElement(By.xpath("//*[@id=\"cartPopup\"]/div[2]/div[2]/div[2]/a")).isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toCartClick() {
|
||||||
|
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
||||||
|
toCart.click();
|
||||||
|
context.getDriver().manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
|
||||||
|
followCart.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removeItem() {
|
||||||
|
return !imagePoint.isDisplayed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package pages;
|
package pages;
|
||||||
|
|
||||||
|
import helpers.Context;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
import org.openqa.selenium.Keys;
|
import org.openqa.selenium.Keys;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
@ -7,9 +8,12 @@ import org.openqa.selenium.WebElement;
|
|||||||
import org.openqa.selenium.support.FindBy;
|
import org.openqa.selenium.support.FindBy;
|
||||||
import org.openqa.selenium.support.PageFactory;
|
import org.openqa.selenium.support.PageFactory;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class Sort {
|
public class Sort {
|
||||||
|
|
||||||
private WebDriver driver;
|
private WebDriver driver;
|
||||||
|
private static Context context;
|
||||||
|
|
||||||
public Sort(WebDriver driver) {
|
public Sort(WebDriver driver) {
|
||||||
PageFactory.initElements(driver, this);
|
PageFactory.initElements(driver, this);
|
||||||
@ -28,8 +32,8 @@ public class Sort {
|
|||||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[1]/i")
|
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[1]/i")
|
||||||
private WebElement dropDownSize;
|
private WebElement dropDownSize;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[1]/div/" +
|
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[1]/div/div[2]/ul/div/div/li[1]/" +
|
||||||
"div[2]/ul/div/div/li[1]/label/input")
|
"label/input")
|
||||||
private WebElement checkBoxSize;
|
private WebElement checkBoxSize;
|
||||||
|
|
||||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[2]/i")
|
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[2]/i")
|
||||||
@ -71,19 +75,23 @@ public class Sort {
|
|||||||
|
|
||||||
public void sortDropDownClick() {
|
public void sortDropDownClick() {
|
||||||
sortDropDown.click();
|
sortDropDown.click();
|
||||||
|
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkForDisplayed() {
|
public boolean checkForDisplayed() {
|
||||||
WebElement displayedSort = driver.findElement(By
|
return driver.findElement(By
|
||||||
.xpath("//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[1]/div/form/div/div/div[2]/ul/li[1]"));
|
.xpath("//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[1]/div/form/div/div/div[2]/ul/li[1]"))
|
||||||
if ( displayedSort != null) {
|
.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
throw new IllegalStateException("something went wrong");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void sortBySalesClick() {
|
public void sortBySalesClick() {
|
||||||
sortBySales.click();
|
sortBySales.click();
|
||||||
|
context.getDriver().manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkForSalesDisplayed() {
|
||||||
|
return driver.findElement(By.xpath("//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[1]/div/form/div/span"))
|
||||||
|
.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String setSortLabel() {
|
public String setSortLabel() {
|
||||||
@ -94,17 +102,29 @@ public class Sort {
|
|||||||
public void sizeFilter() {
|
public void sizeFilter() {
|
||||||
dropDownSize.click();
|
dropDownSize.click();
|
||||||
checkBoxSize.click();
|
checkBoxSize.click();
|
||||||
WebElement submit = driver.findElement(By.xpath("//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[1]/div/div[2]/a"));
|
WebElement submit = driver.findElement(By
|
||||||
|
.xpath("//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[1]/div/div[2]/a"));
|
||||||
submit.click();
|
submit.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkForSize() {
|
||||||
|
return driver.findElement(By.cssSelector("//*[@id=\"atg_store_content\"]" +
|
||||||
|
"/div[2]/div[2]/div[2]/form/div[1]/label")).isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
public void colorFilter() {
|
public void colorFilter() {
|
||||||
dropDownColor.click();
|
dropDownColor.click();
|
||||||
checkBoxColor.click();
|
checkBoxColor.click();
|
||||||
WebElement submit = driver.findElement(By.xpath("//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[1]/div/div[2]/a"));
|
WebElement submit = driver.findElement(By
|
||||||
|
.xpath("//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[1]/div/div[2]/a"));
|
||||||
submit.click();
|
submit.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkForColor() {
|
||||||
|
return driver.findElement(By.xpath("//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[2]/i"))
|
||||||
|
.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
public void costFilter() {
|
public void costFilter() {
|
||||||
int cost = random(1500, 5000);
|
int cost = random(1500, 5000);
|
||||||
dropDownCost.click();
|
dropDownCost.click();
|
||||||
@ -112,9 +132,19 @@ public class Sort {
|
|||||||
submitButton.click();
|
submitButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkForCost() {
|
||||||
|
return driver.findElement(By.xpath("//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[3]/i"))
|
||||||
|
.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
public void searching(String type) {
|
public void searching(String type) {
|
||||||
searchButton.click();
|
searchButton.click();
|
||||||
searchField.sendKeys(type, Keys.RETURN);
|
searchField.sendKeys(type, Keys.RETURN);
|
||||||
|
context.getDriver().manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkForResultSearching() {
|
||||||
|
return driver.findElement(By.xpath("//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[1]/h1")).isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package tests;
|
|||||||
|
|
||||||
import helpers.ChromeContext;
|
import helpers.ChromeContext;
|
||||||
import helpers.Context;
|
import helpers.Context;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.openqa.selenium.support.PageFactory;
|
||||||
import pages.Email;
|
import pages.Email;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
@ -10,12 +12,12 @@ import org.junit.jupiter.api.Test;
|
|||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class EmailTests {
|
public class EmailTests {
|
||||||
|
|
||||||
private static Email email;
|
private static Email email;
|
||||||
private static Context context;
|
private static Context context;
|
||||||
|
private final static String URL = "https://ostin.com/";
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void setUp() {
|
public static void setUp() {
|
||||||
@ -24,8 +26,7 @@ public class EmailTests {
|
|||||||
context.start();
|
context.start();
|
||||||
|
|
||||||
context.getDriver().manage().window().maximize();
|
context.getDriver().manage().window().maximize();
|
||||||
context.getDriver().get("https://ostin.com/");
|
context.getDriver().get(URL);
|
||||||
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
|
||||||
email = new Email((WebDriver) context);
|
email = new Email((WebDriver) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,8 +35,8 @@ public class EmailTests {
|
|||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
email.emailService();
|
email.emailService();
|
||||||
email.submitButtonClick();
|
email.submitButtonClick();
|
||||||
email.setSuccsessAlert();
|
Email email = PageFactory.initElements(context.getDriver(), Email.class);
|
||||||
Assert.assertTrue("passed", true);
|
Assertions.assertTrue(email.setSuccsessAlert());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -43,18 +44,17 @@ public class EmailTests {
|
|||||||
email.logInLinkCLick();
|
email.logInLinkCLick();
|
||||||
email.fillFields("lkdlfr@mail.ru", "jhbhjbjbj");
|
email.fillFields("lkdlfr@mail.ru", "jhbhjbjbj");
|
||||||
email.logInButtonClick();
|
email.logInButtonClick();
|
||||||
email.logInButtonClick();
|
PageFactory.initElements(context.getDriver(), Email.class);
|
||||||
Assert.assertTrue("login link is missing, successfully log", true);
|
Assertions.assertTrue(email.canClickLogInButton());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkForLogOut() {
|
public void checkForLogOut() {
|
||||||
boolean pass = false;
|
|
||||||
email.logInLinkCLick();
|
email.logInLinkCLick();
|
||||||
email.fillFields("asda@dasd.asd", "12312eqs");
|
email.fillFields("asda@dasd.asd", "12312eqs");
|
||||||
email.logInButtonClick();
|
email.logInButtonClick();
|
||||||
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
PageFactory.initElements(context.getDriver(), Email.class);
|
||||||
Assert.assertTrue("test passed", pass);
|
Assertions.assertTrue(email.logInButtonDisplayed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -5,30 +5,29 @@ import com.google.common.collect.Iterators;
|
|||||||
import helpers.ChromeContext;
|
import helpers.ChromeContext;
|
||||||
import helpers.Context;
|
import helpers.Context;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
|
|
||||||
|
import org.openqa.selenium.support.PageFactory;
|
||||||
import pages.Navigation;
|
import pages.Navigation;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class NavigationTests {
|
public class NavigationTests {
|
||||||
|
|
||||||
private static Context context;
|
private static Context context;
|
||||||
private static Navigation navigation;
|
private static Navigation navigation;
|
||||||
|
private final static String URL = "https://ostin.com/";
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public static void setUp() {
|
public static void setUp() {
|
||||||
context = new ChromeContext();
|
context = new ChromeContext();
|
||||||
context.start();
|
context.start();
|
||||||
|
|
||||||
context.getDriver().manage().window().maximize();
|
context.getDriver().manage().window().maximize();
|
||||||
context.getDriver().get("https://ostin.com/");
|
context.getDriver().get(URL);
|
||||||
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
navigation = new Navigation((WebDriver) context);
|
navigation = new Navigation((WebDriver) context);
|
||||||
}
|
}
|
||||||
@ -36,21 +35,23 @@ public class NavigationTests {
|
|||||||
@Test
|
@Test
|
||||||
public void checkForSaleRedirect() {
|
public void checkForSaleRedirect() {
|
||||||
navigation.saleLinkClick();
|
navigation.saleLinkClick();
|
||||||
Assert.assertTrue("test passed", true);
|
navigation.womaneSalesLink();
|
||||||
|
PageFactory.initElements(context.getDriver(), Navigation.class);
|
||||||
|
Assertions.assertTrue(navigation.womaneSalesLink());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkForFemalesSaleRedirect() {
|
public void checkForFemalesSaleRedirect() {
|
||||||
navigation.saleFemaleLinkClick();
|
navigation.saleFemaleLinkClick();
|
||||||
navigation.setMainTitle();
|
PageFactory.initElements(context.getDriver(), Navigation.class);
|
||||||
Assert.assertTrue("passed", true);
|
Assertions.assertTrue(navigation.setMainTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkForBasementLinkRedirect() {
|
public void checkForBasementLinkRedirect() {
|
||||||
boolean pass = false;
|
|
||||||
navigation.basementLinkClick();
|
navigation.basementLinkClick();
|
||||||
Assert.assertTrue("passed", true);
|
PageFactory.initElements(context.getDriver(), Navigation.class);
|
||||||
|
Assertions.assertTrue(navigation.setDisplayedPromo());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -58,8 +59,8 @@ public class NavigationTests {
|
|||||||
navigation.socialElementLinkClcik();
|
navigation.socialElementLinkClcik();
|
||||||
Set<String> tabs = context.getDriver().getWindowHandles();
|
Set<String> tabs = context.getDriver().getWindowHandles();
|
||||||
context.getDriver().switchTo().window(Iterators.getLast(tabs.iterator()));
|
context.getDriver().switchTo().window(Iterators.getLast(tabs.iterator()));
|
||||||
navigation.setPageName();
|
PageFactory.initElements(context.getDriver(), Navigation.class);
|
||||||
Assert.assertTrue("passed", true);
|
Assertions.assertTrue(navigation.setPageName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -2,49 +2,50 @@ package tests;
|
|||||||
|
|
||||||
import helpers.ChromeContext;
|
import helpers.ChromeContext;
|
||||||
import helpers.Context;
|
import helpers.Context;
|
||||||
import pages.Email;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.openqa.selenium.support.PageFactory;
|
||||||
import pages.Recyclebin;
|
import pages.Recyclebin;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class RecylebinTests {
|
public class RecylebinTests {
|
||||||
|
|
||||||
private static Recyclebin recyclebin;
|
private static Recyclebin recyclebin;
|
||||||
private static Context context;
|
private static Context context;
|
||||||
|
private final static String URL = "https://ostin.com/ru/ru/catalog/jenskaya_odejda/" +
|
||||||
|
"jenskaya_verhnyaya_odejda/jenskie_kurtki_i_vetrovki/156777240299/?scId=19836410299";
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
context = new ChromeContext();
|
context = new ChromeContext();
|
||||||
context.start();
|
context.start();
|
||||||
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
|
||||||
context.getDriver().manage().window().maximize();
|
context.getDriver().manage().window().maximize();
|
||||||
context.getDriver().get("https://ostin.com/ru/ru/catalog/jenskaya_odejda/" + "jenskaya_verhnyaya_odejda/jenskie_kurtki_i_vetrovki/156777240299/?scId=19836410299");
|
context.getDriver().get(URL);
|
||||||
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
|
||||||
recyclebin = new Recyclebin((WebDriver) context);
|
recyclebin = new Recyclebin((WebDriver) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkForAddItemToCart() {
|
public void checkForAddItemToCart() {
|
||||||
recyclebin.colorClick();
|
recyclebin.colorClick();
|
||||||
context.getDriver().manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
|
|
||||||
recyclebin.pickSizeClick();
|
recyclebin.pickSizeClick();
|
||||||
recyclebin.addToCartButtonClick();
|
recyclebin.addToCartButtonClick();
|
||||||
Assert.assertTrue("test passed", true);
|
PageFactory.initElements(context.getDriver(), Recyclebin.class);
|
||||||
|
Assertions.assertTrue(recyclebin.afterClick());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkForRemoveItem() {
|
public void checkForRemoveItem() {
|
||||||
recyclebin.toCartClick();
|
recyclebin.toCartClick();
|
||||||
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
|
||||||
recyclebin.removeItem();
|
recyclebin.removeItem();
|
||||||
Assert.assertTrue("passed", true);
|
PageFactory.initElements(context.getDriver(), Recyclebin.class);
|
||||||
|
Assertions.assertTrue(recyclebin.removeItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -4,71 +4,74 @@ import helpers.ChromeContext;
|
|||||||
import helpers.Context;
|
import helpers.Context;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
|
|
||||||
|
import org.openqa.selenium.support.PageFactory;
|
||||||
import pages.Sort;
|
import pages.Sort;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class SortTests {
|
public class SortTests {
|
||||||
|
|
||||||
private static Context context;
|
private static Context context;
|
||||||
private static Sort sort;
|
private static Sort sort;
|
||||||
|
private final static String URL = "https://ostin.com/ru/ru/catalog/jenskaya_odejda/jenskaya_verhnyaya_odejda/";
|
||||||
|
private final static String SEARCH_TYPE = "куртка";
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
context = new ChromeContext();
|
context = new ChromeContext();
|
||||||
context.start();
|
context.start();
|
||||||
context.getDriver().get("https://ostin.com/ru/ru/catalog/jenskaya_odejda/jenskaya_verhnyaya_odejda/");
|
context.getDriver().get(URL);
|
||||||
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
|
||||||
sort = new Sort((WebDriver) context);
|
sort = new Sort((WebDriver) context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkForSorting() {
|
public void checkForSorting() {
|
||||||
sort.sortDropDownClick();
|
sort.sortDropDownClick();
|
||||||
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||||
sort.checkForDisplayed();
|
Assertions.assertTrue(sort.checkForDisplayed());
|
||||||
Assert.assertTrue("test passed", true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkForSortingBt() {
|
public void checkForSortingBt() {
|
||||||
sort.sortDropDownClick();
|
sort.sortDropDownClick();
|
||||||
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
|
||||||
sort.sortBySalesClick();
|
sort.sortBySalesClick();
|
||||||
context.getDriver().manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
|
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||||
Assert.assertTrue("test passed", true);
|
Assertions.assertTrue(sort.checkForSalesDisplayed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkForSizeFiltering() {
|
public void checkForSizeFiltering() {
|
||||||
sort.sizeFilter();
|
sort.sizeFilter();
|
||||||
Assert.assertTrue("passed", true);
|
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||||
|
Assertions.assertTrue(sort.checkForSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkForColorFiltering() {
|
public void checkForColorFiltering() {
|
||||||
sort.colorFilter();
|
sort.colorFilter();
|
||||||
Assert.assertFalse(!true);
|
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||||
|
Assertions.assertTrue(sort.checkForColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkForCostFilter() {
|
public void checkForCostFilter() {
|
||||||
sort.costFilter();
|
sort.costFilter();
|
||||||
Assert.assertTrue("passed", true);
|
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||||
|
Assertions.assertTrue(sort.checkForCost());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkForSearch() {
|
public void checkForSearch() {
|
||||||
sort.searching("куртка");
|
sort.searching(SEARCH_TYPE);
|
||||||
context.getDriver().manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
|
|
||||||
sort.setSearchingRequset();
|
sort.setSearchingRequset();
|
||||||
Assert.assertTrue("passed", true);
|
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||||
|
Assertions.assertTrue(sort.checkForResultSearching());
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
Loading…
Reference in New Issue
Block a user