Skip to content

Commit

Permalink
[#12048] Migrate InstructorStudentRecordsPageE2ETest (#13013)
Browse files Browse the repository at this point in the history
* migrate InstructorStudentRecordsPageE2ETest

* Add InstructorStudentRecordsPageE2ETest to sql xml

---------

Co-authored-by: Wei Qing <[email protected]>
  • Loading branch information
cedricongjh and weiquu committed Apr 18, 2024
1 parent 8ec6989 commit 63b3209
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package teammates.e2e.cases.sql;

import org.testng.annotations.Test;

import teammates.common.util.AppUrl;
import teammates.common.util.Const;
import teammates.e2e.pageobjects.InstructorStudentRecordsPage;
import teammates.storage.sqlentity.Instructor;
import teammates.storage.sqlentity.Student;

/**
* SUT: {@link Const.WebPageURIs#INSTRUCTOR_STUDENT_RECORDS_PAGE}.
*/
public class InstructorStudentRecordsPageE2ETest extends BaseE2ETestCase {

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

@Test
@Override
public void testAll() {

______TS("verify loaded data: student details");

Instructor instructor = testData.instructors.get("teammates.test.CS2104");
Student student = testData.students.get("[email protected]");

String instructorId = instructor.getGoogleId();
String courseId = instructor.getCourseId();
String studentEmail = student.getEmail();

AppUrl recordsPageUrl = createFrontendUrl(Const.WebPageURIs.INSTRUCTOR_STUDENT_RECORDS_PAGE)
.withCourseId(courseId)
.withStudentEmail(studentEmail);

InstructorStudentRecordsPage recordsPage =
loginToPage(recordsPageUrl, InstructorStudentRecordsPage.class, instructorId);

recordsPage.verifyStudentDetails(student);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.openqa.selenium.support.FindBy;

import teammates.common.datatransfer.attributes.StudentAttributes;
import teammates.storage.sqlentity.Student;

/**
* Page Object Model for instructor student records page.
Expand Down Expand Up @@ -33,4 +34,8 @@ public void verifyStudentDetails(StudentAttributes student) {
verifyIsCorrectPage(student.getCourse(), student.getName());
}

public void verifyStudentDetails(Student student) {
verifyIsCorrectPage(student.getCourse().getId(), student.getName());
}

}
99 changes: 99 additions & 0 deletions src/e2e/resources/data/InstructorStudentRecordsPageE2ETestSql.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"accounts": {
"teammates.test": {
"googleId": "tm.e2e.ISRecords.teammates.test",
"name": "Teammates Test",
"email": "[email protected]",
"id": "00000000-0000-4000-8000-000000000001"
},
"[email protected]": {
"googleId": "tm.e2e.ISRecords.benny.c.tmms",
"name": "Benny Charlés",
"email": "[email protected]",
"id": "00000000-0000-4000-8000-000000000002"
}
},
"accountRequests": {},
"courses": {
"CS2104": {
"id": "tm.e2e.ISRecords.CS2104",
"name": "Programming Language Concepts",
"timeZone": "UTC",
"institute": "TEAMMATES Test Institute 1"
}
},
"sections": {
"tm.e2e.ISRecords.CS2104-None": {
"id": "00000000-0000-4000-8000-000000000201",
"course": {
"id": "tm.e2e.ISRecords.CS2104"
},
"name": "None"
}
},
"teams": {
"tm.e2e.ISRecords.CS2104-None-Team1": {
"id": "00000000-0000-4000-8000-000000000301",
"section": {
"id": "00000000-0000-4000-8000-000000000201"
},
"name": "Team 1"
}
},
"deadlineExtensions": {},
"instructors": {
"teammates.test.CS2104": {
"isDisplayedToStudents": true,
"displayName": "Instructor",
"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",
"courseId": "tm.e2e.ISRecords.CS2104",
"course": {
"id": "tm.e2e.ISRecords.CS2104"
},
"account": {
"id": "00000000-0000-4000-8000-000000000001"
},
"name": "Teammates Test",
"email": "[email protected]"
}
},
"students": {
"[email protected]": {
"comments": "This student's name is Benny Charlés",
"id": "00000000-0000-4000-8000-000000000601",
"courseId": "tm.e2e.ISRecords.CS2104",
"course": {
"id": "tm.e2e.ISRecords.CS2104"
},
"account": {
"id": "00000000-0000-4000-8000-000000000002"
},
"team": {
"id": "00000000-0000-4000-8000-000000000301"
},
"name": "Benny Charlés",
"email": "[email protected]"
}
},
"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 @@ -10,6 +10,7 @@
<class name="teammates.e2e.cases.sql.FeedbackMsqQuestionE2ETest" />
<class name="teammates.e2e.cases.sql.FeedbackTextQuestionE2ETest" />
<class name="teammates.e2e.cases.sql.FeedbackNumScaleQuestionE2ETest" />
<class name="teammates.e2e.cases.sql.InstructorStudentRecordsPageE2ETest" />
<class name="teammates.e2e.cases.sql.InstructorCourseDetailsPageE2ETest" />
<class name="teammates.e2e.cases.sql.StudentHomePageE2ETest" />
<class name="teammates.e2e.cases.sql.AdminSearchPageE2ETest" />
Expand Down

0 comments on commit 63b3209

Please sign in to comment.