Search in sources :

Example 6 with Workspace

use of fi.otavanopisto.muikku.atests.Workspace in project muikku by otavanopisto.

the class CourseAccessTestsBase method courseStudentMembersOnlyCourseAccessTest.

@Test
@TestEnvironments(browsers = { TestEnvironments.Browser.CHROME, TestEnvironments.Browser.FIREFOX, TestEnvironments.Browser.INTERNET_EXPLORER, TestEnvironments.Browser.EDGE, TestEnvironments.Browser.PHANTOMJS })
public void courseStudentMembersOnlyCourseAccessTest() 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();
        Long courseId = 1l;
        Workspace workspace = createWorkspace("testcourse", "test course for testing", String.valueOf(courseId), Boolean.TRUE);
        MockCourseStudent mockCourseStudent = new MockCourseStudent(3l, courseId, student.getId());
        mockBuilder.addCourseStudent(workspace.getId(), mockCourseStudent).build();
        try {
            navigate(String.format("/workspace/%s/workspace-management", workspace.getUrlName()), true);
            waitAndClick(".additionalinfo-data div input[value=\"MEMBERS_ONLY\"]");
            waitAndClick(".workspace-management-footer .workspace-management-footer-actions-container button.save");
            waitForElementToBePresent(By.cssSelector(".loading"));
            navigate(String.format("/workspace/%s/workspace-management", workspace.getUrlName()), true);
            waitForVisible(".additionalinfo-data div input");
            sleep(1000);
            assertChecked(".additionalinfo-data div input[value=\"MEMBERS_ONLY\"]", true);
            logout();
            mockBuilder.mockLogin(student);
            login();
            navigate(String.format("/workspace/%s", workspace.getUrlName()), true);
            waitForPresent(".workspace-header-wrapper .workspace-header-container h1.workspace-title");
            assertPresent(".workspace-header-wrapper .workspace-header-container h1.workspace-title");
        } finally {
            deleteWorkspace(workspace.getId());
        }
    } finally {
        mockBuilder.wiremockReset();
    }
}
Also used : Builder(fi.otavanopisto.muikku.mock.PyramusMock.Builder) MockStaffMember(fi.otavanopisto.muikku.mock.model.MockStaffMember) MockStudent(fi.otavanopisto.muikku.mock.model.MockStudent) MockCourseStudent(fi.otavanopisto.muikku.mock.model.MockCourseStudent) Workspace(fi.otavanopisto.muikku.atests.Workspace) Test(org.junit.Test) AbstractUITest(fi.otavanopisto.muikku.ui.AbstractUITest) TestEnvironments(fi.otavanopisto.muikku.TestEnvironments)

Example 7 with Workspace

use of fi.otavanopisto.muikku.atests.Workspace in project muikku by otavanopisto.

the class CourseAccessTestsBase method courseStudentLoggedInCourseAccessTest.

@Test
@TestEnvironments(browsers = { TestEnvironments.Browser.CHROME, TestEnvironments.Browser.FIREFOX, TestEnvironments.Browser.INTERNET_EXPLORER, TestEnvironments.Browser.EDGE, TestEnvironments.Browser.PHANTOMJS })
public void courseStudentLoggedInCourseAccessTest() 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();
        Long courseId = 1l;
        Workspace workspace = createWorkspace("testcourse", "test course for testing", String.valueOf(courseId), Boolean.TRUE);
        MockCourseStudent mockCourseStudent = new MockCourseStudent(3l, courseId, student.getId());
        mockBuilder.addCourseStudent(workspace.getId(), mockCourseStudent).build();
        try {
            navigate(String.format("/workspace/%s/workspace-management", workspace.getUrlName()), true);
            waitAndClick(".additionalinfo-data div input[value=\"LOGGED_IN\"]");
            waitAndClick(".workspace-management-footer .workspace-management-footer-actions-container button.save");
            waitForElementToBePresent(By.cssSelector(".loading"));
            navigate(String.format("/workspace/%s/workspace-management", workspace.getUrlName()), true);
            waitForVisible(".additionalinfo-data div input");
            sleep(1000);
            assertChecked(".additionalinfo-data div input[value=\"LOGGED_IN\"]", true);
            logout();
            mockBuilder.mockLogin(student);
            login();
            navigate(String.format("/workspace/%s", workspace.getUrlName()), true);
            assertPresent(".workspace-header-wrapper .workspace-header-container h1.workspace-title");
        } finally {
            deleteWorkspace(workspace.getId());
        }
    } finally {
        mockBuilder.wiremockReset();
    }
}
Also used : Builder(fi.otavanopisto.muikku.mock.PyramusMock.Builder) MockStaffMember(fi.otavanopisto.muikku.mock.model.MockStaffMember) MockStudent(fi.otavanopisto.muikku.mock.model.MockStudent) MockCourseStudent(fi.otavanopisto.muikku.mock.model.MockCourseStudent) Workspace(fi.otavanopisto.muikku.atests.Workspace) Test(org.junit.Test) AbstractUITest(fi.otavanopisto.muikku.ui.AbstractUITest) TestEnvironments(fi.otavanopisto.muikku.TestEnvironments)

