Update ChangeLanguageTest.java
This commit is contained in:
parent
bd0b9f5479
commit
709ac331ba
@ -1,43 +1,39 @@
|
||||
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.ChangeLanguages;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import ru.oriflame.pages.MainPage;
|
||||
|
||||
public class ChangeLanguageTest {
|
||||
|
||||
public static WebDriver driver;
|
||||
public static ChangeLanguages changeLanguage;
|
||||
private final static String APP_URL = "https://www.oriflame.ru";
|
||||
private static Context context;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() {
|
||||
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe");
|
||||
driver = new ChromeDriver();
|
||||
changeLanguage = new ChangeLanguages(driver);
|
||||
driver.manage().window().maximize();
|
||||
driver.manage().timeouts().implicitlyWait(20, SECONDS);
|
||||
driver.get("https://oriflame.com/");
|
||||
context = new ChromeContext();
|
||||
context.start();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void quit() {
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
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.chinaLinking();
|
||||
driver.manage().timeouts().implicitlyWait(50, SECONDS);
|
||||
String url = driver.getCurrentUrl();
|
||||
Assert.assertTrue(url.contains("https://cn.oriflame.com/"));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void closeChrome() {
|
||||
driver.close();
|
||||
Assert.assertTrue(changeLanguage.assertChangelanguag());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user