Skip to content

Commit

Permalink
Merge branch 'master' into v9/e2e-2
Browse files Browse the repository at this point in the history
  • Loading branch information
weiquu authored Feb 25, 2024
2 parents b80d93f + e49baf0 commit 79c2e49
Show file tree
Hide file tree
Showing 73 changed files with 893 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import org.testng.annotations.Test;

import teammates.common.datatransfer.attributes.AccountAttributes;
import teammates.common.datatransfer.attributes.InstructorAttributes;
import teammates.common.datatransfer.attributes.StudentAttributes;
import teammates.common.util.AppUrl;
import teammates.common.util.Const;
import teammates.e2e.pageobjects.AdminAccountsPage;
import teammates.ui.output.AccountData;

/**
* SUT: {@link Const.WebPageURIs#ADMIN_ACCOUNTS_PAGE}.
Expand All @@ -18,6 +18,8 @@ public class AdminAccountsPageE2ETest extends BaseE2ETestCase {
protected void prepareTestData() {
testData = loadDataBundle("/AdminAccountsPageE2ETest.json");
removeAndRestoreDataBundle(testData);
sqlTestData = removeAndRestoreSqlDataBundle(
loadSqlDataBundle("/AdminAccountsPageE2ETest_SqlEntities.json"));
}

@Test
Expand All @@ -32,7 +34,7 @@ public void testAll() {
.withParam(Const.ParamsNames.INSTRUCTOR_ID, googleId);
AdminAccountsPage accountsPage = loginAdminToPage(accountsPageUrl, AdminAccountsPage.class);

AccountAttributes account = getAccount(googleId);
AccountData account = BACKDOOR.getAccountData(googleId);
accountsPage.verifyAccountDetails(account);

______TS("action: remove instructor from course");
Expand Down Expand Up @@ -65,7 +67,7 @@ public void testAll() {
accountsPage.clickDeleteAccount();
accountsPage.verifyStatusMessage("Account \"" + googleId + "\" is successfully deleted.");

verifyAbsentInDatabase(account);
assertNull(BACKDOOR.getAccountData(googleId));

// student entities should be deleted
verifyAbsentInDatabase(student2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ protected void prepareTestData() {
testData = loadDataBundle("/FeedbackConstSumOptionQuestionE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(
loadSqlDataBundle("/FeedbackConstSumOptionQuestionE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("instructor");
course = testData.courses.get("course");
feedbackSession = testData.feedbackSessions.get("openSession");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ protected void prepareTestData() {
testData = loadDataBundle("/FeedbackConstSumRecipientQuestionE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(
loadSqlDataBundle("/FeedbackConstSumRecipientQuestionE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("instructor");
course = testData.courses.get("course");
feedbackSession = testData.feedbackSessions.get("openSession");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ protected void prepareTestData() {
testData = loadDataBundle("/FeedbackContributionQuestionE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(
loadSqlDataBundle("/FeedbackContributionQuestionE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("instructor");
course = testData.courses.get("course");
feedbackSession = testData.feedbackSessions.get("openSession");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ protected void prepareTestData() {
testData = loadDataBundle("/FeedbackMcqQuestionE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(loadSqlDataBundle("/FeedbackMcqQuestionE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("instructor");
course = testData.courses.get("course");
feedbackSession = testData.feedbackSessions.get("openSession");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ protected void prepareTestData() {
testData = loadDataBundle("/FeedbackMsqQuestionE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(loadSqlDataBundle("/FeedbackMsqQuestionE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("instructor");
course = testData.courses.get("course");
feedbackSession = testData.feedbackSessions.get("openSession");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ protected void prepareTestData() {
testData = loadDataBundle("/FeedbackNumScaleQuestionE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(loadSqlDataBundle("/FeedbackNumScaleQuestionE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("instructor");
course = testData.courses.get("course");
feedbackSession = testData.feedbackSessions.get("openSession");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ protected void prepareTestData() {
testData = loadDataBundle("/FeedbackRankOptionQuestionE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(
loadSqlDataBundle("/FeedbackRankOptionQuestionE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("instructor");
course = testData.courses.get("course");
feedbackSession = testData.feedbackSessions.get("openSession");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ protected void prepareTestData() {
testData = loadDataBundle("/FeedbackRankRecipientQuestionE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(
loadSqlDataBundle("/FeedbackRankRecipientQuestionE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("instructor");
course = testData.courses.get("course");
feedbackSession = testData.feedbackSessions.get("openSession");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ protected void prepareTestData() {
testData = loadDataBundle("/FeedbackResultsPageE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(loadSqlDataBundle("/FeedbackResultsPageE2ETest_SqlEntities.json"));

course = testData.courses.get("FRes.CS2104");
openSession = testData.feedbackSessions.get("Open Session");
for (int i = 1; i <= testData.feedbackQuestions.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ protected void prepareTestData() {
testData = loadDataBundle("/FeedbackRubricQuestionE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(loadSqlDataBundle("/FeedbackRubricQuestionE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("instructor");
course = testData.courses.get("course");
feedbackSession = testData.feedbackSessions.get("openSession");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ protected void prepareTestData() {
student.setEmail(TestProperties.TEST_EMAIL);
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(loadSqlDataBundle("/FeedbackSubmitPageE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("FSubmit.instr");
course = testData.courses.get("FSubmit.CS2104");
openSession = testData.feedbackSessions.get("Open Session");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ protected void prepareTestData() {
testData = loadDataBundle("/FeedbackTextQuestionE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(loadSqlDataBundle("/FeedbackTextQuestionE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("instructor");
course = testData.courses.get("course");
feedbackSession = testData.feedbackSessions.get("openSession");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ protected void prepareTestData() {
testData = loadDataBundle("/InstructorCourseEditPageE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(loadSqlDataBundle("/InstructorCourseEditPageE2ETest_SqlEntities.json"));

course = testData.courses.get("ICEdit.CS2104");
instructors[0] = testData.instructors.get("ICEdit.helper.CS2104");
instructors[1] = testData.instructors.get("ICEdit.manager.CS2104");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ protected void prepareTestData() {
testData = loadDataBundle("/InstructorFeedbackEditPageE2ETest.json");
removeAndRestoreDataBundle(testData);

sqlTestData = removeAndRestoreSqlDataBundle(
loadSqlDataBundle("/InstructorFeedbackEditPageE2ETest_SqlEntities.json"));

instructor = testData.instructors.get("instructor");
feedbackSession = testData.feedbackSessions.get("openSession");
course = testData.courses.get("course");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.testng.annotations.Test;

import teammates.common.datatransfer.SqlDataBundle;
import teammates.common.datatransfer.attributes.InstructorAttributes;
import teammates.common.datatransfer.attributes.StudentAttributes;
import teammates.common.util.AppUrl;
Expand All @@ -17,6 +18,9 @@ public class InstructorStudentRecordsPageE2ETest extends BaseE2ETestCase {
protected void prepareTestData() {
testData = loadDataBundle("/InstructorStudentRecordsPageE2ETest.json");
removeAndRestoreDataBundle(testData);

SqlDataBundle sqlTestData = loadSqlDataBundle("/InstructorStudentRecordsPageE2ETest_SqlEntities.json");
removeAndRestoreSqlDataBundle(sqlTestData);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.testng.annotations.Test;

import teammates.common.datatransfer.SqlDataBundle;
import teammates.common.datatransfer.attributes.InstructorAttributes;
import teammates.common.datatransfer.attributes.StudentAttributes;
import teammates.common.util.AppUrl;
Expand All @@ -17,6 +18,9 @@ public class StudentCourseDetailsPageE2ETest extends BaseE2ETestCase {
protected void prepareTestData() {
testData = loadDataBundle("/StudentCourseDetailsPageE2ETest.json");
removeAndRestoreDataBundle(testData);

SqlDataBundle sqlTestData = loadSqlDataBundle("/StudentCourseDetailsPageE2ETest_SqlEntities.json");
removeAndRestoreSqlDataBundle(sqlTestData);
}

@Test
Expand Down
2 changes: 2 additions & 0 deletions src/e2e/java/teammates/e2e/cases/StudentHomePageE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class StudentHomePageE2ETest extends BaseE2ETestCase {
protected void prepareTestData() {
testData = loadDataBundle("/StudentHomePageE2ETest.json");
removeAndRestoreDataBundle(testData);
sqlTestData =
removeAndRestoreSqlDataBundle(loadSqlDataBundle("/StudentHomePageE2ETest_SqlEntities.json"));
}

@Test
Expand Down
7 changes: 7 additions & 0 deletions src/e2e/java/teammates/e2e/pageobjects/AdminAccountsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.openqa.selenium.support.FindBy;

import teammates.common.datatransfer.attributes.AccountAttributes;
import teammates.ui.output.AccountData;

/**
* Page Object Model for the admin accounts page.
Expand Down Expand Up @@ -49,6 +50,12 @@ public void verifyAccountDetails(AccountAttributes account) {
assertEquals(account.getEmail(), accountEmail.getText());
}

public void verifyAccountDetails(AccountData account) {
assertEquals(account.getGoogleId(), accountId.getText());
assertEquals(account.getName(), accountName.getText());
assertEquals(account.getEmail(), accountEmail.getText());
}

public void clickRemoveInstructorFromCourse(String courseId) {
List<WebElement> instructorRows =
instructorTable.findElement(By.tagName("tbody")).findElements(By.tagName("tr"));
Expand Down
3 changes: 2 additions & 1 deletion src/e2e/java/teammates/e2e/pageobjects/AppPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import org.openqa.selenium.By;
Expand Down Expand Up @@ -739,7 +740,7 @@ String getDisplayRecipientName(FeedbackParticipantType type) {
String getDisplayedDateTime(Instant instant, String timeZone, String pattern) {
ZonedDateTime zonedDateTime = TimeHelper.getMidnightAdjustedInstantBasedOnZone(instant, timeZone, false)
.atZone(ZoneId.of(timeZone));
return DateTimeFormatter.ofPattern(pattern).format(zonedDateTime);
return DateTimeFormatter.ofPattern(pattern, Locale.ENGLISH).format(zonedDateTime);
}

private String getFullDateString(Instant instant, String timeZone) {
Expand Down
16 changes: 16 additions & 0 deletions src/e2e/resources/data/AdminAccountsPageE2ETest_SqlEntities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"accounts": {
"AAccounts.instr2": {
"id": "00000000-0000-4000-8000-000000000001",
"googleId": "tm.e2e.AAccounts.instr2",
"name": "Teammates Instr2",
"email": "[email protected]"
},
"AAccounts.instr3": {
"id": "00000000-0000-4000-8000-000000000002",
"googleId": "tm.e2e.AAccounts.instr3",
"name": "Teammates Instr3",
"email": "[email protected]"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"accounts": {
"instructorWithSessions": {
"googleId": "tm.e2e.FCSumOptQn.instructor",
"name": "Teammates Test",
"email": "[email protected]",
"readNotifications": {}
}
},
"courses": {
"course": {
"id": "tm.e2e.FCSumOptQn.CS2104",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"accounts": {
"instructorWithSessions": {
"id": "00000000-0000-4000-8000-000000000001",
"googleId": "tm.e2e.FCSumOptQn.instructor",
"name": "Teammates Test",
"email": "[email protected]"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"accounts": {
"instructorWithSessions": {
"googleId": "tm.e2e.FCSumRcptQn.instructor",
"name": "Teammates Test",
"email": "[email protected]",
"readNotifications": {}
}
},
"courses": {
"course": {
"id": "tm.e2e.FCSumRcptQn.CS2104",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"accounts": {
"instructorWithSessions": {
"id": "00000000-0000-4000-8000-000000000001",
"googleId": "tm.e2e.FCSumRcptQn.instructor",
"name": "Teammates Test",
"email": "[email protected]"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"accounts": {
"instructorWithSessions": {
"googleId": "tm.e2e.FContrQn.instructor",
"name": "Teammates Test",
"email": "[email protected]",
"readNotifications": {}
}
},
"courses": {
"course": {
"id": "tm.e2e.FContrQn.CS2104",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"accounts": {
"instructorWithSessions": {
"id": "00000000-0000-4000-8000-000000000001",
"googleId": "tm.e2e.FContrQn.instructor",
"name": "Teammates Test",
"email": "[email protected]"
}
}
}
8 changes: 0 additions & 8 deletions src/e2e/resources/data/FeedbackMcqQuestionE2ETest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"accounts": {
"instructorWithSessions": {
"googleId": "tm.e2e.FMcqQn.instructor",
"name": "Teammates Test",
"email": "[email protected]",
"readNotifications": {}
}
},
"courses": {
"course": {
"id": "tm.e2e.FMcqQn.CS2104",
Expand Down
10 changes: 10 additions & 0 deletions src/e2e/resources/data/FeedbackMcqQuestionE2ETest_SqlEntities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"accounts": {
"instructorWithSessions": {
"id": "00000000-0000-4000-8000-000000000001",
"googleId": "tm.e2e.FMcqQn.instructor",
"name": "Teammates Test",
"email": "[email protected]"
}
}
}
8 changes: 0 additions & 8 deletions src/e2e/resources/data/FeedbackMsqQuestionE2ETest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"accounts": {
"instructorWithSessions": {
"googleId": "tm.e2e.FMsqQn.instructor",
"name": "Teammates Test",
"email": "[email protected]",
"readNotifications": {}
}
},
"courses": {
"course": {
"id": "tm.e2e.FMsqQn.CS2104",
Expand Down
10 changes: 10 additions & 0 deletions src/e2e/resources/data/FeedbackMsqQuestionE2ETest_SqlEntities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"accounts": {
"instructorWithSessions": {
"id": "00000000-0000-4000-8000-000000000001",
"googleId": "tm.e2e.FMsqQn.instructor",
"name": "Teammates Test",
"email": "[email protected]"
}
}
}
Loading

0 comments on commit 79c2e49

Please sign in to comment.