Search in sources :

Example 6 with DiscussionThread

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

the class CourseDiscussionTestsBase method courseDiscussionReplyReplyTest.

@Test
@TestEnvironments(browsers = { TestEnvironments.Browser.CHROME, TestEnvironments.Browser.FIREFOX, TestEnvironments.Browser.INTERNET_EXPLORER, TestEnvironments.Browser.EDGE, TestEnvironments.Browser.SAFARI })
public void courseDiscussionReplyReplyTest() throws Exception {
    loginAdmin();
    try {
        Workspace workspace = createWorkspace("testcourse", "test course for testing", "1", Boolean.TRUE);
        try {
            DiscussionGroup discussionGroup = createWorkspaceDiscussionGroup(workspace.getId(), "test group");
            try {
                Discussion discussion = createWorkspaceDiscussion(workspace.getId(), discussionGroup.getId(), "test discussion");
                try {
                    DiscussionThread thread = createWorkspaceDiscussionThread(workspace.getId(), discussionGroup.getId(), discussion.getId(), "Testing", "<p>Testing testing daa daa</p>", false, false);
                    try {
                        navigate(String.format("/workspace/%s/discussions", workspace.getName()), true);
                        waitAndClick(".di-message-meta-topic>span");
                        waitAndClick(".di-message-reply-link");
                        addTextToCKEditor("Test reply for test.");
                        waitForPresent("*[name='send']");
                        click("*[name='send']");
                        waitForPresent(".di-replies-container .mf-item-content-text p");
                        waitAndClick(".di-replies-page .di-reply-answer-link>span");
                        addTextToCKEditor("Test reply reply for test.");
                        waitForPresent("*[name='send']");
                        click("*[name='send']");
                        waitForPresent(".di-replies-container .di-reply-reply .mf-item-content-text p");
                        assertText(".di-replies-container .di-reply-reply .mf-item-content-text p", "Test reply reply for test.");
                    } finally {
                        deleteWorkspaceDiscussionThread(workspace.getId(), discussionGroup.getId(), discussion.getId(), thread.getId());
                    }
                } finally {
                    deleteWorkspaceDiscussion(workspace.getId(), discussionGroup.getId(), discussion.getId());
                }
            } finally {
                deleteWorkspaceDiscussionGroup(workspace.getId(), discussionGroup.getId());
            }
        } finally {
            deleteWorkspace(workspace.getId());
        }
    } finally {
        WireMock.reset();
    }
}
Also used : DiscussionGroup(fi.otavanopisto.muikku.atests.DiscussionGroup) Discussion(fi.otavanopisto.muikku.atests.Discussion) DiscussionThread(fi.otavanopisto.muikku.atests.DiscussionThread) Workspace(fi.otavanopisto.muikku.atests.Workspace) Test(org.junit.Test) AbstractUITest(fi.otavanopisto.muikku.ui.AbstractUITest) TestEnvironments(fi.otavanopisto.muikku.TestEnvironments)

Example 7 with DiscussionThread

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

the class DiscussionTestsBase method discussionReplyReplyTest.

