Update SearchingTest.java
This commit is contained in:
parent
72643afa78
commit
6c97e12bd2
@ -1,51 +1,48 @@
|
||||
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.openqa.selenium.support.PageFactory;
|
||||
import ru.oriflame.context.ChromeContext;
|
||||
import ru.oriflame.context.Context;
|
||||
import ru.oriflame.pages.Search;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
public class SearchingTest {
|
||||
public static WebDriver driver;
|
||||
public static Search search;
|
||||
|
||||
private final static String APP_URL = "https://oriflame.ru/";
|
||||
private static Context context;
|
||||
String search1 = "шампунь";
|
||||
String search2 = "123";
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() {
|
||||
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe");
|
||||
driver = new ChromeDriver();
|
||||
search = new Search(driver);
|
||||
driver.manage().window().maximize();
|
||||
driver.manage().timeouts().implicitlyWait(20, SECONDS);
|
||||
driver.get("https://oriflame.ru/");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSearchingByKeyWords() throws InterruptedException {
|
||||
TestCase.assertTrue("Testing if true holds", true);
|
||||
search.inputSearchField("шампунь");
|
||||
search.clickSearchingButton();
|
||||
String url = driver.getCurrentUrl();
|
||||
Assert.assertTrue((url.contains("https://www.oriflame.ru/search?query=шампунь")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSearchingByNumb() throws InterruptedException {
|
||||
TestCase.assertTrue("Testing if true holds", true);
|
||||
search.inputSearchField("123");
|
||||
search.clickSearchingButton();
|
||||
String url = driver.getCurrentUrl();
|
||||
Assert.assertTrue((url.contains("https://www.oriflame.ru/search?query=123")));
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void cromeClose() {
|
||||
driver.close();
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSearchingByKeyWords() {
|
||||
context.getDriver().get(APP_URL);
|
||||
Search search = PageFactory.initElements(context.getDriver(), Search.class);
|
||||
search.inputSearchField(search1);
|
||||
search.clickSearchingButton();
|
||||
Assert.assertTrue(search.checkSearch(search1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSearchingByNumb() {
|
||||
context.getDriver().get(APP_URL);
|
||||
Search search = PageFactory.initElements(context.getDriver(), Search.class);
|
||||
search.inputSearchField(search2);
|
||||
search.clickSearchingButton();
|
||||
Assert.assertTrue(search.checkSearch(search2));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user