Rukavishnikova #14

Closed
kotenok-339 wants to merge 17 commits from Rukavishnikova into master
Showing only changes of commit 3b964d787e - Show all commits

View File

@ -1,16 +1,15 @@
package ru.oriflame.pages; package ru.oriflame.pages;
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;
public class FilterBy { public class FilterBy {
public WebDriver driver; public WebDriver driver;
public FilterBy(WebDriver driver) { public FilterBy(WebDriver driver) {
PageFactory.initElements(driver, this);
this.driver = driver; this.driver = driver;
} }
@ -32,34 +31,137 @@ public class FilterBy {
@FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[6]/h3") @FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[6]/h3")
private WebElement filterByBrand; private WebElement filterByBrand;
@FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[3]/div/ul[1]/li[7]/a") @FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[5]/div/ul[1]/li[1]/a")
private WebElement filterByAdvantageOsv; private WebElement age12;
@FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[3]/div/ul[1]/li[1]/a")
private WebElement anti;
public void faceClick() { public void faceClick() {
face.click(); face.click();
} }
public void FilterByAdvantageAnti() {
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
}
anti.click();
}
public void filterByAge12() {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
age12.click();
}
public void openingFilterBy() { public void openingFilterBy() {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
openedFilterrBy.click(); openedFilterrBy.click();
} }
public void clickingFilterByIndications() { public void clickingFilterByIndications() {
filetrByIndications.click(); try {
} Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
filetrByIndications.click(); }
public void clickingFilterByAge() { public void clickingFilterByAge() {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
filterByAge.click(); filterByAge.click();
} }
public void clickingFilterByAdvantage () { public void clickingFilterByAdvantage () {
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
}
filterByAdvantage.click(); filterByAdvantage.click();
} }
public void clickingFilterByBrand() { public void clickingFilterByBrand() {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
filterByBrand.click(); filterByBrand.click();
} }
public void clickingFilterByAdvantageOsv () { public boolean AssertFilterBy() {
filterByAdvantageOsv.click(); return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filter-box.w-filter-box-no-css.fixed > form")).isDisplayed();
}
public boolean AssertByIndications() {
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filter-box.w-filter-box-no-css.fixed > form > ul > li.facet.row.g-all.opened > div > ul:nth-child(1)")).isDisplayed();
}
public boolean assertFilterByBrand() {
return driver.findElement(By.cssSelector("li.facet:nth-child(6) > div:nth-child(2) > ul:nth-child(1)")).isDisplayed();
}
public boolean assertFilterByAdvantage() {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filter-box.w-filter-box-no-css.fixed > form > ul > li.facet.row.g-all.opened > div > ul:nth-child(1)")).isDisplayed();
}
public boolean assertFilterByAge() {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filtering-info.g-all > div.w-filtered-facets > span")).getText().indexOf("12+") >= 0;
}
catch (Exception e)
{
return false;
}
}
public boolean assertFilterByAdvantageAnti() {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filtering-info.g-all > div.w-filtered-facets > span")).getText().indexOf("Антивозрастной Уход") >= 0;
}
catch (Exception e)
{
return false;
}
} }
} }