Search in sources :

Example 6 with IgnoreBrowser

use of org.xwiki.test.ui.browser.IgnoreBrowser in project xwiki-platform by xwiki.

the class InvitationTest method testSendMailToTwoAddresses.

@Test
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146")
public void testSendMailToTwoAddresses() throws Exception {
    try {
        startGreenMail();
        getSenderPage().fillForm("user@localhost.localdomain anotheruser@localhost.localdomain", null, null);
        InvitationSenderPage.InvitationSentPage sent = getSenderPage().send();
        getGreenMail().waitForIncomingEmail(10000, 2);
        MimeMessage[] messages = getGreenMail().getReceivedMessages();
        Assert.assertTrue("wrong number of messages", messages.length == 2);
        // Correspond to messages a and b
        int a = 1, b = 2;
        Map<String, String> messageA = getMessageContent(messages[0]);
        Map<String, String> messageB = getMessageContent(messages[1]);
        Assert.assertFalse("Both messages are going to the same recipient", messageA.get("recipient").equals(messageB.get("recipient")));
        // No guarentee which message will come in first.
        if (messageA.get("recipient").contains("anotheruser@localhost.localdomain")) {
            Map<String, String> temp = messageB;
            messageB = messageA;
            messageA = temp;
            b = 1;
            a = 2;
        }
        Assert.assertTrue("Wrong recipient name.\nExpecting:user@localhost.localdomain\n      Got:" + messageA.get("recipient"), messageA.get("recipient").contains("user@localhost.localdomain"));
        Assert.assertTrue("Wrong recipient name.\nExpecting:anotheruser@localhost.localdomain\n      Got:" + messageB.get("recipient"), messageB.get("recipient").contains("anotheruser@localhost.localdomain"));
        assertMessageValid(messageA);
        assertMessageValid(messageB);
        // Check that the page has the table and the messages.
        Assert.assertTrue(sent.getMessageBoxContent().contains("Your message has been sent."));
        TableElement table = sent.getTable();
        Assert.assertTrue(table.numberOfRows() == 3);
        Assert.assertTrue(table.numberOfColumns() == 3);
        Assert.assertTrue(table.getRow(a).get(1).getText().contains("user@localhost.localdomain"));
        Assert.assertTrue(table.getRow(a).get(2).getText().contains("Pending"));
        Assert.assertTrue(table.getRow(b).get(1).getText().contains("anotheruser@localhost.localdomain"));
        Assert.assertTrue(table.getRow(b).get(2).getText().contains("Pending"));
    } finally {
        stopGreenMail();
    }
}
Also used : MimeMessage(javax.mail.internet.MimeMessage) InvitationSenderPage(org.xwiki.invitation.test.po.InvitationSenderPage) TableElement(org.xwiki.test.ui.po.TableElement) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test) IgnoreBrowser(org.xwiki.test.ui.browser.IgnoreBrowser)

Example 7 with IgnoreBrowser

use of org.xwiki.test.ui.browser.IgnoreBrowser in project xwiki-platform by xwiki.

the class AddRemoveTagsTest method testStripLeadingAndTrailingSpacesFromTags.

/**
 * @see <a href="https://jira.xwiki.org/browse/XWIKI-3843">XWIKI-3843</a>: Strip leading and trailing white
 *      spaces to tags when white space is not the separator
 */
@Test
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177")
public void testStripLeadingAndTrailingSpacesFromTags() {
    String firstTag = RandomStringUtils.randomAlphanumeric(4);
    Assert.assertFalse(taggablePage.hasTag(firstTag));
    String secondTag = RandomStringUtils.randomAlphanumeric(4);
    Assert.assertFalse(taggablePage.hasTag(secondTag));
    AddTagsPane addTagsPane = taggablePage.addTags();
    addTagsPane.setTags("   " + firstTag + " ,  " + secondTag + "    ");
    Assert.assertTrue(addTagsPane.add());
    Assert.assertTrue(taggablePage.hasTag(firstTag));
    Assert.assertTrue(taggablePage.hasTag(secondTag));
}
Also used : AddTagsPane(org.xwiki.tag.test.po.AddTagsPane) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test) IgnoreBrowser(org.xwiki.test.ui.browser.IgnoreBrowser)

Example 8 with IgnoreBrowser

use of org.xwiki.test.ui.browser.IgnoreBrowser in project xwiki-platform by xwiki.

the class AddRemoveTagsTest method testAddTagContainingPipe.

/**
 * Add a tag that contains the pipe character, which is used to separate stored tags.
 */
