Compare commits
5 Commits
master
...
Kochkaleva
Author | SHA1 | Date | |
---|---|---|---|
|
50dac2dd23 | ||
|
d458c53a17 | ||
|
6039438f6e | ||
|
e8b00cbe09 | ||
|
978bf399a8 |
56
Kochkaleva/pom.xml
Normal file
56
Kochkaleva/pom.xml
Normal file
@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>kochkaleva_labs</groupId>
|
||||
<artifactId>kochkaleva_labs</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-java</artifactId>
|
||||
<version>3.7.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.1.0-RC1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.javafaker</groupId>
|
||||
<artifactId>javafaker</artifactId>
|
||||
<version>0.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
BIN
Kochkaleva/src/main/resources/chromedriver
Normal file
BIN
Kochkaleva/src/main/resources/chromedriver
Normal file
Binary file not shown.
BIN
Kochkaleva/src/main/resources/chromedriver.exe
Normal file
BIN
Kochkaleva/src/main/resources/chromedriver.exe
Normal file
Binary file not shown.
25
Kochkaleva/src/test/java/helpers/ChromeContext.java
Normal file
25
Kochkaleva/src/test/java/helpers/ChromeContext.java
Normal file
@ -0,0 +1,25 @@
|
||||
package helpers;
|
||||
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
|
||||
public class ChromeContext extends Context {
|
||||
private final static String WINDOWS_DRIVER = "chromedriver.exe";
|
||||
private final static String LINUX_DRIVER = "chromedriver";
|
||||
private final static String DRIVER_TYPE = "webdriver.chrome.driver";
|
||||
|
||||
@Override
|
||||
protected void createDriver() {
|
||||
driver = new ChromeDriver();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverExecutable(boolean isWindows) {
|
||||
return isWindows ? WINDOWS_DRIVER : LINUX_DRIVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDriverType() {
|
||||
return DRIVER_TYPE;
|
||||
}
|
||||
}
|
||||
|
45
Kochkaleva/src/test/java/helpers/Context.java
Normal file
45
Kochkaleva/src/test/java/helpers/Context.java
Normal file
@ -0,0 +1,45 @@
|
||||
package helpers;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public abstract class Context {
|
||||
private final static String DRIVER_LOCATION = "src\\main\\resources\\chromedriver.exe";
|
||||
protected WebDriver driver;
|
||||
|
||||
public WebDriver getDriver() {
|
||||
if (driver != null) {
|
||||
return driver;
|
||||
}
|
||||
throw new IllegalStateException("WebDriver is not initialized");
|
||||
}
|
||||
|
||||
public void start() {
|
||||
System.setProperty("webdriver.chrome.driver", "src\\main\\resources\\chromedriver.exe");
|
||||
driver = new ChromeDriver();
|
||||
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
protected abstract void createDriver();
|
||||
|
||||
protected abstract String getDriverType();
|
||||
|
||||
protected abstract String getDriverExecutable(boolean windows);
|
||||
|
||||
private String getDriverExecutablePath() {
|
||||
System.setProperty("webdriver.chrome.driver", DRIVER_LOCATION);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isWindows() {
|
||||
return System.getProperty("os.name").toLowerCase().contains("windows");
|
||||
}
|
||||
}
|
86
Kochkaleva/src/test/java/pages/Email.java
Normal file
86
Kochkaleva/src/test/java/pages/Email.java
Normal file
@ -0,0 +1,86 @@
|
||||
package pages;
|
||||
|
||||
import com.github.javafaker.Faker;
|
||||
import helpers.Context;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
public class Email {
|
||||
|
||||
private WebDriver driver;
|
||||
private Context context;
|
||||
Faker faker = new Faker();
|
||||
|
||||
public Email(WebDriver driver) {
|
||||
PageFactory.initElements(driver, this);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
@FindBy(name = "email")
|
||||
private WebElement emailField;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"subscribe_submit\"]")
|
||||
private WebElement submitButton;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"subscribePopup\"]/div[1]")
|
||||
private WebElement succsessAlert;
|
||||
|
||||
@FindBy(id = "loginRef")
|
||||
private WebElement logInLink;
|
||||
|
||||
@FindBy(name = "login")
|
||||
private WebElement loginField;
|
||||
|
||||
@FindBy(name = "password")
|
||||
private WebElement passwordField;
|
||||
|
||||
@FindBy(id = "loginPopupButtonID")
|
||||
private WebElement logInButton;
|
||||
|
||||
|
||||
|
||||
public void emailService() {
|
||||
String firstPart = faker.name().firstName();
|
||||
String secondPart = faker.name().lastName();
|
||||
String domen = faker.app().name();
|
||||
emailField.sendKeys(Keys.chord(Keys.CONTROL, "v") + firstPart + secondPart + "@" + domen + ".com");
|
||||
}
|
||||
|
||||
public void submitButtonClick() {
|
||||
submitButton.click();
|
||||
}
|
||||
|
||||
public boolean setSuccsessAlert() {
|
||||
return driver.findElement(By.xpath("//*[@id=\"subscribePopup\"]/div[1]")).isDisplayed();
|
||||
|
||||
}
|
||||
|
||||
public void logInLinkCLick() {
|
||||
logInLink.click();
|
||||
}
|
||||
|
||||
public void fillFields(String email,String password) {
|
||||
emailField.sendKeys(email);
|
||||
passwordField.sendKeys(password);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
87
Kochkaleva/src/test/java/pages/Navigation.java
Normal file
87
Kochkaleva/src/test/java/pages/Navigation.java
Normal file
@ -0,0 +1,87 @@
|
||||
package pages;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
|
||||
|
||||
public class Navigation {
|
||||
|
||||
private WebDriver driver;
|
||||
|
||||
public Navigation(WebDriver driver) {
|
||||
PageFactory.initElements(driver, this);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
@FindBy(xpath = "/html/body/div[7]/div[1]/div/div[4]/div/a[1]")
|
||||
private WebElement yesCityButton;
|
||||
|
||||
@FindBy(id = "cat_cat308680401")
|
||||
private WebElement saleLink;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"cat_cat308680401\"]/div/div/div/div/ul/li[1]/a")
|
||||
private WebElement saleFemaleLink;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_footer\"]/div[2]/div/div/div/div[1]/a[2]")
|
||||
private WebElement basementLink;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_footer\"]/div[3]/div/ul/li[2]/div[1]/div/a[2]")
|
||||
private WebElement socialElementLink;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"group\"]/div[1]/div[2]/div[2]/h2")
|
||||
private WebElement pageName;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/ul/li[1]")
|
||||
private WebElement displayedPromo;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[1]/h1")
|
||||
private WebElement mainTitle;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div/div[1]/div/div[1]/a")
|
||||
private WebElement womenSales;
|
||||
|
||||
public boolean womaneSalesLink() {
|
||||
return womenSales.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean setMainTitle() {
|
||||
return mainTitle.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean setDisplayedPromo() {
|
||||
return displayedPromo.isDisplayed();
|
||||
}
|
||||
|
||||
public boolean setPageName() {
|
||||
return pageName.isDisplayed();
|
||||
}
|
||||
|
||||
private void setCurrentCity() {
|
||||
if (yesCityButton != null) {
|
||||
yesCityButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
public void saleLinkClick() {
|
||||
setCurrentCity();
|
||||
saleLink.click();
|
||||
}
|
||||
|
||||
public void saleFemaleLinkClick() {
|
||||
setCurrentCity();
|
||||
saleFemaleLink.click();
|
||||
}
|
||||
|
||||
public void basementLinkClick() {
|
||||
setCurrentCity();
|
||||
basementLink.click();
|
||||
}
|
||||
|
||||
public void socialElementLinkClcik() {
|
||||
setCurrentCity();
|
||||
socialElementLink.click();
|
||||
}
|
||||
|
||||
}
|
69
Kochkaleva/src/test/java/pages/Recyclebin.java
Normal file
69
Kochkaleva/src/test/java/pages/Recyclebin.java
Normal file
@ -0,0 +1,69 @@
|
||||
package pages;
|
||||
|
||||
import helpers.Context;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Recyclebin {
|
||||
|
||||
private WebDriver driver;
|
||||
private Context context;
|
||||
|
||||
public Recyclebin(WebDriver driver) {
|
||||
PageFactory.initElements(driver, this);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"sc_19836410299\"]")
|
||||
private WebElement color;
|
||||
|
||||
@FindBy(id = "size_170398140299")
|
||||
private WebElement pickSize;
|
||||
|
||||
@FindBy(id = "addItemToOrderID")
|
||||
private WebElement addToCartButton;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"headerCart\"]/a")
|
||||
private WebElement toCart;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"cartPopup\"]/div[2]/div[2]/div[2]/a")
|
||||
private WebElement followCart;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[9]/div[2]/div/div/ul/li[1]/div/a/img")
|
||||
private WebElement imagePoint;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[9]/div[2]/div/div/a")
|
||||
private WebElement removeLink;
|
||||
|
||||
public void pickSizeClick() {
|
||||
pickSize.click();
|
||||
}
|
||||
public void colorClick() {
|
||||
color.click();
|
||||
context.getDriver().manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void addToCartButtonClick() {
|
||||
addToCartButton.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();
|
||||
}
|
||||
}
|
150
Kochkaleva/src/test/java/pages/Sort.java
Normal file
150
Kochkaleva/src/test/java/pages/Sort.java
Normal file
@ -0,0 +1,150 @@
|
||||
package pages;
|
||||
|
||||
import helpers.Context;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Sort {
|
||||
|
||||
private WebDriver driver;
|
||||
private static Context context;
|
||||
|
||||
public Sort(WebDriver driver) {
|
||||
PageFactory.initElements(driver, this);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[1]/div/form/div/i")
|
||||
private WebElement sortDropDown;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[1]/div/form/div/div/div[2]/ul/li[4]")
|
||||
private WebElement sortBySales;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[1]/div/form/div/span")
|
||||
private WebElement sortLabel;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[1]/i")
|
||||
private WebElement dropDownSize;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[1]/div/div[2]/ul/div/div/li[1]/" +
|
||||
"label/input")
|
||||
private WebElement checkBoxSize;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[2]/i")
|
||||
private WebElement dropDownColor;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[2]/div/div[2]/ul/li[1]/label/span/i")
|
||||
private WebElement checkBoxColor;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[3]/i")
|
||||
private WebElement dropDownCost;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"searchPriceSliderMin\"]")
|
||||
private WebElement minCostField;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[2]/form/div[3]/div/div[2]/a")
|
||||
private WebElement submitButton;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"searchForm\"]/a")
|
||||
private WebElement searchButton;
|
||||
|
||||
@FindBy(id = "atg_store_searchInput")
|
||||
private WebElement searchField;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[3]/div/div/b[1]")
|
||||
private WebElement searchingRequset;
|
||||
|
||||
public void setSearchingRequset() {
|
||||
if (searchingRequset != null) {
|
||||
|
||||
} else {
|
||||
throw new IllegalStateException(" this");
|
||||
}
|
||||
}
|
||||
|
||||
public static int random(int lowerBound, int upperBound) {
|
||||
return (lowerBound + (int) Math.round(Math.random()
|
||||
* (upperBound - lowerBound)));
|
||||
}
|
||||
|
||||
public void sortDropDownClick() {
|
||||
sortDropDown.click();
|
||||
context.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public boolean checkForDisplayed() {
|
||||
return driver.findElement(By
|
||||
.xpath("//*[@id=\"atg_store_content\"]/div[2]/div[2]/div[1]/div/form/div/div/div[2]/ul/li[1]"))
|
||||
.isDisplayed();
|
||||
}
|
||||
|
||||
public void sortBySalesClick() {
|
||||
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() {
|
||||
String labelText = sortLabel.getAttribute("innerText");
|
||||
return labelText;
|
||||
}
|
||||
|
||||
public void sizeFilter() {
|
||||
dropDownSize.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"));
|
||||
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() {
|
||||
dropDownColor.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"));
|
||||
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() {
|
||||
int cost = random(1500, 5000);
|
||||
dropDownCost.click();
|
||||
minCostField.sendKeys(Integer.toString(cost));
|
||||
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) {
|
||||
searchButton.click();
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
65
Kochkaleva/src/test/java/tests/EmailTests.java
Normal file
65
Kochkaleva/src/test/java/tests/EmailTests.java
Normal file
@ -0,0 +1,65 @@
|
||||
package tests;
|
||||
|
||||
import helpers.ChromeContext;
|
||||
import helpers.Context;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import pages.Email;
|
||||
|
||||
import org.junit.*;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
|
||||
public class EmailTests {
|
||||
|
||||
private static Email email;
|
||||
private static Context context;
|
||||
private final static String URL = "https://ostin.com/";
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() {
|
||||
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
|
||||
context.getDriver().manage().window().maximize();
|
||||
context.getDriver().get(URL);
|
||||
email = new Email((WebDriver) context);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForFollow() throws InterruptedException {
|
||||
Thread.sleep(3000);
|
||||
email.emailService();
|
||||
email.submitButtonClick();
|
||||
Email email = PageFactory.initElements(context.getDriver(), Email.class);
|
||||
Assertions.assertTrue(email.setSuccsessAlert());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForLogIn() {
|
||||
email.logInLinkCLick();
|
||||
email.fillFields("lkdlfr@mail.ru", "jhbhjbjbj");
|
||||
email.logInButtonClick();
|
||||
PageFactory.initElements(context.getDriver(), Email.class);
|
||||
Assertions.assertTrue(email.canClickLogInButton());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForLogOut() {
|
||||
email.logInLinkCLick();
|
||||
email.fillFields("asda@dasd.asd", "12312eqs");
|
||||
email.logInButtonClick();
|
||||
PageFactory.initElements(context.getDriver(), Email.class);
|
||||
Assertions.assertTrue(email.logInButtonDisplayed());
|
||||
}
|
||||
|
||||
@After
|
||||
public void quit() {
|
||||
context.getDriver().quit();
|
||||
}
|
||||
|
||||
}
|
71
Kochkaleva/src/test/java/tests/NavigationTests.java
Normal file
71
Kochkaleva/src/test/java/tests/NavigationTests.java
Normal file
@ -0,0 +1,71 @@
|
||||
package tests;
|
||||
|
||||
import com.google.common.collect.Iterators;
|
||||
|
||||
import helpers.ChromeContext;
|
||||
import helpers.Context;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import pages.Navigation;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class NavigationTests {
|
||||
|
||||
private static Context context;
|
||||
private static Navigation navigation;
|
||||
private final static String URL = "https://ostin.com/";
|
||||
|
||||
@Before
|
||||
public static void setUp() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().maximize();
|
||||
context.getDriver().get(URL);
|
||||
|
||||
navigation = new Navigation((WebDriver) context);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForSaleRedirect() {
|
||||
navigation.saleLinkClick();
|
||||
navigation.womaneSalesLink();
|
||||
PageFactory.initElements(context.getDriver(), Navigation.class);
|
||||
Assertions.assertTrue(navigation.womaneSalesLink());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForFemalesSaleRedirect() {
|
||||
navigation.saleFemaleLinkClick();
|
||||
PageFactory.initElements(context.getDriver(), Navigation.class);
|
||||
Assertions.assertTrue(navigation.setMainTitle());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForBasementLinkRedirect() {
|
||||
navigation.basementLinkClick();
|
||||
PageFactory.initElements(context.getDriver(), Navigation.class);
|
||||
Assertions.assertTrue(navigation.setDisplayedPromo());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForFollowSocialLink() {
|
||||
navigation.socialElementLinkClcik();
|
||||
Set<String> tabs = context.getDriver().getWindowHandles();
|
||||
context.getDriver().switchTo().window(Iterators.getLast(tabs.iterator()));
|
||||
PageFactory.initElements(context.getDriver(), Navigation.class);
|
||||
Assertions.assertTrue(navigation.setPageName());
|
||||
}
|
||||
|
||||
@After
|
||||
public void quit() {
|
||||
context.getDriver().quit();
|
||||
}
|
||||
|
||||
}
|
56
Kochkaleva/src/test/java/tests/RecylebinTests.java
Normal file
56
Kochkaleva/src/test/java/tests/RecylebinTests.java
Normal file
@ -0,0 +1,56 @@
|
||||
package tests;
|
||||
|
||||
import helpers.ChromeContext;
|
||||
import helpers.Context;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import pages.Recyclebin;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
|
||||
public class RecylebinTests {
|
||||
|
||||
private static Recyclebin recyclebin;
|
||||
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
|
||||
public void setUp() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().manage().window().maximize();
|
||||
context.getDriver().get(URL);
|
||||
|
||||
recyclebin = new Recyclebin((WebDriver) context);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForAddItemToCart() {
|
||||
recyclebin.colorClick();
|
||||
recyclebin.pickSizeClick();
|
||||
recyclebin.addToCartButtonClick();
|
||||
PageFactory.initElements(context.getDriver(), Recyclebin.class);
|
||||
Assertions.assertTrue(recyclebin.afterClick());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForRemoveItem() {
|
||||
recyclebin.toCartClick();
|
||||
|
||||
recyclebin.removeItem();
|
||||
PageFactory.initElements(context.getDriver(), Recyclebin.class);
|
||||
Assertions.assertTrue(recyclebin.removeItem());
|
||||
}
|
||||
|
||||
@After
|
||||
public void quit() {
|
||||
context.getDriver().quit();
|
||||
}
|
||||
|
||||
}
|
82
Kochkaleva/src/test/java/tests/SortTests.java
Normal file
82
Kochkaleva/src/test/java/tests/SortTests.java
Normal file
@ -0,0 +1,82 @@
|
||||
package tests;
|
||||
|
||||
import helpers.ChromeContext;
|
||||
import helpers.Context;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
import org.openqa.selenium.support.PageFactory;
|
||||
import pages.Sort;
|
||||
|
||||
|
||||
public class SortTests {
|
||||
|
||||
private static Context context;
|
||||
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
|
||||
public void setUp() {
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
context.getDriver().get(URL);
|
||||
|
||||
sort = new Sort((WebDriver) context);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForSorting() {
|
||||
sort.sortDropDownClick();
|
||||
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||
Assertions.assertTrue(sort.checkForDisplayed());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForSortingBt() {
|
||||
sort.sortDropDownClick();
|
||||
sort.sortBySalesClick();
|
||||
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||
Assertions.assertTrue(sort.checkForSalesDisplayed());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForSizeFiltering() {
|
||||
sort.sizeFilter();
|
||||
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||
Assertions.assertTrue(sort.checkForSize());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForColorFiltering() {
|
||||
sort.colorFilter();
|
||||
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||
Assertions.assertTrue(sort.checkForColor());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForCostFilter() {
|
||||
sort.costFilter();
|
||||
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||
Assertions.assertTrue(sort.checkForCost());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkForSearch() {
|
||||
sort.searching(SEARCH_TYPE);
|
||||
sort.setSearchingRequset();
|
||||
PageFactory.initElements(context.getDriver(), Sort.class);
|
||||
Assertions.assertTrue(sort.checkForResultSearching());
|
||||
}
|
||||
|
||||
@After
|
||||
public void quit() {
|
||||
context.getDriver().quit();
|
||||
}
|
||||
|
||||
}
|
@ -12,7 +12,7 @@ public class SearchPage {
|
||||
@FindBy(css = "input.header-search-input")
|
||||
private WebElement inputField;
|
||||
|
||||
@FindBy(xpath = "//a[contains(@href, 'Users')]")
|
||||
@FindBy(xpath = "//*[@class='menu border']/a[7]")
|
||||
private WebElement usersLink;
|
||||
|
||||
public SearchPage(WebDriver driver) {
|
||||
|
Loading…
Reference in New Issue
Block a user