use of fi.otavanopisto.pyramus.rest.model.CourseStaffMember in project muikku by otavanopisto.
the class CourseUsersTestsBase method courseUnarchiveStudentTest.
@Test
public void courseUnarchiveStudentTest() throws Exception {
MockStaffMember admin = new MockStaffMember(1l, 1l, "Admin", "User", UserRole.ADMINISTRATOR, "121212-1234", "admin@example.com", Sex.MALE);
MockStudent student = new MockStudent(2l, 2l, "Student", "Tester", "student@example.com", 1l, OffsetDateTime.of(1990, 2, 2, 0, 0, 0, 0, ZoneOffset.UTC), "121212-1212", Sex.FEMALE, TestUtilities.toDate(2012, 1, 1), TestUtilities.getNextYear());
Builder mockBuilder = mocker();
try {
mockBuilder.addStaffMember(admin).mockLogin(admin).build();
login();
Long courseId = 1l;
Workspace workspace = createWorkspace("testcourse", "test course for testing", String.valueOf(courseId), Boolean.TRUE);
MockCourseStudent courseStudent = new MockCourseStudent(2l, courseId, student.getId());
CourseStaffMember courseStaffMember = new CourseStaffMember(1l, courseId, admin.getId(), 7l);
mockBuilder.addStudent(student).addCourseStaffMember(courseId, courseStaffMember).addCourseStudent(courseId, courseStudent).build();
try {
navigate(String.format("/workspace/%s/users", workspace.getUrlName()), true);
waitForPresent(".workspace-students-listing-wrapper .workspace-users-name");
waitAndClick("div[data-user-id='PYRAMUS-STUDENT-2']>div.workspace-users-archive");
waitAndClick(".archive-button");
waitForClickable(".workspace-students-inactive");
waitAndClick(".workspace-students-inactive");
waitAndClick("div[data-user-id='PYRAMUS-STUDENT-2']>div.workspace-users-unarchive");
waitAndClick(".unarchive-button");
waitForPresentAndVisible(".workspace-students-listing-wrapper");
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
String payload = objectMapper.writeValueAsString(new WebhookStudentUpdatePayload(2l));
TestUtilities.webhookCall("http://dev.muikku.fi:" + getPortHttp() + "/pyramus/webhook", payload);
reloadCurrentPage();
waitForPresent(".workspace-students-list");
waitAndClick(".workspace-students-active");
waitForPresent(".workspace-students-list");
assertPresent("div[data-user-id='PYRAMUS-STUDENT-2']");
} finally {
deleteWorkspace(workspace.getId());
}
} finally {
mockBuilder.wiremockReset();
mockBuilder.resetBuilder();
}
}
use of fi.otavanopisto.pyramus.rest.model.CourseStaffMember in project muikku by otavanopisto.
the class CourseUsersTestsBase method courseUsersListTest.
@Test
public void courseUsersListTest() throws Exception {
MockStaffMember admin = new MockStaffMember(1l, 1l, "Admin", "User", UserRole.ADMINISTRATOR, "121212-1234", "admin@example.com", Sex.MALE);
MockStudent student = new MockStudent(2l, 2l, "Student", "Tester", "student@example.com", 1l, OffsetDateTime.of(1990, 2, 2, 0, 0, 0, 0, ZoneOffset.UTC), "121212-1212", Sex.FEMALE, TestUtilities.toDate(2012, 1, 1), TestUtilities.getNextYear());
Builder mockBuilder = mocker();
try {
mockBuilder.addStaffMember(admin).mockLogin(admin).build();
login();
Long courseId = 1l;
Workspace workspace = createWorkspace("testcourse", "test course for testing", String.valueOf(courseId), Boolean.TRUE);
MockCourseStudent courseStudent = new MockCourseStudent(2l, courseId, student.getId());
CourseStaffMember courseStaffMember = new CourseStaffMember(1l, courseId, admin.getId(), 7l);
mockBuilder.addStudent(student).addCourseStaffMember(courseId, courseStaffMember).addCourseStudent(courseId, courseStudent).build();
try {
navigate(String.format("/workspace/%s/users", workspace.getUrlName()), true);
waitForPresent(".workspace-students-listing-wrapper .workspace-users-name");
assertText(".workspace-students-listing-wrapper .workspace-users-name", "Tester, Student (Test Study Programme)");
waitForPresent(".workspace-teachers-listing-wrapper .workspace-users-name");
assertText(".workspace-teachers-listing-wrapper .workspace-users-name", "User, Admin");
} finally {
deleteWorkspace(workspace.getId());
}
} finally {
mockBuilder.wiremockReset();
mockBuilder.resetBuilder();
}
}
use of fi.otavanopisto.pyramus.rest.model.CourseStaffMember in project muikku by otavanopisto.
the class EvaluationTestsBase method reEvaluateStudentWorkspaceMaterialTest.
@Test
@TestEnvironments(browsers = { TestEnvironments.Browser.CHROME, TestEnvironments.Browser.FIREFOX, TestEnvironments.Browser.INTERNET_EXPLORER, TestEnvironments.Browser.EDGE, TestEnvironments.Browser.SAFARI })
public void reEvaluateStudentWorkspaceMaterialTest() throws Exception {
MockStaffMember admin = new MockStaffMember(1l, 1l, "Admin", "User", UserRole.ADMINISTRATOR, "121212-1234", "admin@example.com", Sex.MALE);
MockStudent student = new MockStudent(2l, 2l, "Student", "Tester", "student@example.com", 1l, OffsetDateTime.of(1990, 2, 2, 0, 0, 0, 0, ZoneOffset.UTC), "121212-1212", Sex.FEMALE, TestUtilities.toDate(2012, 1, 1), TestUtilities.getNextYear());
Builder mockBuilder = mocker();
try {
mockBuilder.addStudent(student).addStaffMember(admin).mockLogin(admin).build();
Long courseId = 1l;
login();
Workspace workspace = createWorkspace("testcourse", "test course for testing", String.valueOf(courseId), Boolean.TRUE);
MockCourseStudent courseStudent = new MockCourseStudent(2l, courseId, student.getId());
CourseStaffMember courseStaffMember = new CourseStaffMember(1l, courseId, admin.getId(), 7l);
mockBuilder.addCourseStaffMember(courseId, courseStaffMember).addCourseStudent(courseId, courseStudent).build();
try {
WorkspaceFolder workspaceFolder1 = createWorkspaceFolder(workspace.getId(), null, Boolean.FALSE, 1, "Test Course material folder", "DEFAULT");
WorkspaceHtmlMaterial htmlMaterial = createWorkspaceHtmlMaterial(workspace.getId(), workspaceFolder1.getId(), "Test", "text/html;editor=CKEditor", "<p><object type=\"application/vnd.muikku.field.text\"><param name=\"type\" value=\"application/json\" /><param name=\"content\" value=\"{"name":"muikku-field-nT0yyez23QwFXD3G0I8HzYeK","rightAnswers":[],"columns":"","hint":""}\" /></object></p>", 1l, "EVALUATED");
try {
Long assessorId = getUserEntityIdForIdentifier(String.format("STAFF-%s", admin.getId()));
logout();
mockBuilder.mockLogin(student).build();
login();
navigate(String.format("/workspace/%s/materials", workspace.getUrlName()), true);
waitForPresent(String.format("#page-%d", htmlMaterial.getId()));
assertVisible(String.format("#page-%d .muikku-text-field", htmlMaterial.getId()));
assertValue(String.format("#page-%d .muikku-text-field", htmlMaterial.getId()), "");
assertClassNotPresent(String.format("#page-%d .muikku-text-field", htmlMaterial.getId()), "muikku-field-saved");
sendKeys(String.format("#page-%d .muikku-text-field", htmlMaterial.getId()), "field value");
waitClassPresent(String.format("#page-%d .muikku-text-field", htmlMaterial.getId()), "muikku-field-saved");
waitAndClick(String.format("#page-%d .muikku-submit-assignment", htmlMaterial.getId()));
waitForPresentAndVisible(".notification-queue-item-success");
waitForElementToBeClickable(String.format("#page-%d .muikku-withdraw-assignment", htmlMaterial.getId()));
logout();
mockBuilder.mockLogin(admin).build();
login();
navigate(String.format("/evaluation"), true);
waitAndClick("#filter-students-by-assessment-requested");
waitAndClick(".assignment-submitted");
addTextToCKEditor("Test evaluation.");
selectOption("#grade", "1/PYRAMUS@1/PYRAMUS");
selectOption("select[name='assessor']", assessorId.toString());
click(".save-evaluation-button");
waitForPresentAndVisible(".evaluation-assignment-wrapper");
assertClassPresent(".evaluation-assignment-wrapper", "assignment-evaluated");
// Re-evaluation
waitAndClick(".assignment-submitted");
waitForPresent("#grade");
assertValue("#grade", "1/PYRAMUS@1/PYRAMUS");
waitForPresent("select[name='assessor']");
assertValue("select[name='assessor']", assessorId.toString());
waitForPresent(".cke_contents");
assertEquals("Test evaluation.", getCKEditorContent());
addTextToCKEditor("Test evaluation in re-evaluation.");
selectOption("#grade", "2/PYRAMUS@1/PYRAMUS");
selectOption("select[name='assessor']", assessorId.toString());
click(".save-evaluation-button");
waitForPresentAndVisible(".evaluation-assignment-wrapper");
waitAndClick(".assignment-submitted");
waitForPresent("#grade");
assertValue("#grade", "2/PYRAMUS@1/PYRAMUS");
waitForPresent("select[name='assessor']");
assertValue("select[name='assessor']", assessorId.toString());
waitForPresent(".cke_contents");
assertEquals("Test evaluation.Test evaluation in re-evaluation.", getCKEditorContent());
} finally {
deleteWorkspaceHtmlMaterial(workspace.getId(), htmlMaterial.getId());
}
} finally {
deleteWorkspace(workspace.getId());
}
} finally {
mockBuilder.wiremockReset();
}
}
use of fi.otavanopisto.pyramus.rest.model.CourseStaffMember in project muikku by otavanopisto.
the class GuiderTestsBase method filterByWorkspaceTest.
@Test
public void filterByWorkspaceTest() throws Exception {
MockStaffMember admin = new MockStaffMember(1l, 1l, "Admin", "Person", UserRole.ADMINISTRATOR, "090978-1234", "testadmin@example.com", Sex.MALE);
MockStudent student = new MockStudent(3l, 3l, "Second", "User", "teststudent@example.com", 1l, OffsetDateTime.of(1990, 2, 2, 0, 0, 0, 0, ZoneOffset.UTC), "121212-1212", Sex.FEMALE, TestUtilities.toDate(2012, 1, 1), TestUtilities.getNextYear());
Builder mockBuilder = mocker();
mockBuilder.addStaffMember(admin).addStudent(student).mockLogin(admin).build();
login();
Workspace workspace = createWorkspace("testcourse", "test course for testing", "1", Boolean.TRUE);
Workspace workspace2 = createWorkspace("diffentcourse", "Second test course", "2", Boolean.TRUE);
MockCourseStudent mcs = new MockCourseStudent(1l, workspace.getId(), student.getId());
CourseStaffMember courseStaffMember = new CourseStaffMember(1l, 1l, admin.getId(), 7l);
mockBuilder.addCourseStaffMember(workspace.getId(), courseStaffMember).addCourseStudent(workspace.getId(), mcs).build();
try {
navigate("/guider", true);
waitAndClick(String.format("a.gt-filter-link[data-id~=\"%d\"]", workspace.getId()));
waitForPresent(".gt-user .gt-user-meta-topic>span");
assertText(".gt-user .gt-user-meta-topic>span", "Second User (Test Study Programme)");
} finally {
deleteWorkspace(workspace2.getId());
deleteWorkspace(workspace.getId());
mockBuilder.wiremockReset();
}
}
use of fi.otavanopisto.pyramus.rest.model.CourseStaffMember in project muikku by otavanopisto.
the class NewEvaluationTestsBase method evaluationVisibleInMaterialViewTest.
@Test
@TestEnvironments(browsers = { TestEnvironments.Browser.CHROME, TestEnvironments.Browser.FIREFOX, TestEnvironments.Browser.INTERNET_EXPLORER, TestEnvironments.Browser.EDGE, TestEnvironments.Browser.SAFARI })
public void evaluationVisibleInMaterialViewTest() throws Exception {
MockStaffMember admin = new MockStaffMember(1l, 1l, "Admin", "User", UserRole.ADMINISTRATOR, "121212-1234", "admin@example.com", Sex.MALE);
MockStudent student = new MockStudent(2l, 2l, "Student", "Tester", "student@example.com", 1l, OffsetDateTime.of(1990, 2, 2, 0, 0, 0, 0, ZoneOffset.UTC), "121212-1212", Sex.FEMALE, TestUtilities.toDate(2012, 1, 1), TestUtilities.getNextYear());
OffsetDateTime date = OffsetDateTime.of(2016, 11, 10, 1, 1, 1, 1, ZoneOffset.UTC);
Builder mockBuilder = mocker();
try {
mockBuilder.addStudent(student).addStaffMember(admin).mockLogin(admin).build();
Long courseId = 1l;
login();
Workspace workspace = createWorkspace("testcourse", "test course for testing", String.valueOf(courseId), Boolean.TRUE);
OffsetDateTime created = OffsetDateTime.of(2015, 10, 12, 12, 12, 0, 0, ZoneOffset.UTC);
OffsetDateTime begin = OffsetDateTime.of(2015, 10, 12, 12, 12, 0, 0, ZoneOffset.UTC);
OffsetDateTime end = OffsetDateTime.of(2045, 10, 12, 12, 12, 0, 0, ZoneOffset.UTC);
MockCourse mockCourse = new MockCourse(workspace.getId(), workspace.getName(), created, "test course", begin, end);
MockCourseStudent courseStudent = new MockCourseStudent(2l, courseId, student.getId());
CourseStaffMember courseStaffMember = new CourseStaffMember(1l, courseId, admin.getId(), 7l);
mockBuilder.addCourseStaffMember(courseId, courseStaffMember).addCourseStudent(courseId, courseStudent).build();
WorkspaceFolder workspaceFolder1 = createWorkspaceFolder(workspace.getId(), null, Boolean.FALSE, 1, "Test Course material folder", "DEFAULT");
WorkspaceHtmlMaterial htmlMaterial = createWorkspaceHtmlMaterial(workspace.getId(), workspaceFolder1.getId(), "Test exercise", "text/html;editor=CKEditor", "<p><object type=\"application/vnd.muikku.field.text\"><param name=\"type\" value=\"application/json\" /><param name=\"content\" value=\"{"name":"muikku-field-nT0yyez23QwFXD3G0I8HzYeK","rightAnswers":[],"columns":"","hint":""}\" /></object></p>", 1l, "EVALUATED");
try {
logout();
mockBuilder.mockLogin(student).build();
login();
navigate(String.format("/workspace/%s/materials", workspace.getUrlName()), true);
waitForPresent(String.format("#page-%d", htmlMaterial.getId()));
assertVisible(String.format("#page-%d .muikku-text-field", htmlMaterial.getId()));
assertValue(String.format("#page-%d .muikku-text-field", htmlMaterial.getId()), "");
assertClassNotPresent(String.format("#page-%d .muikku-text-field", htmlMaterial.getId()), "muikku-field-saved");
sendKeys(String.format("#page-%d .muikku-text-field", htmlMaterial.getId()), "field value");
waitClassPresent(String.format("#page-%d .muikku-text-field", htmlMaterial.getId()), "muikku-field-saved");
waitAndClick(String.format("#page-%d .muikku-submit-assignment", htmlMaterial.getId()));
waitForPresentAndVisible(".notification-queue-item-success");
waitForElementToBeClickable(String.format("#page-%d .muikku-withdraw-assignment", htmlMaterial.getId()));
mockBuilder.mockAssessmentRequests(student.getId(), courseId, courseStudent.getId(), "Hello!", false, false, date).mockCompositeGradingScales().addCompositeCourseAssessmentRequest(student.getId(), courseId, courseStudent.getId(), "Hello!", false, false, TestUtilities.courseFromMockCourse(mockCourse), student, date).mockCompositeCourseAssessmentRequests().addStaffCompositeAssessmentRequest(student.getId(), courseId, courseStudent.getId(), "Hello!", false, false, TestUtilities.courseFromMockCourse(mockCourse), student, admin.getId(), date).mockStaffCompositeCourseAssessmentRequests();
logout();
mockBuilder.mockLogin(admin).build();
login();
navigate(String.format("/evaluation2"), true);
waitAndClick(".evaluate-button");
waitAndClick(".assignment-title-wrapper");
waitForPresentAndVisible(".assignment-wrapper .muikku-text-field");
assertTextIgnoreCase(".assignment-wrapper .muikku-text-field", "field value");
waitAndClick(".assignment-evaluate-button");
waitUntilAnimationIsDone("#evaluationAssignmentEvaluateContainer");
waitForElementToBeClickable("#evaluationAssignmentEvaluateContainer .evaluation-modal-evaluate-form #cke_assignmentEvaluateFormLiteralEvaluation .cke_contents");
// click("#evaluationAssignmentEvaluateContainer .evaluation-modal-evaluate-form #cke_assignmentEvaluateFormLiteralEvaluation .cke_contents");
getWebDriver().switchTo().frame(findElementByCssSelector("#evaluationAssignmentEvaluateContainer .evaluation-modal-evaluate-form #cke_assignmentEvaluateFormLiteralEvaluation .cke_wysiwyg_frame"));
sendKeys(".cke_contents_ltr", "Test evaluation.");
getWebDriver().switchTo().defaultContent();
selectOption("#workspaceGrade", "PYRAMUS-1@PYRAMUS-1");
waitAndClick("#assignmentSaveButton");
waitForPresent(".notification-queue-item-success");
waitForPresentAndVisible(".assignment-wrapper .assignment-evaluated-label");
waitForPresentAndVisible(".assignment-wrapper .assignment-grade .assignment-grade-data");
assertTextIgnoreCase(".assignment-wrapper .assignment-grade .assignment-grade-data", "Excellent");
logout();
mockBuilder.mockLogin(student).build();
login();
navigate(String.format("/workspace/%s/materials", workspace.getUrlName()), true);
waitForPresent(String.format("#page-%d", htmlMaterial.getId()));
waitAndClick(".muikku-show-evaluation-button");
waitForPresentAndVisible(".evaluation-container .assignment-literal-container .assignment-literal-data");
assertText(".evaluation-container .assignment-literal-container .assignment-literal-data p", "Test evaluation.");
assertText(".evaluation-container .assignment-grade-container span.assignment-grade-data", "Excellent");
} finally {
deleteWorkspaceHtmlMaterial(workspace.getId(), htmlMaterial.getId());
deleteWorkspace(workspace.getId());
}
} finally {
mockBuilder.wiremockReset();
}
}
Aggregations