From 63b320969781943f6a495190c867f9c125cf37e5 Mon Sep 17 00:00:00 2001 From: Cedric Ong <67156011+cedricongjh@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:31:47 +0800 Subject: [PATCH] [#12048] Migrate InstructorStudentRecordsPageE2ETest (#13013) * migrate InstructorStudentRecordsPageE2ETest * Add InstructorStudentRecordsPageE2ETest to sql xml --------- Co-authored-by: Wei Qing <48304907+weiquu@users.noreply.github.com> --- .../InstructorStudentRecordsPageE2ETest.java | 44 +++++++++ .../InstructorStudentRecordsPage.java | 5 + ...nstructorStudentRecordsPageE2ETestSql.json | 99 +++++++++++++++++++ src/e2e/resources/testng-e2e-sql.xml | 1 + 4 files changed, 149 insertions(+) create mode 100644 src/e2e/java/teammates/e2e/cases/sql/InstructorStudentRecordsPageE2ETest.java create mode 100644 src/e2e/resources/data/InstructorStudentRecordsPageE2ETestSql.json diff --git a/src/e2e/java/teammates/e2e/cases/sql/InstructorStudentRecordsPageE2ETest.java b/src/e2e/java/teammates/e2e/cases/sql/InstructorStudentRecordsPageE2ETest.java new file mode 100644 index 00000000000..26fecac1b13 --- /dev/null +++ b/src/e2e/java/teammates/e2e/cases/sql/InstructorStudentRecordsPageE2ETest.java @@ -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("benny.c.tmms@ISR.CS2104"); + + 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); + } +} diff --git a/src/e2e/java/teammates/e2e/pageobjects/InstructorStudentRecordsPage.java b/src/e2e/java/teammates/e2e/pageobjects/InstructorStudentRecordsPage.java index d0c8a5e9920..b3fe750ff3b 100644 --- a/src/e2e/java/teammates/e2e/pageobjects/InstructorStudentRecordsPage.java +++ b/src/e2e/java/teammates/e2e/pageobjects/InstructorStudentRecordsPage.java @@ -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. @@ -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()); + } + } diff --git a/src/e2e/resources/data/InstructorStudentRecordsPageE2ETestSql.json b/src/e2e/resources/data/InstructorStudentRecordsPageE2ETestSql.json new file mode 100644 index 00000000000..0c5783361fe --- /dev/null +++ b/src/e2e/resources/data/InstructorStudentRecordsPageE2ETestSql.json @@ -0,0 +1,99 @@ +{ + "accounts": { + "teammates.test": { + "googleId": "tm.e2e.ISRecords.teammates.test", + "name": "Teammates Test", + "email": "teammates.test@gmail.tmt", + "id": "00000000-0000-4000-8000-000000000001" + }, + "benny.c.tmms@ISR.CS2104": { + "googleId": "tm.e2e.ISRecords.benny.c.tmms", + "name": "Benny Charlés", + "email": "benny.c.tmms@gmail.tmt", + "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": "teammates.test@gmail.tmt" + } + }, + "students": { + "benny.c.tmms@ISR.CS2104": { + "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": "benny.c.tmms@gmail.tmt" + } + }, + "feedbackSessions": {}, + "feedbackQuestions": {}, + "feedbackResponses": {}, + "feedbackResponseComments": {}, + "notifications": {}, + "readNotifications": {} +} diff --git a/src/e2e/resources/testng-e2e-sql.xml b/src/e2e/resources/testng-e2e-sql.xml index 42881b3a3e7..fb3f2597ed6 100644 --- a/src/e2e/resources/testng-e2e-sql.xml +++ b/src/e2e/resources/testng-e2e-sql.xml @@ -10,6 +10,7 @@ +