Search in sources :

Example 1 with ShareDialog

use of org.xwiki.sharepage.test.po.ShareDialog in project xwiki-platform by xwiki.

the class SharePageTest method testShareByEmail.

@Test
public void testShareByEmail() throws Exception {
    // Delete any existing test page
    getUtil().deletePage(getTestClassName(), getTestMethodName());
    ViewPage vp = getUtil().createPage(getTestClassName(), getTestMethodName(), "something", "title");
    ShareableViewPage svp = new ShareableViewPage();
    svp.clickShareByEmail();
    ShareDialog sd = new ShareDialog();
    sd.setEmailField("john@doe.com");
    sd.setMessage("test");
    ShareResultDialog srd = sd.sendMail();
    assertEquals("The message has been sent to john.", srd.getResultMessage());
    srd.clickBackLink();
    // Verify we received the email and that its content is valid
    this.mail.waitForIncomingEmail(10000L, 1);
    MimeMessage mimeMessage = this.mail.getReceivedMessages()[0];
    assertEquals("superadmin wants to share a document with you", mimeMessage.getSubject());
}
Also used : ShareResultDialog(org.xwiki.sharepage.test.po.ShareResultDialog) ShareDialog(org.xwiki.sharepage.test.po.ShareDialog) MimeMessage(javax.mail.internet.MimeMessage) ShareableViewPage(org.xwiki.sharepage.test.po.ShareableViewPage) ShareableViewPage(org.xwiki.sharepage.test.po.ShareableViewPage) ViewPage(org.xwiki.test.ui.po.ViewPage) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest) ServerSetupTest(com.icegreen.greenmail.util.ServerSetupTest)

Aggregations

ServerSetupTest (com.icegreen.greenmail.util.ServerSetupTest)1 MimeMessage (javax.mail.internet.MimeMessage)1 Test (org.junit.Test)1 ShareDialog (org.xwiki.sharepage.test.po.ShareDialog)1 ShareResultDialog (org.xwiki.sharepage.test.po.ShareResultDialog)1 ShareableViewPage (org.xwiki.sharepage.test.po.ShareableViewPage)1 AbstractTest (org.xwiki.test.ui.AbstractTest)1 ViewPage (org.xwiki.test.ui.po.ViewPage)1