Update FilterByTest.java

This commit is contained in:
Екатерина 2018-12-08 20:49:41 +00:00
parent 26da0b49b8
commit bd0b9f5479

View File

@ -1,92 +1,88 @@
package ru.oriflame.tests;
import junit.framework.TestCase;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.openqa.selenium.support.PageFactory;
import ru.oriflame.context.ChromeContext;
import ru.oriflame.context.Context;
import ru.oriflame.pages.FilterBy;
import static java.util.concurrent.TimeUnit.SECONDS;
public class FilterByTest {
public static WebDriver driver;
public static FilterBy filterBy;
private final static String APP_URL = "https://www.oriflame.ru";
private static Context context;
@BeforeClass
public static void setup() {
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe");
driver = new ChromeDriver();
filterBy = new FilterBy(driver);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, SECONDS);
driver.get("https://www.oriflame.ru");
context = new ChromeContext();
context.start();
}
@AfterClass
public static void quit() {
context.close();
}
@Test
public void checkOpenFilters() {
TestCase.assertTrue("Testing if true holds", true);
context.getDriver().get(APP_URL);
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
filterBy.faceClick();
filterBy.openingFilterBy();
String url = driver.getCurrentUrl();
Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare")));
filterBy.AssertFilterBy();
}
@Test
public void checkFilterByIndications() {
TestCase.assertTrue("Testing if true holds", true);
context.getDriver().get(APP_URL);
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
filterBy.faceClick();
filterBy.openingFilterBy();
filterBy.clickingFilterByIndications();
String url = driver.getCurrentUrl();
Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare")));
}
@Test
public void checkFilterByAge() {
TestCase.assertTrue("Testing if true holds", true);
filterBy.faceClick();
filterBy.openingFilterBy();
filterBy.clickingFilterByAge();
String url = driver.getCurrentUrl();
Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare")));
}
@Test
public void checkFilterByAdvantage() {
TestCase.assertTrue("Testing if true holds", true);
filterBy.faceClick();
filterBy.openingFilterBy();
filterBy.clickingFilterByAdvantage();
String url = driver.getCurrentUrl();
Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare")));
filterBy.AssertByIndications();
}
@Test
public void checkFilterByBrand() {
TestCase.assertTrue("Testing if true holds", true);
context.getDriver().get(APP_URL);
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
filterBy.faceClick();
filterBy.openingFilterBy();
filterBy.clickingFilterByBrand();
String url = driver.getCurrentUrl();
Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare")));
Assert.assertTrue(filterBy.assertFilterByBrand());
}
@Test
public void checkFilterByAge() {
context.getDriver().get(APP_URL);
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
filterBy.faceClick();
filterBy.openingFilterBy();
filterBy.clickingFilterByAge();
filterBy.filterByAge12();
Assert.assertTrue(filterBy.assertFilterByAge());
}
@Test
public void checkFilterByAdvantage() {
context.getDriver().get(APP_URL);
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
filterBy.faceClick();
filterBy.openingFilterBy();
filterBy.clickingFilterByAdvantage();
Assert.assertTrue(filterBy.assertFilterByAdvantage());
}
@Test
public void checkFilterByAdvantageOsv() {
TestCase.assertTrue("Testing if true holds", true);
context.getDriver().get(APP_URL);
FilterBy filterBy = PageFactory.initElements(context.getDriver(), FilterBy.class);
filterBy.faceClick();
filterBy.openingFilterBy();
filterBy.clickingFilterByAdvantage();
filterBy.clickingFilterByAdvantageOsv();
String url = driver.getCurrentUrl();
Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare/?benefits=fairness")));
}
@AfterClass
public static void closeChrome() {
driver.close();
filterBy.FilterByAdvantageAnti();
Assert.assertTrue(filterBy.assertFilterByAdvantageAnti());
}
}