@Test
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177")
public void testAddTagContainingPipe() {
    String tag = RandomStringUtils.randomAlphanumeric(3) + "|" + RandomStringUtils.randomAlphanumeric(3);
    Assert.assertFalse(taggablePage.hasTag(tag));
    AddTagsPane addTagsPane = taggablePage.addTags();
    addTagsPane.setTags(tag);
    Assert.assertTrue(addTagsPane.add());
    Assert.assertTrue(taggablePage.hasTag(tag));
    // Reload the page and test again.
    getUtil().gotoPage(getTestClassName(), getTestMethodName());
    taggablePage = new TaggablePage();
    Assert.assertTrue(taggablePage.hasTag(tag));
}
Also used : TaggablePage(org.xwiki.tag.test.po.TaggablePage) AddTagsPane(org.xwiki.tag.test.po.AddTagsPane) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test) IgnoreBrowser(org.xwiki.test.ui.browser.IgnoreBrowser)

Example 9 with IgnoreBrowser

use of org.xwiki.test.ui.browser.IgnoreBrowser in project xwiki-platform by xwiki.

the class AddRemoveTagsTest method testTagCaseIsIgnored.

/**
 * @see <a href="https://jira.xwiki.org/browse/XWIKI-6549">XWIKI-6549</a>: Prevent adding new tags that are
 *      equal ignoring case with existing tags
 */
@Test
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177")
public void testTagCaseIsIgnored() {
    String firstTag = "taG1";
    Assert.assertFalse(taggablePage.hasTag(firstTag));
    // Second tag is same as first tag but with different uppercase/lowercase chars.
    String secondTag = "Tag1";
    Assert.assertFalse(taggablePage.hasTag(secondTag));
    String thirdTag = "tag3";
    Assert.assertFalse(taggablePage.hasTag(thirdTag));
    AddTagsPane addTagsPane = taggablePage.addTags();
    addTagsPane.setTags(firstTag + "," + thirdTag + "," + secondTag);
    Assert.assertTrue(addTagsPane.add());
    Assert.assertTrue(taggablePage.hasTag(firstTag));
    Assert.assertFalse(taggablePage.hasTag(secondTag));
    Assert.assertTrue(taggablePage.hasTag(thirdTag));
}
Also used : AddTagsPane(org.xwiki.tag.test.po.AddTagsPane) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test) IgnoreBrowser(org.xwiki.test.ui.browser.IgnoreBrowser)

Example 10 with IgnoreBrowser

use of org.xwiki.test.ui.browser.IgnoreBrowser in project xwiki-platform by xwiki.

the class AddRemoveTagsTest method testAddRemoveTag.

/**
 * Adds and removes a tag.
 */
@Test
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177")
public void testAddRemoveTag() {
    String tag = RandomStringUtils.randomAlphanumeric(4);
    Assert.assertFalse(taggablePage.hasTag(tag));
    AddTagsPane addTagsPane = taggablePage.addTags();
    addTagsPane.setTags(tag);
    Assert.assertTrue(addTagsPane.add());
    Assert.assertTrue(taggablePage.hasTag(tag));
    taggablePage.removeTag(tag);
    Assert.assertFalse(taggablePage.hasTag(tag));
}
Also used : AddTagsPane(org.xwiki.tag.test.po.AddTagsPane) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test) IgnoreBrowser(org.xwiki.test.ui.browser.IgnoreBrowser)

Aggregations

Test (org.junit.Test)22 IgnoreBrowser (org.xwiki.test.ui.browser.IgnoreBrowser)22 AbstractTest (org.xwiki.test.ui.AbstractTest)12 ViewPage (org.xwiki.test.ui.po.ViewPage)10 AddTagsPane (org.xwiki.tag.test.po.AddTagsPane)5 FormElement (org.xwiki.test.ui.po.FormElement)5 ClassEditPage (org.xwiki.test.ui.po.editor.ClassEditPage)5 ObjectEditPage (org.xwiki.test.ui.po.editor.ObjectEditPage)5 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)4 MimeMessage (javax.mail.internet.MimeMessage)3 CopyPage (org.xwiki.index.test.po.CopyPage)2 InvitationSenderPage (org.xwiki.invitation.test.po.InvitationSenderPage)2 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)2 TaggablePage (org.xwiki.tag.test.po.TaggablePage)2 TestUtils (org.xwiki.test.ui.TestUtils)2 CopyOrRenameStatusPage (org.xwiki.test.ui.po.CopyOrRenameStatusPage)2 DocumentPicker (org.xwiki.test.ui.po.DocumentPicker)2 TableElement (org.xwiki.test.ui.po.TableElement)2 StaticListClassEditElement (org.xwiki.test.ui.po.editor.StaticListClassEditElement)2 AdministrationPage (org.xwiki.administration.test.po.AdministrationPage)1