Example 8 with Workspace

use of fi.otavanopisto.muikku.atests.Workspace in project muikku by otavanopisto.

the class CourseTestsBase method courseDiscussionButtonTest.

@Test
public void courseDiscussionButtonTest() throws Exception {
    loginAdmin();
    Workspace workspace = createWorkspace("testcourse", "test course for testing", "1", Boolean.TRUE);
    try {
        navigate(String.format("/workspace/%s", workspace.getUrlName()), true);
        waitForElementToBePresent(By.className("workspace-title"));
        boolean elementExists = getWebDriver().findElements(By.cssSelector("a.icon-bubble")).size() > 0;
        assertTrue(elementExists);
    } finally {
        WireMock.reset();
        deleteWorkspace(workspace.getId());
    }
}
Also used : Workspace(fi.otavanopisto.muikku.atests.Workspace) Test(org.junit.Test) AbstractUITest(fi.otavanopisto.muikku.ui.AbstractUITest)

Example 9 with Workspace

use of fi.otavanopisto.muikku.atests.Workspace in project muikku by otavanopisto.

the class CourseTestsBase method courseJournalButtonTest.

@Test
public void courseJournalButtonTest() throws Exception {
    loginAdmin();
    Workspace workspace = createWorkspace("testcourse", "test course for testing", "1", Boolean.TRUE);
    try {
        navigate(String.format("/workspace/%s", workspace.getUrlName()), true);
        waitForElementToBePresent(By.className("workspace-title"));
        boolean elementExists = getWebDriver().findElements(By.cssSelector("a.icon-journal")).size() > 0;
        WireMock.reset();
        assertTrue(elementExists);
    } finally {
        WireMock.reset();
        deleteWorkspace(workspace.getId());
    }
}
Also used : Workspace(fi.otavanopisto.muikku.atests.Workspace) Test(org.junit.Test) AbstractUITest(fi.otavanopisto.muikku.ui.AbstractUITest)

Example 10 with Workspace

use of fi.otavanopisto.muikku.atests.Workspace in project muikku by otavanopisto.

the class CourseTestsBase method courseGuideButtonExistsTest.

@Test
public void courseGuideButtonExistsTest() throws Exception {
    loginAdmin();
    Workspace workspace = createWorkspace("testcourse", "test course for testing", "1", Boolean.TRUE);
    try {
        navigate(String.format("/workspace/%s", workspace.getUrlName()), true);
        waitForElementToBePresent(By.cssSelector("#workspaceNavigationWrapper"));
        boolean elementExists = getWebDriver().findElements(By.cssSelector("a.icon-guides")).size() > 0;
        assertTrue(elementExists);
    } finally {
        WireMock.reset();
        deleteWorkspace(workspace.getId());
    }
}
Also used : Workspace(fi.otavanopisto.muikku.atests.Workspace) Test(org.junit.Test) AbstractUITest(fi.otavanopisto.muikku.ui.AbstractUITest)

Aggregations

Workspace (fi.otavanopisto.muikku.atests.Workspace)95 AbstractUITest (fi.otavanopisto.muikku.ui.AbstractUITest)92 Test (org.junit.Test)92 Builder (fi.otavanopisto.muikku.mock.PyramusMock.Builder)67 MockStaffMember (fi.otavanopisto.muikku.mock.model.MockStaffMember)67 TestEnvironments (fi.otavanopisto.muikku.TestEnvironments)58 MockStudent (fi.otavanopisto.muikku.mock.model.MockStudent)46 WorkspaceFolder (fi.otavanopisto.muikku.atests.WorkspaceFolder)37 WorkspaceHtmlMaterial (fi.otavanopisto.muikku.atests.WorkspaceHtmlMaterial)37 MockCourseStudent (fi.otavanopisto.muikku.mock.model.MockCourseStudent)34 CourseStaffMember (fi.otavanopisto.pyramus.rest.model.CourseStaffMember)18 OffsetDateTime (java.time.OffsetDateTime)11 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)7 JSR310Module (com.fasterxml.jackson.datatype.jsr310.JSR310Module)7 MockCourse (fi.otavanopisto.muikku.mock.model.MockCourse)7 Discussion (fi.otavanopisto.muikku.atests.Discussion)5 DiscussionGroup (fi.otavanopisto.muikku.atests.DiscussionGroup)5 File (java.io.File)5 DiscussionThread (fi.otavanopisto.muikku.atests.DiscussionThread)3 Course (fi.otavanopisto.pyramus.rest.model.Course)3