Search in sources :

Example 41 with IgnoreBrowsers

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

the class CreatePageIT method createPageWithSaveAndEditTemplate.

/**
 * Tests the creation of a page from a save and edit template, tests that the page is indeed saved.
 */
@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 createPageWithSaveAndEditTemplate() throws Exception {
    // Cleanup of the test space for any leftovers from previous tests.
    getUtil().deleteSpace(getTestClassName());
    // Create a template
    String templateProviderName = TEMPLATE_NAME + "Provider";
    String templateContent = "Templates are fun";
    String templateTitle = "Funny templates";
    String templateProviderFullName = getTestClassName() + "." + templateProviderName;
    ViewPage templatePage = createTemplateAndTemplateProvider(templateProviderName, templateContent, templateTitle, true);
    // create the page
    CreatePagePage createPage = templatePage.createPage();
    createPage.getDocumentPicker().toggleLocationAdvancedEdit();
    EditPage editCreatedPage = createPage.createPageFromTemplate(getTestClassName(), "NewPage", templateProviderFullName);
    // and now cancel it
    ViewPage newPage = editCreatedPage.clickCancel();
    // make sure we're not in unexisting page
    assertTrue(newPage.exists());
    // we should be in view mode (useless check since the impl of isNonExisting page calls it anyway)
    assertTrue(getUtil().isInViewMode());
    // make sure it's the page we want
    assertEquals(getTestClassName() + ".NewPage", newPage.getMetaDataValue("space"));
    assertEquals("WebHome", newPage.getMetaDataValue("page"));
    // and now test the title is the name of the page and the content is the one from the template
    assertEquals("NewPage", newPage.getDocumentTitle());
    assertEquals(templateContent, newPage.getContent());
    // and the parent, it should be the template provider, since that's where we created it from
    assertEquals("/" + getTestClassName() + "/NewPage", newPage.getBreadcrumbContent());
}
Also used : CreatePagePage(org.xwiki.test.ui.po.CreatePagePage) ViewPage(org.xwiki.test.ui.po.ViewPage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) EditPage(org.xwiki.test.ui.po.editor.EditPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 42 with IgnoreBrowsers

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

the class ImportIT method testImportWithHistory.

@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 testImportWithHistory() {
    URL fileUrl = this.getClass().getResource("/" + PACKAGE_WITH_HISTORY);
    this.sectionPage.attachPackage(fileUrl);
    this.sectionPage.selectPackage(PACKAGE_WITH_HISTORY);
    this.sectionPage.selectReplaceHistoryOption();
    this.sectionPage.importPackage();
    ViewPage importedPage = this.sectionPage.clickImportedPage("Main.TestPage");
    // Since the page by default opens the comments pane, if we instantly click on the history, the two tabs
    // will race for completion. Let's wait for comments first.
    importedPage.openCommentsDocExtraPane();
    HistoryPane history = importedPage.openHistoryDocExtraPane();
    Assert.assertEquals("3.1", history.getCurrentVersion());
    Assert.assertEquals("A third version of the document", history.getCurrentVersionComment());
    Assert.assertTrue(history.hasVersionWithSummary("A new version of the document"));
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) URL(java.net.URL) HistoryPane(org.xwiki.test.ui.po.HistoryPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 43 with IgnoreBrowsers

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

the class ImportIT method testImportWithNewHistoryVersion.

@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 testImportWithNewHistoryVersion() {
    URL fileUrl = this.getClass().getResource("/" + PACKAGE_WITHOUT_HISTORY);
    this.sectionPage.attachPackage(fileUrl);
    this.sectionPage.selectPackage(PACKAGE_WITHOUT_HISTORY);
    this.sectionPage.importPackage();
    ViewPage importedPage = this.sectionPage.clickImportedPage("Main.TestPage");
    // Since the page by default opens the comments pane, if we instantly click on the history, the two tabs
    // will race for completion. Let's wait for comments first.
    importedPage.openCommentsDocExtraPane();
    HistoryPane history = importedPage.openHistoryDocExtraPane();
    Assert.assertEquals("1.1", history.getCurrentVersion());
    Assert.assertEquals("Imported from XAR", history.getCurrentVersionComment());
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) URL(java.net.URL) HistoryPane(org.xwiki.test.ui.po.HistoryPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 44 with IgnoreBrowsers

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

the class BreadcrumbsTest method verifyBreadcrumbInParentChildMode.

@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 verifyBreadcrumbInParentChildMode() {
    // Delete the page to reset the rights on it (since the test below modifies them).
    getUtil().deletePage(getTestClassName(), getTestMethodName());
    getUtil().setHierarchyMode("parentchild");
    String parentPageName = getTestMethodName() + "ParentPage";
    String parentPageFullName = getTestClassName() + "." + parentPageName;
    getUtil().createPage(getTestClassName(), parentPageName, null, PARENT_TITLE);
    ViewPage vp = getUtil().createPage(getTestClassName(), getTestMethodName(), null, CHILD_TITLE, null, parentPageFullName);
    // Verify standard breadcrumb behavior.
    assertTrue(vp.hasBreadcrumbContent(PARENT_TITLE, false));
    assertTrue(vp.hasBreadcrumbContent(CHILD_TITLE, true));
    // Remove view rights on the Test.ParentPage page to everyone except superadmin user so that we can verify
    // that the breadcrumb of the child page doesn't display page titles for pages for which you don't have view
    // rights.
    getUtil().addObject(getTestClassName(), parentPageName, "XWiki.XWikiRights", "levels", "view", "users", "XWiki.superadmin", "allow", "1");
    // Log out...
    getUtil().forceGuestUser();
    // Verify breadcrumb doesn't display page title for the parent page (since the guest user doesn't have view
    // permission for it).
    vp = getUtil().gotoPage(getTestClassName(), getTestMethodName());
    assertFalse(vp.isAuthenticated());
    assertFalse(vp.hasBreadcrumbContent(PARENT_TITLE, false, true));
    assertTrue(vp.hasBreadcrumbContent(CHILD_TITLE, true, true));
    assertTrue(vp.hasBreadcrumbContent(parentPageName, false, false));
    // Set back the default hierarchy mode (but first we need to log back).
    adminAuthenticationRule.authenticate();
    getUtil().setHierarchyMode("reference");
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 45 with IgnoreBrowsers

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

the class UserProfileTest method testChangeDefaultEditor.

/**
 * Functionality check: changing the default editor.
 */
@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 testChangeDefaultEditor() {
    PreferencesUserProfilePage preferencesPage = this.customProfilePage.switchToPreferences();
    // Setting to Text Editor
    PreferencesEditPage preferencesEditPage = preferencesPage.editPreferences();
    preferencesEditPage.setDefaultEditorText();
    preferencesEditPage.clickSaveAndView();
    preferencesPage = this.customProfilePage.switchToPreferences();
    Assert.assertEquals(TEXT_EDITOR, preferencesPage.getDefaultEditor());
    // Setting to WYSIWYG Editor
    this.customProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
    preferencesPage = this.customProfilePage.switchToPreferences();
    preferencesEditPage = preferencesPage.editPreferences();
    preferencesEditPage.setDefaultEditorWysiwyg();
    preferencesEditPage.clickSaveAndView();
    preferencesPage = this.customProfilePage.switchToPreferences();
    Assert.assertEquals(WYSIWYG_EDITOR, preferencesPage.getDefaultEditor());
    // Setting to Default Editor
    this.customProfilePage = ProfileUserProfilePage.gotoPage(this.userName);
    preferencesPage = this.customProfilePage.switchToPreferences();
    preferencesEditPage = preferencesPage.editPreferences();
    preferencesEditPage.setDefaultEditorDefault();
    preferencesEditPage.clickSaveAndView();
    preferencesPage = this.customProfilePage.switchToPreferences();
    Assert.assertEquals(DEFAULT_EDITOR, preferencesPage.getDefaultEditor());
}
Also used : PreferencesEditPage(org.xwiki.user.test.po.PreferencesEditPage) PreferencesUserProfilePage(org.xwiki.user.test.po.PreferencesUserProfilePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

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