Skip to content

Commit

Permalink
migrate StudentCourseJoinConfirmationPageE2ETest (#13008)
Browse files Browse the repository at this point in the history
Co-authored-by: Wei Qing <48304907+weiquu@users.noreply.github.com>
  • Loading branch information
cedricongjh and weiquu committed Apr 19, 2024
1 parent c665348 commit 1027334
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package teammates.e2e.cases.sql;

import org.testng.annotations.Test;

import teammates.common.util.AppUrl;
import teammates.common.util.Const;
import teammates.e2e.pageobjects.CourseJoinConfirmationPage;
import teammates.e2e.pageobjects.StudentHomePage;
import teammates.storage.sqlentity.Student;

/**
* SUT: {@link Const.WebPageURIs#JOIN_PAGE}.
*/
public class StudentCourseJoinConfirmationPageE2ETest extends BaseE2ETestCase {
private Student newStudent;
private String newStudentGoogleId;

@Override
protected void prepareTestData() {
testData = removeAndRestoreDataBundle(loadSqlDataBundle("/StudentCourseJoinConfirmationPageE2ETestSql.json"));

newStudent = testData.students.get("alice.tmms@SCJoinConf.CS2104");
newStudentGoogleId = testData.accounts.get("alice.tmms").getGoogleId();
}

@Test
@Override
public void testAll() {
______TS("Click join link: invalid key");
String courseId = testData.courses.get("SCJoinConf.CS2104").getId();
String invalidKey = "invalidKey";
AppUrl joinLink = createFrontendUrl(Const.WebPageURIs.JOIN_PAGE)
.withRegistrationKey(invalidKey)
.withCourseId(courseId)
.withEntityType(Const.EntityType.STUDENT);
CourseJoinConfirmationPage confirmationPage = loginToPage(
joinLink, CourseJoinConfirmationPage.class, newStudentGoogleId);

confirmationPage.verifyDisplayedMessage("The course join link is invalid. You may have "
+ "entered the URL incorrectly or the URL may correspond to a/an student that does not exist.");

______TS("Click join link: valid key");
joinLink = createFrontendUrl(Const.WebPageURIs.JOIN_PAGE)
.withRegistrationKey(newStudent.getRegKey())
.withCourseId(courseId)
.withEntityType(Const.EntityType.STUDENT);
confirmationPage = getNewPageInstance(joinLink, CourseJoinConfirmationPage.class);

confirmationPage.verifyJoiningUser(newStudentGoogleId);
confirmationPage.confirmJoinCourse(StudentHomePage.class);

______TS("Already joined, no confirmation page");

getNewPageInstance(joinLink, StudentHomePage.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"accounts": {
"SCJoinConf.instr": {
"googleId": "tm.e2e.SCJoinConf.instr",
"name": "Teammates Test",
"email": "SCJoinConf.instr@gmail.tmt",
"id": "00000000-0000-4000-8000-000000000001"
},
"alice.tmms": {
"googleId": "tm.e2e.SCJoinConf.alice",
"name": "Alice B",
"email": "SCJoinConf.alice@gmail.tmt",
"id": "00000000-0000-4000-8000-000000000002"
}
},
"accountRequests": {},
"courses": {
"SCJoinConf.CS2104": {
"id": "tm.e2e.SCJoinConf.CS2104",
"name": "Programming Language Concepts",
"timeZone": "UTC",
"institute": "TEAMMATES Test Institute 1"
},
"SCJoinConf.CS1101": {
"id": "tm.e2e.SCJoinConf.CS1101",
"name": "Programming Methodology",
"timeZone": "UTC",
"institute": "TEAMMATES Test Institute 1"
}
},
"sections": {
"tm.e2e.SCJoinConf.CS2104-None": {
"id": "00000000-0000-4000-8000-000000000201",
"course": {
"id": "tm.e2e.SCJoinConf.CS2104"
},
"name": "None"
},
"tm.e2e.SCJoinConf.CS1101-None": {
"id": "00000000-0000-4000-8000-000000000202",
"course": {
"id": "tm.e2e.SCJoinConf.CS1101"
},
"name": "None"
}
},
"teams": {
"tm.e2e.SCJoinConf.CS2104-None-Team1": {
"id": "00000000-0000-4000-8000-000000000301",
"section": {
"id": "00000000-0000-4000-8000-000000000201"
},
"name": "Team 1"
},
"tm.e2e.SCJoinConf.CS1101-None-Team1": {
"id": "00000000-0000-4000-8000-000000000302",
"section": {
"id": "00000000-0000-4000-8000-000000000202"
},
"name": "Team 1"
}
},
"deadlineExtensions": {},
"instructors": {
"SCJoinConf.instr.CS2104": {
"isDisplayedToStudents": true,
"displayName": "Co-owner",
"role": "INSTRUCTOR_PERMISSION_ROLE_COOWNER",
"privileges": {
"courseLevel": {
"canModifyCourse": true,
"canModifyInstructor": true,
"canModifySession": true,
"canModifyStudent": true,
"canViewStudentInSections": true,
"canViewSessionInSections": true,
"canSubmitSessionInSections": true,
"canModifySessionCommentsInSections": true
},
"sectionLevel": {},
"sessionLevel": {}
},
"id": "00000000-0000-4000-8000-000000000501",
"course": {
"id": "tm.e2e.SCJoinConf.CS2104"
},
"account": {
"id": "00000000-0000-4000-8000-000000000001"
},
"name": "Teammates Test",
"email": "SCJoinConf.instr@gmail.tmt"
},
"SCJoinConf.instr.CS1101": {
"isDisplayedToStudents": true,
"displayName": "Co-owner",
"role": "INSTRUCTOR_PERMISSION_ROLE_COOWNER",
"privileges": {
"courseLevel": {
"canModifyCourse": true,
"canModifyInstructor": true,
"canModifySession": true,
"canModifyStudent": true,
"canViewStudentInSections": true,
"canViewSessionInSections": true,
"canSubmitSessionInSections": true,
"canModifySessionCommentsInSections": true
},
"sectionLevel": {},
"sessionLevel": {}
},
"courseId": "tm.e2e.SCJoinConf.CS1101",
"course": {
"id": "tm.e2e.SCJoinConf.CS1101"
},
"account": {
"id": "00000000-0000-4000-8000-000000000001"
},
"name": "Teammates Test",
"email": "SCJoinConf.instr@gmail.tmt"
}
},
"students": {
"alice.tmms@SCJoinConf.CS2104": {
"comments": "This student's name is Amy Betsy",
"id": "00000000-0000-4000-8000-000000000601",
"courseId": "tm.e2e.SCJoinConf.CS2104",
"course": {
"id": "tm.e2e.SCJoinConf.CS2104"
},
"team": {
"id": "00000000-0000-4000-8000-000000000301"
},
"name": "Amy Betsy",
"email": "SCJoinConf.alice@gmail.tmt"
},
"alice.tmms@SCJoinConf.CS1101": {
"comments": "This student's name is Amy Betsy",
"id": "00000000-0000-4000-8000-000000000602",
"courseId": "tm.e2e.SCJoinConf.CS1101",
"course": {
"id": "tm.e2e.SCJoinConf.CS1101"
},
"account": {
"id": "00000000-0000-4000-8000-000000000002"
},
"team": {
"id": "00000000-0000-4000-8000-000000000301"
},
"name": "Amy Betsy",
"email": "SCJoinConf.alice@gmail.tmt"
}
},
"feedbackSessions": {},
"feedbackQuestions": {},
"feedbackResponses": {},
"feedbackResponseComments": {},
"notifications": {},
"readNotifications": {}
}
1 change: 1 addition & 0 deletions src/e2e/resources/testng-e2e-sql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<class name="teammates.e2e.cases.sql.InstructorCourseDetailsPageE2ETest" />
<class name="teammates.e2e.cases.sql.InstructorStudentListPageE2ETest" />
<class name="teammates.e2e.cases.sql.StudentHomePageE2ETest" />
<class name="teammates.e2e.cases.sql.StudentCourseJoinConfirmationPageE2ETest" />
<class name="teammates.e2e.cases.sql.AdminSearchPageE2ETest" />
<class name="teammates.e2e.cases.sql.AdminHomePageE2ETest" />
<class name="teammates.e2e.cases.sql.FeedbackRankOptionQuestionE2ETest" />
Expand Down

0 comments on commit 1027334

Please sign in to comment.