-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into combine-account-requests
- Loading branch information
Showing
46 changed files
with
1,270 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/e2e/java/teammates/e2e/cases/sql/InstructorCourseStudentDetailsEditPageE2ETest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package teammates.e2e.cases.sql; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import teammates.common.util.AppUrl; | ||
import teammates.common.util.Const; | ||
import teammates.e2e.pageobjects.InstructorCourseStudentDetailsEditPageSql; | ||
import teammates.e2e.util.TestProperties; | ||
import teammates.storage.sqlentity.Course; | ||
import teammates.storage.sqlentity.Student; | ||
import teammates.storage.sqlentity.Team; | ||
|
||
/** | ||
* SUT: {@link Const.WebPageURIs#INSTRUCTOR_COURSE_STUDENT_DETAILS_EDIT_PAGE}. | ||
*/ | ||
public class InstructorCourseStudentDetailsEditPageE2ETest extends BaseE2ETestCase { | ||
private Student student; | ||
private Student otherStudent; | ||
private Course course; | ||
|
||
@Override | ||
protected void prepareTestData() { | ||
testData = removeAndRestoreDataBundle( | ||
loadSqlDataBundle("/InstructorCourseStudentDetailsEditPageE2ETestSql.json")); | ||
|
||
student = testData.students.get("ICSDetEdit.jose.tmms"); | ||
otherStudent = testData.students.get("ICSDetEdit.benny.c"); | ||
course = testData.courses.get("ICSDetEdit.CS2104"); | ||
} | ||
|
||
@Test | ||
@Override | ||
public void testAll() { | ||
AppUrl editPageUrl = createFrontendUrl(Const.WebPageURIs.INSTRUCTOR_COURSE_STUDENT_DETAILS_EDIT_PAGE) | ||
.withCourseId(course.getId()) | ||
.withStudentEmail(student.getEmail()); | ||
InstructorCourseStudentDetailsEditPageSql editPage = | ||
loginToPage(editPageUrl, InstructorCourseStudentDetailsEditPageSql.class, | ||
testData.instructors.get("ICSDetEdit.instr").getGoogleId()); | ||
|
||
______TS("verify loaded data"); | ||
editPage.verifyStudentDetails(student); | ||
|
||
______TS("edit student details"); | ||
Team otherTeam = testData.teams.get("tm.e2e.ICSDetEdit.CS2104-SectionB-Team100"); | ||
student.setName("edited name"); | ||
student.setTeam(otherTeam); | ||
student.setComments("edited comment"); | ||
editPage.editStudentDetails(student); | ||
|
||
editPage.verifyStatusMessage("Student has been updated"); | ||
verifyPresentInDatabase(student); | ||
|
||
______TS("cannot edit to an existing email"); | ||
editPage = getNewPageInstance(editPageUrl, InstructorCourseStudentDetailsEditPageSql.class); | ||
editPage.editStudentEmailAndResendLinks(otherStudent.getEmail()); | ||
|
||
editPage.verifyStatusMessage("Trying to update to an email that is already in use"); | ||
|
||
______TS("edit email and resend links"); | ||
String newEmail = TestProperties.TEST_EMAIL; | ||
student.setEmail(newEmail); | ||
student.setGoogleId(null); | ||
editPage.editStudentEmailAndResendLinks(newEmail); | ||
|
||
editPage.verifyStatusMessage("Student has been updated and email sent"); | ||
verifyPresentInDatabase(student); | ||
verifyEmailSent(newEmail, "TEAMMATES: Summary of course [" | ||
+ course.getName() + "][Course ID: " + course.getId() + "]"); | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
src/e2e/java/teammates/e2e/pageobjects/InstructorCourseStudentDetailsEditPageSql.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package teammates.e2e.pageobjects; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
import teammates.storage.sqlentity.Student; | ||
|
||
/** | ||
* Represents the instructor course student details edit page of the website. | ||
*/ | ||
public class InstructorCourseStudentDetailsEditPageSql extends AppPage { | ||
|
||
@FindBy (id = "course-id") | ||
private WebElement courseId; | ||
|
||
@FindBy (id = "student-name") | ||
private WebElement studentNameTextbox; | ||
|
||
@FindBy (id = "section-name") | ||
private WebElement sectionNameTextbox; | ||
|
||
@FindBy (id = "team-name") | ||
private WebElement teamNameTextbox; | ||
|
||
@FindBy (id = "new-student-email") | ||
private WebElement studentEmailTextbox; | ||
|
||
@FindBy (id = "comments") | ||
private WebElement commentsTextbox; | ||
|
||
@FindBy (id = "btn-submit") | ||
private WebElement submitButton; | ||
|
||
public InstructorCourseStudentDetailsEditPageSql(Browser browser) { | ||
super(browser); | ||
} | ||
|
||
@Override | ||
protected boolean containsExpectedPageContents() { | ||
return getPageTitle().contains("Edit Student Details"); | ||
} | ||
|
||
public void verifyIsCorrectPage(String expectedCourseId, String expectedStudentEmail) { | ||
assertEquals(expectedCourseId, courseId.getText()); | ||
assertEquals(expectedStudentEmail, studentEmailTextbox.getAttribute("value")); | ||
} | ||
|
||
public void verifyStudentDetails(Student student) { | ||
assertEquals(student.getCourse().getId(), courseId.getText()); | ||
assertEquals(student.getName(), studentNameTextbox.getAttribute("value")); | ||
if (student.getSection() == null) { | ||
assertEquals("None", sectionNameTextbox.getAttribute("value")); | ||
} else { | ||
assertEquals(student.getSection().getName(), sectionNameTextbox.getAttribute("value")); | ||
} | ||
assertEquals(student.getTeam().getName(), teamNameTextbox.getAttribute("value")); | ||
assertEquals(student.getEmail(), studentEmailTextbox.getAttribute("value")); | ||
if (student.getComments() != null) { | ||
assertEquals(student.getComments(), commentsTextbox.getAttribute("value")); | ||
} | ||
} | ||
|
||
public void editStudentDetails(Student newStudent) { | ||
fillTextBox(studentNameTextbox, newStudent.getName()); | ||
fillTextBox(sectionNameTextbox, newStudent.getSection().getName()); | ||
fillTextBox(teamNameTextbox, newStudent.getTeam().getName()); | ||
if (newStudent.getComments() != null) { | ||
fillTextBox(commentsTextbox, newStudent.getComments()); | ||
} | ||
clickAndConfirm(submitButton); | ||
} | ||
|
||
public void editStudentEmailAndResendLinks(String newEmail) { | ||
fillTextBox(studentEmailTextbox, newEmail); | ||
click(submitButton); | ||
click(waitForElementPresence(By.id("btn-resend-links"))); | ||
} | ||
} |
123 changes: 123 additions & 0 deletions
123
src/e2e/resources/data/InstructorCourseStudentDetailsEditPageE2ETestSql.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"accounts": { | ||
"ICSDetEdit.instr": { | ||
"id": "00000000-0000-4000-8000-000000000001", | ||
"googleId": "tm.e2e.ICSDetEdit.instr", | ||
"name": "Teammates Test", | ||
"email": "ICSDetEdit.instr@gmail.tmt" | ||
}, | ||
"José Gómez": { | ||
"id": "00000000-0000-4000-8000-000000000002", | ||
"googleId": "tm.e2e.ICSDetEdit.jose.tmms", | ||
"name": "José Gómez", | ||
"email": "ICSDetEdit.jose.tmms@gmail.tmt" | ||
} | ||
}, | ||
"accountRequests": {}, | ||
"courses": { | ||
"ICSDetEdit.CS2104": { | ||
"id": "tm.e2e.ICSDetEdit.CS2104", | ||
"name": "Programming Language Concepts", | ||
"institute": "TEAMMATES Test Institute 1", | ||
"timeZone": "UTC" | ||
} | ||
}, | ||
"sections": { | ||
"tm.e2e.ICSDetEdit.CS2104-SectionA": { | ||
"id": "00000000-0000-4000-8000-000000000201", | ||
"course": { | ||
"id": "tm.e2e.ICSDetEdit.CS2104" | ||
}, | ||
"name": "Section A" | ||
}, | ||
"tm.e2e.ICSDetEdit.CS2104-SectionB": { | ||
"id": "00000000-0000-4000-8000-000000000202", | ||
"course": { | ||
"id": "tm.e2e.ICSDetEdit.CS2104" | ||
}, | ||
"name": "Section B" | ||
} | ||
}, | ||
"teams": { | ||
"tm.e2e.ICSDetEdit.CS2104-SectionA-Team1": { | ||
"id": "00000000-0000-4000-8000-000000000301", | ||
"section": { | ||
"id": "00000000-0000-4000-8000-000000000201" | ||
}, | ||
"name": "Team 1" | ||
}, | ||
"tm.e2e.ICSDetEdit.CS2104-SectionB-Team100": { | ||
"id": "00000000-0000-4000-8000-000000000302", | ||
"section": { | ||
"id": "00000000-0000-4000-8000-000000000202" | ||
}, | ||
"name": "Team 100" | ||
} | ||
}, | ||
"deadlineExtensions": {}, | ||
"instructors": { | ||
"ICSDetEdit.instr": { | ||
"id": "00000000-0000-4000-8000-000000000501", | ||
"course": { | ||
"id": "tm.e2e.ICSDetEdit.CS2104" | ||
}, | ||
"account": { | ||
"id": "00000000-0000-4000-8000-000000000001" | ||
}, | ||
"name": "Teammates Test", | ||
"email": "ICSDetEdit.instr@gmail.tmt", | ||
"role": "INSTRUCTOR_PERMISSION_ROLE_COOWNER", | ||
"isDisplayedToStudents": false, | ||
"displayName": "Co-owner", | ||
"privileges": { | ||
"courseLevel": { | ||
"canViewStudentInSections": true, | ||
"canSubmitSessionInSections": true, | ||
"canModifySessionCommentsInSections": true, | ||
"canModifyCourse": true, | ||
"canViewSessionInSections": true, | ||
"canModifySession": true, | ||
"canModifyStudent": true, | ||
"canModifyInstructor": true | ||
}, | ||
"sectionLevel": {}, | ||
"sessionLevel": {} | ||
} | ||
} | ||
}, | ||
"students": { | ||
"ICSDetEdit.jose.tmms": { | ||
"id": "00000000-0000-4000-8000-000000000601", | ||
"account": { | ||
"id": "00000000-0000-4000-8000-000000000002" | ||
}, | ||
"course": { | ||
"id": "tm.e2e.ICSDetEdit.CS2104" | ||
}, | ||
"team": { | ||
"id": "00000000-0000-4000-8000-000000000301" | ||
}, | ||
"email": "ICSDetEdit.jose.tmms@gmail.tmt", | ||
"name": "José Gómez", | ||
"comments": "This student's name is José Gómez" | ||
}, | ||
"ICSDetEdit.benny.c": { | ||
"id": "00000000-0000-4000-8000-000000000602", | ||
"course": { | ||
"id": "tm.e2e.ICSDetEdit.CS2104" | ||
}, | ||
"team": { | ||
"id": "00000000-0000-4000-8000-000000000301" | ||
}, | ||
"email": "ICSDetEdit.benny.c.tmms@gmail.tmt", | ||
"name": "Benny Charles", | ||
"comments": "This student's name is Benny Charles" | ||
} | ||
}, | ||
"feedbackSessions": {}, | ||
"feedbackQuestions": {}, | ||
"feedbackResponses": {}, | ||
"feedbackResponseComments": {}, | ||
"notifications": {}, | ||
"readNotifications": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.