Update ChangeLanguageTest.java

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

View File

@ -1,43 +1,39 @@
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.ChangeLanguages; import ru.oriflame.pages.ChangeLanguages;
import ru.oriflame.pages.MainPage;
import static java.util.concurrent.TimeUnit.SECONDS;
public class ChangeLanguageTest { public class ChangeLanguageTest {
public static WebDriver driver; private final static String APP_URL = "https://www.oriflame.ru";
public static ChangeLanguages changeLanguage; 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();
changeLanguage = new ChangeLanguages(driver); }
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, SECONDS); @AfterClass
driver.get("https://oriflame.com/"); public static void quit() {
context.close();
} }
@Test @Test
public void checkChangelanguage() { public void checkChangelanguage() {
TestCase.assertTrue("Testing if true holds", true); context.getDriver().get(APP_URL);
MainPage mainPage = PageFactory.initElements(context.getDriver(), MainPage.class);
mainPage.podvalClick();
ChangeLanguages changeLanguage = PageFactory.initElements(context.getDriver(), ChangeLanguages.class);
changeLanguage.asiaButtonClicking(); changeLanguage.asiaButtonClicking();
changeLanguage.chinaLinking(); changeLanguage.chinaLinking();
driver.manage().timeouts().implicitlyWait(50, SECONDS); Assert.assertTrue(changeLanguage.assertChangelanguag());
String url = driver.getCurrentUrl();
Assert.assertTrue(url.contains("https://cn.oriflame.com/"));
}
@AfterClass
public static void closeChrome() {
driver.close();
} }
} }