Rukavishnikova #14

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

View File

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