Rukavishnikova #14

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

View File

@ -1,75 +1,70 @@
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.MainPage; import ru.oriflame.pages.MainPage;
import static java.util.concurrent.TimeUnit.SECONDS;
public class MainPageTest { public class MainPageTest {
private static WebDriver driver; private final static String APP_URL = "https://www.oriflame.ru/products/product?code=32418";
private static MainPage mainPage; 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();
mainPage = new MainPage(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 checkHeightMenu() { public void checkHeightMenu() {
TestCase.assertTrue("Testing if true holds", true); context.getDriver().get(APP_URL);
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
mainPage.faceClick(); mainPage.faceClick();
String url = driver.getCurrentUrl(); Assert.assertTrue(MainPage.assertHeightMenu());
Assert.assertTrue((url.contains("https://www.oriflame.ru/skincare")));
} }
@Test @Test
public void checkProfileCap() { public void checkProfileCap() {
TestCase.assertTrue("Testing if true holds", true); context.getDriver().get(APP_URL);
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
mainPage.registrClick(); mainPage.registrClick();
String url = driver.getCurrentUrl(); Assert.assertTrue(MainPage.assertRegister());
Assert.assertTrue(url.contains("https://www.oriflame.ru/business-opportunity/become-consultant"));
} }
@Test @Test
public void checkDown() { public void checkDown() {
TestCase.assertTrue("Testing if true holds", true); context.getDriver().get(APP_URL);
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
mainPage.mainClick();
mainPage.podvalClick(); mainPage.podvalClick();
String url = driver.getCurrentUrl(); Assert.assertTrue(MainPage.assertDown());
Assert.assertTrue((url.contains("https://oriflame.com")));
} }
@Test @Test
public void checkBasementLink() { public void checkBasementLink() {
TestCase.assertTrue("Testing if true holds", true); context.getDriver().get(APP_URL);
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
mainPage.mainClick();
mainPage.bannerClick(); mainPage.bannerClick();
String url = driver.getCurrentUrl(); Assert.assertTrue(MainPage.assertBanner());
Assert.assertTrue((url.contains("https://www.oriflame.ru/products/product?code=33959")));
} }
@Test @Test
public void checkProduct() { public void checkProduct() {
TestCase.assertTrue("Testing if true holds", true); context.getDriver().get(APP_URL);
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
mainPage.faceClick();
mainPage.productClick(); mainPage.productClick();
String url = driver.getCurrentUrl(); Assert.assertTrue(MainPage.assertProduct());
Assert.assertTrue((url.contains("https://www.oriflame.ru/products/product?code=32440")));
} }
@AfterClass
public static void chromeClose() {
driver.quit();
}
} }