@Test
@TestEnvironments(browsers = { TestEnvironments.Browser.CHROME, TestEnvironments.Browser.FIREFOX, TestEnvironments.Browser.INTERNET_EXPLORER, TestEnvironments.Browser.EDGE, TestEnvironments.Browser.SAFARI })
public void discussionReplyReplyTest() throws Exception {
    loginAdmin();
    DiscussionGroup discussionGroup = createDiscussionGroup("test group");
    try {
        Discussion discussion = createDiscussion(discussionGroup.getId(), "test discussion");
        try {
            DiscussionThread thread = createDiscussionThread(discussionGroup.getId(), discussion.getId(), "Testing", "<p>Testing testing daa daa</p>", false, false);
            try {
                navigate("/discussion", true);
                waitAndClick(".di-message-meta-topic>span");
                waitAndClick(".di-message-reply-link");
                addTextToCKEditor("Test reply for test.");
                click("*[name='send']");
                waitForPresent(".di-replies-container .mf-item-content-text p");
                waitAndClick(".di-replies-page .di-reply-answer-link>span");
                addTextToCKEditor("Test reply reply for test.");
                click("*[name='send']");
                waitForPresent(".di-replies-container .di-reply-reply .mf-item-content-text p");
                assertText(".di-replies-container .di-reply-reply .mf-item-content-text p", "Test reply reply for test.");
            } catch (Exception e) {
                deleteDiscussionThread(discussionGroup.getId(), discussion.getId(), thread.getId());
            } finally {
                deleteDiscussionThread(discussionGroup.getId(), discussion.getId(), thread.getId());
            }
        } finally {
            deleteDiscussion(discussionGroup.getId(), discussion.getId());
        }
    } finally {
        deleteDiscussionGroup(discussionGroup.getId());
        WireMock.reset();
    }
}
Also used : DiscussionGroup(fi.otavanopisto.muikku.atests.DiscussionGroup) Discussion(fi.otavanopisto.muikku.atests.Discussion) DiscussionThread(fi.otavanopisto.muikku.atests.DiscussionThread) Test(org.junit.Test) AbstractUITest(fi.otavanopisto.muikku.ui.AbstractUITest) TestEnvironments(fi.otavanopisto.muikku.TestEnvironments)

Example 8 with DiscussionThread

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

the class DiscussionTestsBase method discussionDeleteThreadTest.

@Test
@TestEnvironments(browsers = { TestEnvironments.Browser.CHROME, TestEnvironments.Browser.FIREFOX, TestEnvironments.Browser.INTERNET_EXPLORER, TestEnvironments.Browser.EDGE, TestEnvironments.Browser.SAFARI })
public void discussionDeleteThreadTest() throws Exception {
    loginAdmin();
    DiscussionGroup discussionGroup = createDiscussionGroup("test group");
    try {
        Discussion discussion = createDiscussion(discussionGroup.getId(), "test discussion");
        DiscussionThread thread = createDiscussionThread(discussionGroup.getId(), discussion.getId(), "Testing", "<p>Testing testing daa daa</p>", false, false);
        try {
            navigate("/discussion", true);
            waitAndClick(".di-message-meta-topic>span");
            waitAndClick(".di-remove-thread-link");
            waitAndClick(".delete-button>span");
            waitForPresent(".mf-content-empty>h3");
            assertNotPresent(".di-threads .di-message");
        } catch (Exception e) {
            deleteDiscussionThread(discussionGroup.getId(), discussion.getId(), thread.getId());
        } finally {
            deleteDiscussion(discussionGroup.getId(), discussion.getId());
        }
    } finally {
        deleteDiscussionGroup(discussionGroup.getId());
        WireMock.reset();
    }
}
Also used : DiscussionGroup(fi.otavanopisto.muikku.atests.DiscussionGroup) Discussion(fi.otavanopisto.muikku.atests.Discussion) DiscussionThread(fi.otavanopisto.muikku.atests.DiscussionThread) Test(org.junit.Test) AbstractUITest(fi.otavanopisto.muikku.ui.AbstractUITest) TestEnvironments(fi.otavanopisto.muikku.TestEnvironments)

Aggregations

DiscussionThread (fi.otavanopisto.muikku.atests.DiscussionThread)8 TestEnvironments (fi.otavanopisto.muikku.TestEnvironments)6 Discussion (fi.otavanopisto.muikku.atests.Discussion)6 DiscussionGroup (fi.otavanopisto.muikku.atests.DiscussionGroup)6 AbstractUITest (fi.otavanopisto.muikku.ui.AbstractUITest)6 Test (org.junit.Test)6 Workspace (fi.otavanopisto.muikku.atests.Workspace)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 JSR310Module (com.fasterxml.jackson.datatype.jsr310.JSR310Module)2 Response (com.jayway.restassured.response.Response)2