Skip to content

Commit 5d87c97

Browse files
committed
test: regression tests for csv exports
#2280
1 parent 42f8fbf commit 5d87c97

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

src/test/java/selenium/analytics/students/StudentPage.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,28 @@ public String getLetterSoundLearningEventsUrl() {
2626
return exportToCsvButton.getAttribute("href");
2727
}
2828

29+
public String getWordAssessmentEventsUrl() {
30+
WebElement exportToCsvButton = driver.findElement(By.id("exportWordAssessmentEventsToCsvButton"));
31+
return exportToCsvButton.getAttribute("href");
32+
}
33+
2934
public String getWordLearningEventsUrl() {
3035
WebElement exportToCsvButton = driver.findElement(By.id("exportWordLearningEventsToCsvButton"));
3136
return exportToCsvButton.getAttribute("href");
3237
}
38+
39+
public String getNumberLearningEventsUrl() {
40+
WebElement exportToCsvButton = driver.findElement(By.id("exportNumberLearningEventsToCsvButton"));
41+
return exportToCsvButton.getAttribute("href");
42+
}
43+
44+
public String getStoryBookLearningEventsUrl() {
45+
WebElement exportToCsvButton = driver.findElement(By.id("exportStoryBookLearningEventsToCsvButton"));
46+
return exportToCsvButton.getAttribute("href");
47+
}
48+
49+
public String getVideoLearningEventsUrl() {
50+
WebElement exportToCsvButton = driver.findElement(By.id("exportVideoLearningEventsToCsvButton"));
51+
return exportToCsvButton.getAttribute("href");
52+
}
3353
}

src/test/java/selenium/analytics/students/csv/StudentCsvExportTest.java

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ public void testExportCsv_LetterSoundLearningEvents() {
8484
assertTrue(getResponse.isSuccess());
8585
}
8686

87+
@Test
88+
public void testExportCsv_WordAssessmentEvents() {
89+
log.info("testExportCsv_WordAssessmentEvents");
90+
91+
StudentListPage studentListPage = new StudentListPage(driver);
92+
studentListPage.pressRandomStudent();
93+
log.info("driver.getCurrentUrl(): " + driver.getCurrentUrl());
94+
95+
StudentPage studentPage = new StudentPage(driver);
96+
97+
String fileUrl = studentPage.getWordAssessmentEventsUrl();
98+
log.info("fileUrl: " + fileUrl);
99+
HttpResponse<String> getResponse = Unirest.get(fileUrl).asString();
100+
log.info("getResponse.getStatus(): " + getResponse.getStatus());
101+
log.info("getResponse.isSuccess(): " + getResponse.isSuccess());
102+
assertTrue(getResponse.isSuccess());
103+
}
104+
87105
@Test
88106
public void testExportCsv_WordLearningEvents() {
89107
log.info("testExportCsv_WordLearningEvents");
@@ -101,4 +119,58 @@ public void testExportCsv_WordLearningEvents() {
101119
log.info("getResponse.isSuccess(): " + getResponse.isSuccess());
102120
assertTrue(getResponse.isSuccess());
103121
}
122+
123+
@Test
124+
public void testExportCsv_NumberLearningEvents() {
125+
log.info("testExportCsv_NumberLearningEvents");
126+
127+
StudentListPage studentListPage = new StudentListPage(driver);
128+
studentListPage.pressRandomStudent();
129+
log.info("driver.getCurrentUrl(): " + driver.getCurrentUrl());
130+
131+
StudentPage studentPage = new StudentPage(driver);
132+
133+
String fileUrl = studentPage.getNumberLearningEventsUrl();
134+
log.info("fileUrl: " + fileUrl);
135+
HttpResponse<String> getResponse = Unirest.get(fileUrl).asString();
136+
log.info("getResponse.getStatus(): " + getResponse.getStatus());
137+
log.info("getResponse.isSuccess(): " + getResponse.isSuccess());
138+
assertTrue(getResponse.isSuccess());
139+
}
140+
141+
@Test
142+
public void testExportCsv_StoryBookLearningEvents() {
143+
log.info("testExportCsv_StoryBookLearningEvents");
144+
145+
StudentListPage studentListPage = new StudentListPage(driver);
146+
studentListPage.pressRandomStudent();
147+
log.info("driver.getCurrentUrl(): " + driver.getCurrentUrl());
148+
149+
StudentPage studentPage = new StudentPage(driver);
150+
151+
String fileUrl = studentPage.getStoryBookLearningEventsUrl();
152+
log.info("fileUrl: " + fileUrl);
153+
HttpResponse<String> getResponse = Unirest.get(fileUrl).asString();
154+
log.info("getResponse.getStatus(): " + getResponse.getStatus());
155+
log.info("getResponse.isSuccess(): " + getResponse.isSuccess());
156+
assertTrue(getResponse.isSuccess());
157+
}
158+
159+
@Test
160+
public void testExportCsv_VideoLearningEvents() {
161+
log.info("testExportCsv_VideoLearningEvents");
162+
163+
StudentListPage studentListPage = new StudentListPage(driver);
164+
studentListPage.pressRandomStudent();
165+
log.info("driver.getCurrentUrl(): " + driver.getCurrentUrl());
166+
167+
StudentPage studentPage = new StudentPage(driver);
168+
169+
String fileUrl = studentPage.getVideoLearningEventsUrl();
170+
log.info("fileUrl: " + fileUrl);
171+
HttpResponse<String> getResponse = Unirest.get(fileUrl).asString();
172+
log.info("getResponse.getStatus(): " + getResponse.getStatus());
173+
log.info("getResponse.isSuccess(): " + getResponse.isSuccess());
174+
assertTrue(getResponse.isSuccess());
175+
}
104176
}

0 commit comments

Comments
 (0)