-
-
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(selenium): word learning events (#1856)
- Loading branch information
Showing
24 changed files
with
242 additions
and
47 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
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
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
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
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 |
---|---|---|
|
@@ -5,34 +5,30 @@ | |
<content:section cssId="wordLearningEventsPage"> | ||
<div class="section row"> | ||
<div class="card-panel"> | ||
<script src="<spring:url value='/static/js/chart.bundle.min-2.8.0.js' />"></script> | ||
<link rel="stylesheet" href="<spring:url value='/static/css/chart.min-2.8.0.css' />" /> | ||
<canvas id="myChart" width="400" height="100"></canvas> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.min.js"></script> | ||
<canvas id="chart"></canvas> | ||
<script> | ||
const labels = [ | ||
'January', | ||
'February', | ||
'March', | ||
'April', | ||
'May', | ||
'June', | ||
<c:forEach var="month" items="${monthList}">'${month}',</c:forEach> | ||
]; | ||
const data = { | ||
labels: labels, | ||
datasets: [{ | ||
label: 'My First dataset', | ||
backgroundColor: 'rgba(149,117,205, 0.5)', | ||
borderColor: 'rgba(149,117,205, 0.5)', | ||
data: [0, 10, 5, 2, 20, 30, 45], | ||
data: <c:out value="${eventCountList}" />, | ||
label: 'Learning events', | ||
backgroundColor: 'rgba(149,117,205, 0.5)', // #9575cd deep-purple lighten-2 | ||
borderColor: 'rgba(149,117,205, 0.5)', // #9575cd deep-purple lighten-2 | ||
tension: 0.5, | ||
fill: true | ||
}] | ||
}; | ||
const config = { | ||
type: 'line', | ||
data: data, | ||
options: {} | ||
}; | ||
var ctx = document.getElementById('myChart'); | ||
var myRadarChart = new Chart(ctx, config); | ||
var ctx = document.getElementById('chart'); | ||
new Chart(ctx, config); | ||
</script> | ||
</div> | ||
</div> | ||
|
@@ -53,12 +49,12 @@ | |
|
||
<table class="bordered highlight"> | ||
<thead> | ||
<th><fmt:message key="time" /></th> | ||
<th>Android ID</th> | ||
<th><fmt:message key="application" /></th> | ||
<th><fmt:message key="word" /></th> | ||
<th><fmt:message key="word.text" /></th> | ||
<th><fmt:message key="learning.event.type" /></th> | ||
<th><code>timestamp</code></th> | ||
<th><code>android_id</code></th> | ||
<th><code>package_name</code></th> | ||
<th><code>word_id</code></th> | ||
<th><code>word_text</code></th> | ||
<th><code>learning_event_type</code></th> | ||
</thead> | ||
<tbody> | ||
<c:forEach var="wordLearningEvent" items="${wordLearningEvents}"> | ||
|
3 changes: 2 additions & 1 deletion
3
src/test/java/ai/elimu/rest/v2/content/EmojisRestControllerTest.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
3 changes: 2 additions & 1 deletion
3
src/test/java/ai/elimu/rest/v2/content/ImagesRestControllerTest.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
3 changes: 2 additions & 1 deletion
3
src/test/java/ai/elimu/rest/v2/content/LetterSoundsRestControllerTest.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
3 changes: 2 additions & 1 deletion
3
src/test/java/ai/elimu/rest/v2/content/LettersRestControllerTest.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
3 changes: 2 additions & 1 deletion
3
src/test/java/ai/elimu/rest/v2/content/SoundsRestControllerTest.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
3 changes: 2 additions & 1 deletion
3
src/test/java/ai/elimu/rest/v2/content/StoryBooksRestControllerTest.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
3 changes: 2 additions & 1 deletion
3
src/test/java/ai/elimu/rest/v2/content/WordsRestControllerTest.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
4 changes: 2 additions & 2 deletions
4
src/test/java/selenium/web/WelcomePage.java → src/test/java/selenium/WelcomePage.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
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
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,25 @@ | ||
package selenium.analytics; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
|
||
import selenium.util.ErrorHelper; | ||
|
||
public class MainAnalyticsPage { | ||
|
||
private WebDriver driver; | ||
|
||
public MainAnalyticsPage(WebDriver driver) { | ||
this.driver = driver; | ||
|
||
driver.findElement(By.id("mainAnalyticsPage")); | ||
|
||
ErrorHelper.verifyNoScriptOrMarkupError(driver); | ||
} | ||
|
||
public void pressWordLearningEventsLink() { | ||
WebElement link = driver.findElement(By.id("wordLearningEventsLink")); | ||
link.click(); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/test/java/selenium/analytics/MainAnalyticsPageTest.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,52 @@ | ||
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 MainAnalyticsPageTest { | ||
|
||
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-testing-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 testMainAnalyticsPage() { | ||
logger.info("testMainAnalyticsPage"); | ||
|
||
MainAnalyticsPage mainAnalyticsPage = new MainAnalyticsPage(driver); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/test/java/selenium/analytics/WordLearningEventsPage.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 WordLearningEventsPage { | ||
|
||
private WebDriver driver; | ||
|
||
public WordLearningEventsPage(WebDriver driver) { | ||
this.driver = driver; | ||
|
||
driver.findElement(By.id("wordLearningEventsPage")); | ||
|
||
ErrorHelper.verifyNoScriptOrMarkupError(driver); | ||
} | ||
} |
Oops, something went wrong.