Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package teammates.e2e.cases.sql;

import java.time.Instant;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;

import org.testng.annotations.Test;

import teammates.common.datatransfer.questions.FeedbackTextResponseDetails;
import teammates.common.util.AppUrl;
import teammates.common.util.Const;
import teammates.e2e.pageobjects.FeedbackSubmitPageSql;
import teammates.e2e.pageobjects.InstructorStudentActivityLogsPage;
import teammates.storage.sqlentity.Course;
import teammates.storage.sqlentity.FeedbackQuestion;
import teammates.storage.sqlentity.FeedbackResponse;
import teammates.storage.sqlentity.FeedbackSession;
import teammates.storage.sqlentity.Instructor;
import teammates.storage.sqlentity.Student;

/**
* SUT: {@link Const.WebPageURIs#INSTRUCTOR_STUDENT_ACTIVITY_LOGS_PAGE}.
*/
public class InstructorStudentActivityLogsPageE2ETest extends BaseE2ETestCase {
private Instructor instructor;
private Course course;
private FeedbackSession feedbackSession;
private FeedbackQuestion feedbackQuestion;
private Student student;

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

instructor = testData.instructors.get("instructor");
course = testData.courses.get("course");
student = testData.students.get("alice.tmms@ISActLogs.CS2104");
feedbackSession = testData.feedbackSessions.get("openSession");
feedbackQuestion = testData.feedbackQuestions.get("qn1");
}

