Search in sources :

Example 21 with IgnoreBrowsers

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

the class InvitationTest method testCancelInvitation.

/**
 * This test proves that:
 * 1. A user can cancel an invitation after sending it, leaving a message for the recipient should they try to
 *    accept.
 * 2. A canceled invitation cannot be accepted and the guest will see an explaination with the message left when
 *    the sender canceled.
 * 3. A canceled invitation cannot be declined, the guest gets the sender's note.
 * 4. A canceled invitation can still be reported as spam.
 */
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testCancelInvitation() throws Exception {
    TestUtils.Session admin = getUtil().getSession();
    try {
        startGreenMail();
        getSenderPage().send();
        getGreenMail().waitForIncomingEmail(10000, 1);
        MimeMessage[] messages = getGreenMail().getReceivedMessages();
        String htmlMessage = getMessageContent(messages[0]).get("htmlPart");
        Assert.assertTrue("New invitation is not listed as pending in the footer.", getSenderPage().getFooter().myPendingInvitations() == 1);
        InspectInvitationsPage.OneMessage message = getSenderPage().getFooter().inspectMyInvitations().getMessageWhere("Subject", "Admin has invited you to join localhost This is a subject line.");
        InvitationActionConfirmationElement confirm = message.cancel();
        Assert.assertEquals("leave a message in case the invitee(s) try to register.", confirm.getLabel().toLowerCase());
        confirm.setMemo("Sorry, wrong email address.");
        Assert.assertEquals("Invitation successfully rescinded.", confirm.confirm());
        // Now switch to guest.
        getUtil().forceGuestUser();
        String commonPart = "\nAdministrator left you this message when rescinding the invitation.\n" + "Sorry, wrong email address.";
        // Prove that invitation cannot be accepted
        InvitationGuestActionsPage guestPage = InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.ACCEPT);
        Assert.assertFalse("Guest was able to accept a message which had been canceled.", guestPage.getMessage().equals(""));
        Assert.assertEquals("We're sorry but this invitation has been rescinded." + commonPart, guestPage.getMessage());
        // Prove that invitation cannot be declined
        guestPage = InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.DECLINE);
        Assert.assertFalse("Guest was able to decline a message which had been canceled.", guestPage.getMessage().equals(""));
        Assert.assertEquals("This invitation has been rescinded and thus cannot be declined." + commonPart, guestPage.getMessage());
        // Prove that the message report spam page still shows up.
        guestPage = InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.REPORT);
        Assert.assertTrue("Guest was not able to report canceled invitation as spam", guestPage.getMessage().equals(""));
        guestPage.setMemo("Canceled message is spam.");
        Assert.assertEquals("Your report has been logged and the situation will " + "be investigated as soon as possible, we apologize for the inconvenience.", guestPage.confirm());
    } finally {
        stopGreenMail();
        getUtil().setSession(admin);
    }
}
Also used : InvitationGuestActionsPage(org.xwiki.invitation.test.po.InvitationGuestActionsPage) TestUtils(org.xwiki.test.ui.TestUtils) InspectInvitationsPage(org.xwiki.invitation.test.po.InspectInvitationsPage) MimeMessage(javax.mail.internet.MimeMessage) InvitationActionConfirmationElement(org.xwiki.invitation.test.po.InvitationActionConfirmationElement) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 22 with IgnoreBrowsers

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

the class AddRemoveTagsTest method testAddManyRemoveOneTag.

/**
 * Add many tags and remove one of them.
 */
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testAddManyRemoveOneTag() {
    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));
    Assert.assertTrue(taggablePage.removeTag(firstTag));
    Assert.assertTrue(taggablePage.hasTag(secondTag));
}
Also used : AddTagsPane(org.xwiki.tag.test.po.AddTagsPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 23 with IgnoreBrowsers

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

the class AddRemoveTagsTest method testAddExistingTag.

/**
 * Tests that a tag can't be added twice to the same page.
 */
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testAddExistingTag() {
    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));
    addTagsPane = taggablePage.addTags();
    addTagsPane.setTags(tag);
    Assert.assertFalse(addTagsPane.add());
    addTagsPane.cancel();
}
Also used : AddTagsPane(org.xwiki.tag.test.po.AddTagsPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 24 with IgnoreBrowsers

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

the class AddRemoveTagsTest method addAndRenameTagFromTagPage.

@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void addAndRenameTagFromTagPage() {
    String tag = "MyTag";
    AddTagsPane addTagsPane = taggablePage.addTags();
    addTagsPane.setTags(tag);
    Assert.assertTrue(addTagsPane.add());
    Assert.assertTrue(taggablePage.hasTag(tag));
    tagPage = taggablePage.clickOnTag(tag);
    tagPage.clickRenameButton();
    tagPage.setNewTagName("MyTagRenamed");
    tagPage.clickConfirmRenameTagButton();
    Assert.assertTrue(tagPage.hasTagHighlight("MyTagRenamed"));
}
Also used : AddTagsPane(org.xwiki.tag.test.po.AddTagsPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 25 with IgnoreBrowsers

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

the class AddRemoveTagsTest method addAndDeleteTagFromTagPage.

@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void addAndDeleteTagFromTagPage() {
    String tag = "MyTagToBeDeleted";
    AddTagsPane addTagsPane = taggablePage.addTags();
    addTagsPane.setTags(tag);
    Assert.assertTrue(addTagsPane.add());
    Assert.assertTrue(taggablePage.hasTag(tag));
    tagPage = taggablePage.clickOnTag(tag);
    tagPage.clickDeleteButton();
    tagPage.clickConfirmDeleteTag();
    Assert.assertTrue(tagPage.hasConfirmationMessage(tag));
}
Also used : AddTagsPane(org.xwiki.tag.test.po.AddTagsPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Aggregations

IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)80 Test (org.junit.Test)76 AbstractTest (org.xwiki.test.ui.AbstractTest)43 ViewPage (org.xwiki.test.ui.po.ViewPage)26 ClassFieldEditPane (org.xwiki.appwithinminutes.test.po.ClassFieldEditPane)12 LongTextClassFieldEditPane (org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane)11 ApplicationClassEditPage (org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage)10 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)9 MimeMessage (javax.mail.internet.MimeMessage)7 TestUtils (org.xwiki.test.ui.TestUtils)6 HistoryPane (org.xwiki.test.ui.po.HistoryPane)6 LiveTableElement (org.xwiki.test.ui.po.LiveTableElement)6 LoginPage (org.xwiki.test.ui.po.LoginPage)6 PreferencesUserProfilePage (org.xwiki.user.test.po.PreferencesUserProfilePage)6 ApplicationHomePage (org.xwiki.appwithinminutes.test.po.ApplicationHomePage)5 EntryEditPage (org.xwiki.appwithinminutes.test.po.EntryEditPage)5 InvitationGuestActionsPage (org.xwiki.invitation.test.po.InvitationGuestActionsPage)5 ChangePasswordPage (org.xwiki.user.test.po.ChangePasswordPage)5 URL (java.net.URL)4 WebElement (org.openqa.selenium.WebElement)4