|
| 1 | +package selenium.content.video; |
| 2 | + |
| 3 | +import org.junit.jupiter.api.AfterEach; |
| 4 | +import org.junit.jupiter.api.BeforeEach; |
| 5 | +import org.junit.jupiter.api.Test; |
| 6 | +import org.openqa.selenium.WebDriver; |
| 7 | +import org.openqa.selenium.chrome.ChromeDriver; |
| 8 | +import org.openqa.selenium.chrome.ChromeOptions; |
| 9 | + |
| 10 | +import lombok.extern.slf4j.Slf4j; |
| 11 | +import selenium.content.MainContentPage; |
| 12 | +import selenium.util.DomainHelper; |
| 13 | + |
| 14 | +@Slf4j |
| 15 | +public class VideoTest { |
| 16 | + |
| 17 | + private WebDriver driver; |
| 18 | + |
| 19 | + @BeforeEach |
| 20 | + public void setUp() { |
| 21 | + log.info("setUp"); |
| 22 | + |
| 23 | + ChromeOptions chromeOptions = new ChromeOptions(); |
| 24 | + |
| 25 | + // Read "headless" property set on the command line: |
| 26 | + // mvn clean verify -P regression-test-ui -D headless=true |
| 27 | + String headlessSystemProperty = System.getProperty("headless"); |
| 28 | + log.info("headlessSystemProperty: \"" + headlessSystemProperty + "\""); |
| 29 | + if ("true".equals(headlessSystemProperty)) { |
| 30 | + chromeOptions.addArguments("headless"); |
| 31 | + } |
| 32 | + |
| 33 | + driver = new ChromeDriver(chromeOptions); |
| 34 | + |
| 35 | + driver.get(DomainHelper.getBaseUrl() + "/content"); |
| 36 | + } |
| 37 | + |
| 38 | + @AfterEach |
| 39 | + public void tearDown() { |
| 40 | + log.info("tearDown"); |
| 41 | + |
| 42 | + driver.quit(); |
| 43 | + } |
| 44 | + |
| 45 | + @Test |
| 46 | + public void testRandomVideoEditPage() { |
| 47 | + log.info("testRandomVideoEditPage"); |
| 48 | + |
| 49 | + MainContentPage mainContentPage = new MainContentPage(driver); |
| 50 | + mainContentPage.pressVideoListLink(); |
| 51 | + |
| 52 | + VideoListPage videoListPage = new VideoListPage(driver); |
| 53 | + videoListPage.pressRandomVideo(); |
| 54 | + log.info("driver.getCurrentUrl(): " + driver.getCurrentUrl()); |
| 55 | + |
| 56 | + VideoEditPage videoEditPage = new VideoEditPage(driver); |
| 57 | + } |
| 58 | + |
| 59 | + @Test |
| 60 | + public void testVideoCreatePage() { |
| 61 | + log.info("testVideoCreatePage"); |
| 62 | + |
| 63 | + MainContentPage mainContentPage = new MainContentPage(driver); |
| 64 | + mainContentPage.pressVideoListLink(); |
| 65 | + |
| 66 | + VideoListPage videoListPage = new VideoListPage(driver); |
| 67 | + videoListPage.pressCreateButton(); |
| 68 | + |
| 69 | + VideoCreatePage videoCreatePage = new VideoCreatePage(driver); |
| 70 | + } |
| 71 | +} |
0 commit comments