Search in sources :

Example 16 with IgnoreBrowser

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

the class InvitationTest method testPreviewMessage.

@Test
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146")
public void testPreviewMessage() {
    InvitationMessageDisplayElement preview = getSenderPage().preview();
    Assert.assertTrue(preview.getSubjectLine().contains("has invited you to join"));
    Assert.assertTrue(preview.getMessageBody().contains("If this message looks like abuse of our system"));
    Assert.assertTrue(preview.getValidRecipients().get(0).getText().contains("user@localhost.localdomain"));
}
Also used : InvitationMessageDisplayElement(org.xwiki.invitation.test.po.InvitationMessageDisplayElement) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test) IgnoreBrowser(org.xwiki.test.ui.browser.IgnoreBrowser)

Example 17 with IgnoreBrowser

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

the class AddRemoveTagsTest method testCancelAddTag.

/**
 * Open the add tag panel, cancel then open again the add tag panel and add a new tag.
 */
@Test
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177")
public void testCancelAddTag() {
    String firstTag = RandomStringUtils.randomAlphanumeric(4);
    Assert.assertFalse(taggablePage.hasTag(firstTag));
    AddTagsPane addTagsPane = taggablePage.addTags();
    addTagsPane.setTags(firstTag);
    addTagsPane.cancel();
    String secondTag = RandomStringUtils.randomAlphanumeric(4);
    Assert.assertFalse(taggablePage.hasTag(secondTag));
    addTagsPane = taggablePage.addTags();
    addTagsPane.setTags(secondTag);
    Assert.assertTrue(addTagsPane.add());
    Assert.assertTrue(taggablePage.hasTag(secondTag));
    Assert.assertFalse(taggablePage.hasTag(firstTag));
}
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 18 with IgnoreBrowser

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

the class EditObjectsTest method testChangeListMultipleSelect.

/**
 * Prove that a list can be changed from relational storage to plain storage and back without database corruption.
 * XWIKI-299 test
 */
@Test
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146")
public void testChangeListMultipleSelect() {
    // Create class page
    WikiEditPage wep = WikiEditPage.gotoPage("Test", "EditObjectsTestClass");
    wep.setContent("this is the content");
    ViewPage vp = wep.clickSaveAndView();
    // Add class
    ClassEditPage cep = vp.editClass();
    cep.addProperty("prop", "StaticList");
    StaticListClassEditElement slcee = cep.getStaticListClassEditElement("prop");
    slcee.setMultiSelect(false);
    slcee.setValues("choice 1|choice 2|choice 3|choice 4|choice 5");
    vp = cep.clickSaveAndView();
    Assert.assertEquals("this is the content", vp.getContent());
    // Create object page
    wep = WikiEditPage.gotoPage("Test", "EditObjectsTestObject");
    wep.setContent("this is the content: {{velocity}}$doc.display('prop'){{/velocity}}");
    vp = wep.clickSaveAndView();
    // Add object
    ObjectEditPage oep = vp.editObjects();
    FormElement objectForm = oep.addObject("Test.EditObjectsTestClass");
    objectForm.setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "choice 3");
    vp = oep.clickSaveAndView();
    Assert.assertEquals("this is the content: choice 3", vp.getContent());
    // Change list to a multiple select.
    cep = ClassEditPage.gotoPage("Test", "EditObjectsTestClass");
    cep.getStaticListClassEditElement("prop").setMultiSelect(true);
    vp = cep.clickSaveAndView();
    Assert.assertEquals("this is the content", vp.getContent());
    // Verify conversion
    oep = ObjectEditPage.gotoPage("Test", "EditObjectsTestObject");
    oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "choice 3");
    oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "choice 4");
    vp = oep.clickSaveAndView();
    Assert.assertEquals("this is the content: choice 3 choice 4", vp.getContent());
}
Also used : ClassEditPage(org.xwiki.test.ui.po.editor.ClassEditPage) StaticListClassEditElement(org.xwiki.test.ui.po.editor.StaticListClassEditElement) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) ViewPage(org.xwiki.test.ui.po.ViewPage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) FormElement(org.xwiki.test.ui.po.FormElement) Test(org.junit.Test) IgnoreBrowser(org.xwiki.test.ui.browser.IgnoreBrowser)

Example 19 with IgnoreBrowser

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

the class EditObjectsTest method testChangeListTypeRelationalStorage.

/**
 * Prove that a list can be changed from relational storage to plain storage and back without database corruption.
 * XWIKI-1621: Changing parameters of list properties fails
 */
