Skip to content

Commit

Permalink
test(analytics): ui test for video learning events
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-elimu committed Nov 1, 2024
1 parent a7e63ad commit 6925184
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/test/java/selenium/analytics/MainAnalyticsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ public void pressStoryBookLearningEventsLink() {
WebElement link = driver.findElement(By.id("storyBookLearningEventsLink"));
link.click();
}

public void pressVideoLearningEventsLink() {
WebElement link = driver.findElement(By.id("videoLearningEventsLink"));
link.click();
}
}
19 changes: 19 additions & 0 deletions src/test/java/selenium/analytics/VideoLearningEventsPage.java
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 src/test/java/selenium/analytics/VideoLearningEventsPageTest.java
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);
}
}

0 comments on commit 6925184

Please sign in to comment.