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