-
-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathStudentCsvExportTest.java
More file actions
104 lines (80 loc) · 3.77 KB
/
StudentCsvExportTest.java
File metadata and controls
104 lines (80 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package selenium.analytics.students.csv;
import static org.junit.jupiter.api.Assertions.assertTrue;
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 kong.unirest.core.HttpResponse;
import kong.unirest.core.Unirest;
import lombok.extern.slf4j.Slf4j;
import selenium.analytics.students.StudentListPage;
import selenium.analytics.students.StudentPage;
import selenium.util.DomainHelper;
@Slf4j
public class StudentCsvExportTest {
private WebDriver driver;
@BeforeEach
public void setUp() {
log.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");
log.info("headlessSystemProperty: \"" + headlessSystemProperty + "\"");
if ("true".equals(headlessSystemProperty)) {
chromeOptions.addArguments("headless");
}
driver = new ChromeDriver(chromeOptions);
driver.get(DomainHelper.getBaseUrl() + "/analytics/students");
log.info("driver.getCurrentUrl(): " + driver.getCurrentUrl());
}
@AfterEach
public void tearDown() {
log.info("tearDown");
driver.quit();
}
@Test
public void testExportCsv_LetterSoundAssessmentEvents() {
log.info("testExportCsv_LetterSoundAssessmentEvents");
StudentListPage studentListPage = new StudentListPage(driver);
studentListPage.pressRandomStudent();
log.info("driver.getCurrentUrl(): " + driver.getCurrentUrl());
StudentPage studentPage = new StudentPage(driver);
String fileUrl = studentPage.getLetterSoundAssessmentEventsUrl();
log.info("fileUrl: " + fileUrl);
HttpResponse<String> getResponse = Unirest.get(fileUrl).asString();
log.info("getResponse.getStatus(): " + getResponse.getStatus());
log.info("getResponse.isSuccess(): " + getResponse.isSuccess());
assertTrue(getResponse.isSuccess());
}
@Test
public void testExportCsv_LetterSoundLearningEvents() {
log.info("testExportCsv_LetterSoundLearningEvents");
StudentListPage studentListPage = new StudentListPage(driver);
studentListPage.pressRandomStudent();
log.info("driver.getCurrentUrl(): " + driver.getCurrentUrl());
StudentPage studentPage = new StudentPage(driver);
String fileUrl = studentPage.getLetterSoundLearningEventsUrl();
log.info("fileUrl: " + fileUrl);
HttpResponse<String> getResponse = Unirest.get(fileUrl).asString();
log.info("getResponse.getStatus(): " + getResponse.getStatus());
log.info("getResponse.isSuccess(): " + getResponse.isSuccess());
assertTrue(getResponse.isSuccess());
}
@Test
public void testExportCsv_WordLearningEvents() {
log.info("testExportCsv_WordLearningEvents");
StudentListPage studentListPage = new StudentListPage(driver);
studentListPage.pressRandomStudent();
log.info("driver.getCurrentUrl(): " + driver.getCurrentUrl());
StudentPage studentPage = new StudentPage(driver);
String fileUrl = studentPage.getWordLearningEventsUrl();
log.info("fileUrl: " + fileUrl);
HttpResponse<String> getResponse = Unirest.get(fileUrl).asString();
log.info("getResponse.getStatus(): " + getResponse.getStatus());
log.info("getResponse.isSuccess(): " + getResponse.isSuccess());
assertTrue(getResponse.isSuccess());
}
}