From 53546b1ae76919a310e6416620522527012a1108 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 21:20:57 +0000 Subject: [PATCH] Update MultiMediaTest.java --- .../ru/oriflame/tests/MultiMediaTest.java | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/Rukavishnikova/src/test/java/ru/oriflame/tests/MultiMediaTest.java b/Rukavishnikova/src/test/java/ru/oriflame/tests/MultiMediaTest.java index 6db0216..bb32610 100644 --- a/Rukavishnikova/src/test/java/ru/oriflame/tests/MultiMediaTest.java +++ b/Rukavishnikova/src/test/java/ru/oriflame/tests/MultiMediaTest.java @@ -1,43 +1,35 @@ 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.openqa.selenium.support.PageFactory; +import ru.oriflame.context.ChromeContext; +import ru.oriflame.context.Context; import ru.oriflame.pages.MultiMedia; -import static java.util.concurrent.TimeUnit.SECONDS; - public class MultiMediaTest { - public static WebDriver driver; - public static MultiMedia multiMedia; + private final static String APP_URL = "http://investors.oriflame.com/"; + private static Context context; @BeforeClass public static void setup() { - System.setProperty("webdriver.chrome.driver", "C:\\chromedriver\\chromedriver.exe"); - driver = new ChromeDriver(); - multiMedia = new MultiMedia(driver); - driver.manage().window().maximize(); - driver.manage().timeouts().implicitlyWait(20, SECONDS); - driver.get("http://investors.oriflame.com/"); + context = new ChromeContext(); + context.start(); + } + + @AfterClass + public static void quit() { + context.close(); } @Test public void checkVideoPlay() { - TestCase.assertTrue("Testing if true holds", true); + context.getDriver().get(APP_URL); + MultiMedia multiMedia = PageFactory.initElements(context.getDriver(), MultiMedia.class); multiMedia.playVideoElement(); - driver.manage().timeouts().implicitlyWait(15, SECONDS); - multiMedia.closeButton(); - String url = driver.getCurrentUrl(); - Assert.assertTrue(url.contains("http://investors.oriflame.com")); - } - - @AfterClass - public static void closeChrome() { - driver.close(); + Assert.assertTrue(multiMedia.assertVideoPlay()); } }