Update SortByTest.java
This commit is contained in:
parent
065d590693
commit
72643afa78
@ -1,53 +1,46 @@
|
||||
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.SortBy;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
public class SortByTest {
|
||||
|
||||
public static WebDriver driver;
|
||||
public static SortBy sortBy;
|
||||
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();
|
||||
sortBy = new SortBy(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 checkShowMenuSort() {
|
||||
|
||||
TestCase.assertTrue("Testing if true holds", true);
|
||||
context.getDriver().get(APP_URL);
|
||||
SortBy sortBy = PageFactory.initElements(context.getDriver(), SortBy.class);
|
||||
sortBy.faceClick();
|
||||
sortBy.sortByClick();
|
||||
String url = driver.getCurrentUrl();
|
||||
Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare")));
|
||||
Assert.assertTrue(sortBy.assertShowMenuSort());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkLinkBySort() {
|
||||
TestCase.assertTrue("Testing if true holds", true);
|
||||
context.getDriver().get(APP_URL);
|
||||
SortBy sortBy = PageFactory.initElements(context.getDriver(), SortBy.class);
|
||||
sortBy.faceClick();
|
||||
sortBy.sortByClick();
|
||||
sortBy.sortByPopularClick();
|
||||
String url = driver.getCurrentUrl();
|
||||
Assert.assertTrue(url.contains("https://www.oriflame.ru/skincare/?sort=popular"));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void closeChrome() {
|
||||
driver.close();
|
||||
Assert.assertTrue(sortBy.assertcheckLinkBySort());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user