@Test
@Override
public void testAll() {
AppUrl url = createFrontendUrl(Const.WebPageURIs.INSTRUCTOR_STUDENT_ACTIVITY_LOGS_PAGE)
.withCourseId("tm.e2e.ISActLogs.CS2104");
InstructorStudentActivityLogsPage studentActivityLogsPage =
loginToPage(url, InstructorStudentActivityLogsPage.class, instructor.getGoogleId());

______TS("verify default datetime");
String currentLogsFromDate = studentActivityLogsPage.getLogsFromDate();
String currentLogsToDate = studentActivityLogsPage.getLogsToDate();
String currentLogsFromTime = studentActivityLogsPage.getLogsFromTime();
String currentLogsToTime = studentActivityLogsPage.getLogsToTime();

studentActivityLogsPage.setLogsFromDateTime(
Instant.now().minus(1, ChronoUnit.DAYS),
ZoneId.systemDefault().getId());
studentActivityLogsPage.setLogsToDateTime(Instant.now(), ZoneId.systemDefault().getId());

assertEquals(currentLogsFromDate, studentActivityLogsPage.getLogsFromDate());
assertEquals(currentLogsToDate, studentActivityLogsPage.getLogsToDate());
assertEquals(currentLogsFromTime, "23:59H");
assertEquals(currentLogsToTime, "23:59H");

______TS("verify logs output");
logout();
AppUrl studentSubmissionPageUrl = createFrontendUrl(Const.WebPageURIs.STUDENT_SESSION_SUBMISSION_PAGE)
.withCourseId(course.getId())
.withSessionName(feedbackSession.getName());
FeedbackSubmitPageSql studentSubmissionPage = loginToPage(studentSubmissionPageUrl,
FeedbackSubmitPageSql.class, student.getGoogleId());

Student receiver = testData.students.get("benny.tmms@ISActLogs.CS2104");
feedbackQuestion = testData.feedbackQuestions.get("qn1");

FeedbackTextResponseDetails details = new FeedbackTextResponseDetails("Response");
FeedbackResponse response = FeedbackResponse.makeResponse(
feedbackQuestion, student.getEmail(), student.getSection(),
receiver.getEmail(), receiver.getSection(), details);

studentSubmissionPage.fillTextResponse(1, receiver.getName(), response);
studentSubmissionPage.clickSubmitQuestionButton(1);

logout();
studentActivityLogsPage = loginToPage(url, InstructorStudentActivityLogsPage.class, instructor.getGoogleId());

studentActivityLogsPage.setActivityType("session access and submission");
studentActivityLogsPage.waitForPageToLoad();
studentActivityLogsPage.startSearching();

assertTrue(studentActivityLogsPage.isLogPresentForSession(feedbackQuestion.getFeedbackSessionName()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void setStudentName(String studentName) {
}

public void setLogsFromDateTime(Instant instant, String timeZone) {
setDateTime(logsFromDatepicker, logsToTimepicker, instant, timeZone);
setDateTime(logsFromDatepicker, logsFromTimepicker, instant, timeZone);
}

public void setLogsToDateTime(Instant instant, String timeZone) {
Expand All @@ -131,4 +131,12 @@ private void setDateTime(WebElement dateBox, WebElement timeBox, Instant startIn

selectDropdownOptionByText(timeBox.findElement(By.tagName("select")), getTimeString(startInstant, timeZone));
}

public String getLogsOutputText() {
return logsOutput.getText();
}

public void waitForLogsToLoad() {
waitForElementPresence(By.id("logs-output"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
{
"accounts": {
"instructorWithSessions": {
"id": "00000000-0000-4000-8000-000000000001",
"googleId": "tm.e2e.ISActLogs.instructor",
"name": "Teammates Test",
"email": "tmms.test@gmail.tmt"
},
"alice.tmms@ISActLogs.CS2104": {
"id": "00000000-0000-4000-8000-000000000002",
"googleId": "tm.e2e.ISActLogs.alice.tmms",
"name": "Alice Betsy",
"email": "alice.b.tmms@gmail.tmt"
},
"benny.tmms@ISActLogs.CS2104": {
"id": "00000000-0000-4000-8000-000000000003",
"googleId": "tm.e2e.ISActLogs.benny.tmms",
"name": "Benny Charles",
"email": "benny.tmms@gmail.tmt"
}
},
"courses": {
"course": {
"id": "tm.e2e.ISActLogs.CS2104",
"name": "Programming Language Concepts",
"institute": "TEAMMATES Test Institute 1",
"timeZone": "Africa/Johannesburg"
}
},
"sections": {
"section1": {
"id": "00000000-0000-4000-8000-000000000101",
"course": {
"id": "tm.e2e.ISActLogs.CS2104"
},
"name": "Section 1"
}
},
"teams": {
"team1": {
"id": "00000000-0000-4000-8000-000000000201",
"section": {
"id": "00000000-0000-4000-8000-000000000101"
},
"name": "Team 1"
}
},
"instructors": {
"instructor": {
"id": "00000000-0000-4000-8000-000000000301",
"account": {
"id": "00000000-0000-4000-8000-000000000001"
},
"course": {
"id": "tm.e2e.ISActLogs.CS2104"
},
"name": "Teammates Test",
"email": "tmms.test@gmail.tmt",
"role": "INSTRUCTOR_PERMISSION_ROLE_COOWNER",
"isDisplayedToStudents": true,
"displayName": "Co-owner",
"privileges": {
"courseLevel": {
"canViewStudentInSections": true,
"canSubmitSessionInSections": true,
"canModifySessionCommentsInSections": true,
"canModifyCourse": true,
"canViewSessionInSections": true,
"canModifySession": true,
"canModifyStudent": true,
"canModifyInstructor": true
},
"sectionLevel": {},
"sessionLevel": {}
}
}
},
"students": {
"alice.tmms@ISActLogs.CS2104": {
"id": "00000000-0000-4000-8000-000000000401",
"account": {
"id": "00000000-0000-4000-8000-000000000002"
},
"course": {
"id": "tm.e2e.ISActLogs.CS2104"
},
"section": {
"id": "00000000-0000-4000-8000-000000000101"
},
"team": {
"id": "00000000-0000-4000-8000-000000000201"
},
"name": "Alice Betsy",
"email": "alice.b.tmms@gmail.tmt",
"comments": "This student's name is Alice Betsy"
},
"benny.tmms@ISActLogs.CS2104": {
"id": "00000000-0000-4000-8000-000000000402",
"account": {
"id": "00000000-0000-4000-8000-000000000003"
},
"course": {
"id": "tm.e2e.ISActLogs.CS2104"
},
"section": {
"id": "00000000-0000-4000-8000-000000000101"
},
"team": {
"id": "00000000-0000-4000-8000-000000000201"
},
"name": "Benny Charles",
"email": "benny.tmms@gmail.tmt",
"comments": "This student's name is Benny Charles"
}
},
"feedbackSessions": {
"openSession": {
"id": "00000000-0000-4000-8000-000000000501",
"name": "First Session",
"course": {
"id": "tm.e2e.ISActLogs.CS2104"
},
"creatorEmail": "tmms.test@gmail.tmt",
"instructions": "<p>Instructions for first session</p>",
"startTime": "2012-04-01T22:00:00Z",
"endTime": "2026-04-30T22:00:00Z",
"sessionVisibleFromTime": "2012-04-01T22:00:00Z",
"resultsVisibleFromTime": "2026-05-01T22:00:00Z",
"gracePeriod": 10,
"isOpenedEmailEnabled": true,
"isClosingSoonEmailEnabled": true,
"isPublishedEmailEnabled": true,
"isOpeningSoonEmailSent": false,
"isOpenedEmailSent": false,
"isClosingSoonEmailSent": false,
"isClosedEmailSent": false,
"isPublishedEmailSent": false
}
},
"feedbackQuestions": {
"qn1": {
"id": "00000000-0000-4000-8000-000000000601",
"feedbackSession": {
"id": "00000000-0000-4000-8000-000000000501"
},
"questionDetails": {
"questionType": "TEXT",
"questionText": "Testing question text"
},
"description": "<p>Testing description</p>",
"questionNumber": 1,
"giverType": "STUDENTS",
"recipientType": "STUDENTS",
"numOfEntitiesToGiveFeedbackTo": 2,
"showResponsesTo": [
"STUDENTS",
"INSTRUCTORS",
"OWN_TEAM_MEMBERS",
"RECEIVER"
],
"showGiverNameTo": [
"STUDENTS",
"INSTRUCTORS",
"OWN_TEAM_MEMBERS",
"RECEIVER"
],
"showRecipientNameTo": [
"STUDENTS",
"INSTRUCTORS",
"OWN_TEAM_MEMBERS",
"RECEIVER"
]
}
}
}
1 change: 1 addition & 0 deletions src/e2e/resources/testng-unstable-e2e-sql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<package name="teammates.e2e.util" />
</packages>
<classes>
<class name="teammates.e2e.cases.sql.InstructorStudentActivityLogsPageE2ETest" />
<class name="teammates.e2e.cases.sql.InstructorSearchPageE2ETest" />
</classes>
</test>
Expand Down
Loading