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();
}
}
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));
}
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));
}
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));
}
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));
}
Aggregations