@Test
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146")
public void testChangeListTypeRelationalStorage() {
    // Create class page
    WikiEditPage wep = WikiEditPage.gotoPage("Test", "EditObjectsTestClass");
    wep.setContent("this is the content");
    ViewPage vp = wep.clickSaveAndView();
    // Add class
    ClassEditPage cep = vp.editClass();
    cep.addProperty("prop", "StaticList");
    StaticListClassEditElement slcee = cep.getStaticListClassEditElement("prop");
    slcee.setMultiSelect(true);
    slcee.setDisplayType(StaticListClassEditElement.DisplayType.INPUT);
    vp = cep.clickSaveAndView();
    Assert.assertEquals("this is the content", vp.getContent());
    // Create object page
    wep = WikiEditPage.gotoPage("Test", "EditObjectsTestObject");
    wep.setContent("this is the content: {{velocity}}$doc.display('prop'){{/velocity}}");
    vp = wep.clickSaveAndView();
    // Add object
    ObjectEditPage oep = vp.editObjects();
    FormElement objectForm = oep.addObject("Test.EditObjectsTestClass");
    objectForm.setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "this|that|other");
    vp = oep.clickSaveAndView();
    Assert.assertEquals("this is the content: this that other", vp.getContent());
    // Change list to relational storage.
    cep = ClassEditPage.gotoPage("Test", "EditObjectsTestClass");
    cep.getStaticListClassEditElement("prop").setRelationalStorage(true);
    vp = cep.clickSaveAndView();
    Assert.assertEquals("this is the content", vp.getContent());
    // Make sure we can still edit the object.
    oep = ObjectEditPage.gotoPage("Test", "EditObjectsTestObject");
    oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "this|other");
    vp = oep.clickSaveAndView();
    Assert.assertEquals("this is the content: this other", vp.getContent());
    // Change list to non-relational storage.
    cep = ClassEditPage.gotoPage("Test", "EditObjectsTestClass");
    cep.getStaticListClassEditElement("prop").setRelationalStorage(false);
    vp = cep.clickSaveAndView();
    Assert.assertEquals("this is the content", vp.getContent());
    // Make sure we can still edit the object.
    oep = ObjectEditPage.gotoPage("Test", "EditObjectsTestObject");
    oep.getObjectsOfClass("Test.EditObjectsTestClass").get(0).setFieldValue(By.id("Test.EditObjectsTestClass_0_prop"), "that|other");
    vp = oep.clickSaveAndView();
    Assert.assertEquals("this is the content: that other", vp.getContent());
}
Also used : ClassEditPage(org.xwiki.test.ui.po.editor.ClassEditPage) StaticListClassEditElement(org.xwiki.test.ui.po.editor.StaticListClassEditElement) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) ViewPage(org.xwiki.test.ui.po.ViewPage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) FormElement(org.xwiki.test.ui.po.FormElement) Test(org.junit.Test) IgnoreBrowser(org.xwiki.test.ui.browser.IgnoreBrowser)

Example 20 with IgnoreBrowser

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

the class LanguageTest method testChangeLanguageInMonolingualModeUsingTheAdministrationPreference.

@Test
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146")
public void testChangeLanguageInMonolingualModeUsingTheAdministrationPreference() {
    WikiEditPage edit = WikiEditPage.gotoPage("Test", "LanguageTest");
    edit.setContent("{{velocity}}context = ($xcontext.language), doc = ($doc.language), " + "default = ($doc.defaultLanguage), tdoc = ($tdoc.language), " + "tdocdefault = ($tdoc.defaultLanguage){{/velocity}}");
    ViewPage vp = edit.clickSaveAndView();
    // Current language must be "en"
    Assert.assertEquals("Invalid content", vp.getContent(), "context = (en), doc = (), default = (en), tdoc = (), tdocdefault = (en)");
    // Change default language to "fr"
    AdministrationPage adminPage = AdministrationPage.gotoPage();
    LocalizationAdministrationSectionPage sectionPage = adminPage.clickLocalizationSection();
    sectionPage.setDefaultLanguage("fr");
    sectionPage.clickSave();
    // Now language must be "fr"
    vp = getUtil().gotoPage("Test", "LanguageTest");
    Assert.assertTrue("Page not in French!", isPageInFrench());
    Assert.assertEquals("Invalid content", vp.getContent(), "context = (fr), doc = (), default = (en), tdoc = (), tdocdefault = (en)");
}
Also used : LocalizationAdministrationSectionPage(org.xwiki.administration.test.po.LocalizationAdministrationSectionPage) AdministrationPage(org.xwiki.administration.test.po.AdministrationPage) ViewPage(org.xwiki.test.ui.po.ViewPage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) 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