-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(analytics): ui test for video learning events
- Loading branch information
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/test/java/selenium/analytics/VideoLearningEventsPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package selenium.analytics; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
|
||
import selenium.util.ErrorHelper; | ||
|
||
public class VideoLearningEventsPage { | ||
|
||
private WebDriver driver; | ||
|
||
public VideoLearningEventsPage(WebDriver driver) { | ||
this.driver = driver; | ||
|
||
driver.findElement(By.id("videoLearningEventsPage")); | ||
|
||
ErrorHelper.verifyNoScriptOrMarkupError(driver); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/test/java/selenium/analytics/VideoLearningEventsPageTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package selenium.analytics; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.chrome.ChromeDriver; | ||
import org.openqa.selenium.chrome.ChromeOptions; | ||
|
||
import selenium.util.DomainHelper; | ||
|
||
public class VideoLearningEventsPageTest { | ||
|
||
private final Logger logger = LogManager.getLogger(); | ||
|
||
private WebDriver driver; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
logger.info("setUp"); | ||
|
||
ChromeOptions chromeOptions = new ChromeOptions(); | ||
|
||
// Read "headless" property set on the command line: | ||
// mvn clean verify -P regression-test-ui -D headless=true | ||
String headlessSystemProperty = System.getProperty("headless"); | ||
logger.info("headlessSystemProperty: \"" + headlessSystemProperty + "\""); | ||
if ("true".equals(headlessSystemProperty)) { | ||
chromeOptions.addArguments("headless"); | ||
} | ||
|
||
driver = new ChromeDriver(chromeOptions); | ||
|
||
driver.get(DomainHelper.getBaseUrl() + "/analytics"); | ||
} | ||
|
||
@AfterEach | ||
public void tearDown() { | ||
logger.info("tearDown"); | ||
|
||
driver.quit(); | ||
} | ||
|
||
@Test | ||
public void testVideoLearningEventsPage() { | ||
logger.info("testVideoLearningEventsPage"); | ||
|
||
MainAnalyticsPage mainAnalyticsPage = new MainAnalyticsPage(driver); | ||
mainAnalyticsPage.pressVideoLearningEventsLink(); | ||
|
||
VideoLearningEventsPage videoLearningEventsPage = new VideoLearningEventsPage(driver); | ||
} | ||
} |