Update AnotherlinksTest.java

This commit is contained in:
Екатерина 2018-12-08 20:51:06 +00:00
parent 709ac331ba
commit f0e42847a5

View File

@ -1,53 +1,53 @@
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.AnotherLinks;
import static java.util.concurrent.TimeUnit.SECONDS;
public class AnotherlinksTest {
public static WebDriver driver;
public static AnotherLinks anotherLinks;
private final static String APP_URL = "https://www.oriflame.ru/products/product?code=32418";
private static Context context;
@BeforeClass
public static void setup() {
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe");
driver = new ChromeDriver();
anotherLinks = new AnotherLinks(driver);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, SECONDS);
driver.get("https://www.oriflame.ru/products/product?code=32418");
context = new ChromeContext();
context.start();
}
@AfterClass
public static void quit() {
context.close();
}
@Test
public void checkDeliveryClick() {
TestCase.assertTrue("Testing if true holds", true);
anotherLinks.deliveryClicking();
String url = driver.getCurrentUrl();
Assert.assertTrue(url.contains("https://www.oriflame.ru/products/product?code=32418"));
public void checkFormClick() {
context.getDriver().get(APP_URL);
AnotherLinks anotherLinks = PageFactory.initElements(context.getDriver(), AnotherLinks.class);
anotherLinks.formClicking();
Assert.assertTrue(anotherLinks.assertFormClick());
}
@Test
public void checkContactsSCClick() {
TestCase.assertTrue("Testing if true holds", true);
anotherLinks.deliveryClicking();
context.getDriver().get(APP_URL);
AnotherLinks anotherLinks = PageFactory.initElements(context.getDriver(), AnotherLinks.class);
anotherLinks.formClicking();
anotherLinks.clickingContactsServicesCenters();
String url = driver.getCurrentUrl();
Assert.assertTrue(url.contains("https://www.oriflame.ru/products/~/link.aspx?_id=C4D5FBB327A943F5AC38D85A6D69ED21&_z=z"));
Assert.assertTrue(anotherLinks.assertContactsServicesCenters());
}
@Test
public void checkOriflameLogoClickingFromMainPage() {
TestCase.assertTrue("Testing if true holds", true);
context.getDriver().get(APP_URL);
AnotherLinks anotherLinks = PageFactory.initElements(context.getDriver(), AnotherLinks.class);
anotherLinks.clickingOrifalemLogo();
String url = driver.getCurrentUrl();
Assert.assertTrue(url.contains("https://www.oriflame.ru"));
Assert.assertTrue(anotherLinks.assertMainMenu());
}
}