From 709ac331bace0fe9f644b6930809051d700c239d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BA=D0=B0=D1=82=D0=B5=D1=80=D0=B8=D0=BD=D0=B0?= Date: Sat, 8 Dec 2018 20:50:23 +0000 Subject: [PATCH] Update ChangeLanguageTest.java --- .../ru/oriflame/tests/ChangeLanguageTest.java | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/Rukavishnikova/src/test/java/ru/oriflame/tests/ChangeLanguageTest.java b/Rukavishnikova/src/test/java/ru/oriflame/tests/ChangeLanguageTest.java index 8e7d453..49b1523 100644 --- a/Rukavishnikova/src/test/java/ru/oriflame/tests/ChangeLanguageTest.java +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/ChangeLanguageTest.java @@ -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()); } }