use of fi.otavanopisto.muikku.mock.model.MockStaffMember in project muikku by otavanopisto.
the class CommunicatorTestsBase method communicatorSentMessagesTest.
@Test
public void communicatorSentMessagesTest() 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();
mockBuilder.addStaffMember(admin).addStudent(student).mockLogin(admin).build();
try {
try {
login();
navigate("/communicator", true);
waitAndClick(".mf-primary-function .mf-primary-function-content");
waitForPresent("#recipientContent");
sendKeys("#recipientContent", "Test");
waitAndClick(".ui-autocomplete li.ui-menu-item");
waitForPresent(".mf-textfield-subject");
sendKeys(".mf-textfield-subject", "Test");
waitAndClick("#cke_1_contents");
addTextToCKEditor("Communicator test");
waitAndClick("*[name='send']");
waitForPresent(".mf-content-master");
getWebDriver().get("about:blank");
navigate("/communicator#sent", true);
waitForPresent(".cm-message-header-content-secondary");
assertText(".cm-message-header-content-secondary", "Test");
} finally {
deleteCommunicatorMessages();
}
} finally {
mockBuilder.wiremockReset();
}
}
use of fi.otavanopisto.muikku.mock.model.MockStaffMember in project muikku by otavanopisto.
the class CommunicatorTestsBase method communicatorDeleteSentMessageTest.
@Test
public void communicatorDeleteSentMessageTest() 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).addStudent(student).mockLogin(admin).build();
login();
try {
long sender = getUserIdByEmail("admin@example.com");
long recipient = getUserIdByEmail("student@example.com");
createCommunicatorMesssage("Test caption", "Test content.", sender, recipient);
navigate("/communicator#sent", true);
waitForPresent(".cm-message-select input[name=\"messageSelect\"]");
click(".cm-message-select input[name=\"messageSelect\"]");
waitForPresent(".icon-delete");
click(".icon-delete");
waitForPresent(".cm-messages-container");
waitForPresent(".content");
String currentUrl = getWebDriver().getCurrentUrl();
assertTrue("Communicator does not stay in sent messages box.", currentUrl.equals("https://dev.muikku.fi:" + getPortHttps() + "/communicator#sent"));
assertTrue("Element found even though it shouldn't be there", isElementPresent("div.cm-message-select input[type=\"checkbox\"]") == false);
} finally {
deleteCommunicatorMessages();
}
} finally {
mockBuilder.wiremockReset();
}
}
use of fi.otavanopisto.muikku.mock.model.MockStaffMember in project muikku by otavanopisto.
the class CommunicatorTestsBase method communicatorReadMessageTest.
@Test
public void communicatorReadMessageTest() 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).addStudent(student).mockLogin(admin).build();
login();
try {
long sender = getUserIdByEmail("admin@example.com");
long recipient = getUserIdByEmail("student@example.com");
createCommunicatorMesssage("Test caption", "Test content.", sender, recipient);
logout();
mockBuilder.mockLogin(student).build();
login();
navigate("/communicator", true);
waitAndClick("div.cm-message-header-content-secondary");
waitForPresent(".cm-message-content-text");
assertText("div.cm-message-content-text", "Test content.");
} finally {
deleteCommunicatorMessages();
}
} finally {
mockBuilder.wiremockReset();
}
}
use of fi.otavanopisto.muikku.mock.model.MockStaffMember in project muikku by otavanopisto.
the class CommunicatorTestsBase method communicatorEditLabelTest.
@Test
public void communicatorEditLabelTest() 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).addStudent(student).mockLogin(admin).build();
login();
try {
long recipient = getUserIdByEmail("admin@example.com");
long sender = getUserIdByEmail("student@example.com");
createCommunicatorMesssage("Test caption", "Test content.", sender, recipient);
createCommunicatorUserLabel(admin.getId(), "test");
navigate("/communicator#inbox", true);
waitAndClick(".mf-label-functions");
waitAndClick(".mf-label-function-edit");
waitForPresent(".mf-label-edit-dialog input[name=\"name\"]");
clearElement(".mf-label-edit-dialog input[name=\"name\"]");
waitAndSendKeys(".mf-label-edit-dialog input[name=\"name\"]", "edited");
waitAndClick(".save-button span");
assertText(".cm-folder .cm-label-name a span", "edited");
} finally {
deleteCommunicatorUserLabels(admin.getId());
deleteCommunicatorMessages();
}
} finally {
mockBuilder.wiremockReset();
}
}
use of fi.otavanopisto.muikku.mock.model.MockStaffMember in project muikku by otavanopisto.
the class CommunicatorTestsBase method communicatorPagingTest.
@Test
public void communicatorPagingTest() 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).addStudent(student).mockLogin(admin).build();
login();
try {
long sender = getUserIdByEmail("admin@example.com");
long recipient = getUserIdByEmail("student@example.com");
for (int i = 0; i < 30; i++) createCommunicatorMesssage("Test " + i, "Test content " + i, sender, recipient);
logout();
mockBuilder.mockLogin(student).build();
login();
navigate("/communicator", true);
waitScrollAndClick(".cm-page-link-load-more");
assertTrue(String.format("Elements list is not greater than %d in size", 10), waitForMoreThanSize("div.cm-message-header-content-secondary", 10));
} finally {
deleteCommunicatorMessages();
}
} finally {
mockBuilder.wiremockReset();
}
}
Aggregations