Search in sources :

Example 26 with IgnoreBrowsers

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

the class VersionTest method testRollbackToFirstVersion.

@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 testRollbackToFirstVersion() throws Exception {
    getUtil().rest().deletePage(SPACE_NAME, PAGE_NAME);
    // Create first version of the page
    ViewPage vp = getUtil().createPage(SPACE_NAME, PAGE_NAME, CONTENT1, TITLE);
    // Adds second version
    WikiEditPage wikiEditPage = vp.editWiki();
    wikiEditPage.setContent(CONTENT2);
    wikiEditPage.clickSaveAndView();
    // TODO: Remove when XWIKI-6688 (Possible race condition when clicking on a tab at the bottom of a page in
    // view mode) is fixed.
    vp.waitForDocExtraPaneActive("comments");
    // Verify that we can rollback to the first version
    HistoryPane historyTab = vp.openHistoryDocExtraPane();
    vp = historyTab.rollbackToVersion("1.1");
    // Rollback doesn't wait...
    // Wait for the comment tab to be selected since we're currently on the history tab and rolling
    // back is going to load a new page and make the focus active on the comments tab.
    vp.waitForDocExtraPaneActive("comments");
    Assert.assertEquals("First version of Content", vp.getContent());
    historyTab = vp.openHistoryDocExtraPane();
    Assert.assertEquals("Rollback to version 1.1", historyTab.getCurrentVersionComment());
    Assert.assertEquals("Administrator", historyTab.getCurrentAuthor());
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) HistoryPane(org.xwiki.test.ui.po.HistoryPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 27 with IgnoreBrowsers

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

the class AddEntryTest method testEntryNameWithURLSpecialCharacters.

/**
 * Tests that entry name is URL encoded.
 */
@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 testEntryNameWithURLSpecialCharacters() {
    EntryNamePane entryNamePane = homePage.clickAddNewEntry();
    String entryName = "A?b=c&d#" + RandomStringUtils.randomAlphanumeric(3);
    entryNamePane.setName(entryName);
    EntryEditPage entryEditPage = entryNamePane.clickAdd();
    entryEditPage.setValue("description", "This is a test panel.");
    entryEditPage.clickSaveAndView();
    getUtil().gotoPage(getTestClassName(), getTestMethodName());
    homePage = new ApplicationHomePage();
    LiveTableElement entriesLiveTable = homePage.getEntriesLiveTable();
    entriesLiveTable.waitUntilReady();
    // The column header is not translated because we haven't generated the document translation bundle.
    Assert.assertTrue(entriesLiveTable.hasRow("panel.livetable.doc.title", entryName));
}
Also used : EntryEditPage(org.xwiki.appwithinminutes.test.po.EntryEditPage) LiveTableElement(org.xwiki.test.ui.po.LiveTableElement) EntryNamePane(org.xwiki.appwithinminutes.test.po.EntryNamePane) ApplicationHomePage(org.xwiki.appwithinminutes.test.po.ApplicationHomePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 28 with IgnoreBrowsers

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

the class ApplicationNameTest method testEmptyAppNameWithNextStepButton.

/**
 * Try to create an application with an empty name using the next step button.
 */
@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 testEmptyAppNameWithNextStepButton() {
    ApplicationCreatePage appCreatePage = ApplicationCreatePage.gotoPage();
    Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE));
    // Try to move to the next step without typing the application name.
    String urlBeforeClick = getDriver().getCurrentUrl();
    appCreatePage.clickNextStepButton();
    Assert.assertEquals(urlBeforeClick, getDriver().getCurrentUrl());
    // Type the application name.
    appCreatePage.setApplicationName("A");
    appCreatePage.waitForApplicationNamePreview();
    Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE));
    // Clear the application name using the Backspace key.
    appCreatePage.getApplicationNameInput().sendKeys(Keys.BACK_SPACE);
    appCreatePage.waitForApplicationNameError();
    Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE));
    // Try to create the application even if the error message is displayed.
    urlBeforeClick = getDriver().getCurrentUrl();
    appCreatePage.clickNextStepButton();
    Assert.assertEquals(urlBeforeClick, getDriver().getCurrentUrl());
    // Fix the application name and move to the next step.
    appCreatePage.setApplicationName(getTestMethodName());
    appCreatePage.waitForApplicationNamePreview();
    Assert.assertEquals(getTestMethodName() + " Structure", appCreatePage.clickNextStep().getDocumentTitle());
}
Also used : ApplicationCreatePage(org.xwiki.appwithinminutes.test.po.ApplicationCreatePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 29 with IgnoreBrowsers

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

the class ApplicationNameTest method testEmptyAppNameWithEnter.

/**
 * Try to create an application with an empty name using the Enter key.
 */
@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 testEmptyAppNameWithEnter() {
    ApplicationCreatePage appCreatePage = ApplicationCreatePage.gotoPage();
    Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE));
    // Press Enter key without typing the application name.
    appCreatePage.getApplicationNameInput().sendKeys(Keys.RETURN);
    appCreatePage.waitForApplicationNameError();
    Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE));
    // Type the application name.
    appCreatePage.setApplicationName("B");
    appCreatePage.waitForApplicationNamePreview();
    Assert.assertFalse(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE));
    // Clear the application name using the Backspace key.
    appCreatePage.getApplicationNameInput().sendKeys(Keys.BACK_SPACE);
    appCreatePage.waitForApplicationNameError();
    Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE));
    // Try to create the application even if the error message is displayed.
    appCreatePage.getApplicationNameInput().sendKeys(Keys.RETURN);
    Assert.assertTrue(appCreatePage.getContent().contains(EMPTY_APP_NAME_ERROR_MESSAGE));
    // Fix the application name and move to the next step using the Enter key.
    appCreatePage.setApplicationName(getTestMethodName());
    appCreatePage.waitForApplicationNamePreview();
    appCreatePage.getApplicationNameInput().sendKeys(Keys.RETURN);
    Assert.assertEquals(getTestMethodName() + " Structure", new ViewPage().getDocumentTitle());
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) ApplicationCreatePage(org.xwiki.appwithinminutes.test.po.ApplicationCreatePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 30 with IgnoreBrowsers

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

the class AppsLiveTableTest method testActionRights.

/**
 * Tests that the actions are displayed only when the current user has the right to perform 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 testActionRights() {
    // Create the application.
    String appName = RandomStringUtils.randomAlphabetic(6);
    createApplication(appName);
    // The application author should be able to edit and delete the application.
    ApplicationsLiveTableElement appsLiveTable = homePage.getAppsLiveTable();
    appsLiveTable.waitUntilReady();
    appsLiveTable.filterApplicationName(appName);
    Assert.assertTrue(appsLiveTable.canEditApplication(appName));
    Assert.assertTrue(appsLiveTable.canDeleteApplication(appName));
    // Logout. Guests shouldn't be able to edit nor delete the application.
    homePage.logout();
    getUtil().recacheSecretToken();
    homePage = new AppWithinMinutesHomePage();
    appsLiveTable = homePage.getAppsLiveTable();
    appsLiveTable.waitUntilReady();
    appsLiveTable.filterApplicationName(appName);
    Assert.assertFalse(appsLiveTable.canEditApplication(appName));
    Assert.assertFalse(appsLiveTable.canDeleteApplication(appName));
    // Login with a different user. The new user shouldn't be able to delete the application.
    getUtil().createUserAndLogin("someOtherUser", "somePassword");
    appsLiveTable = AppWithinMinutesHomePage.gotoPage().getAppsLiveTable();
    appsLiveTable.waitUntilReady();
    appsLiveTable.filterApplicationName(appName);
    Assert.assertTrue(appsLiveTable.canEditApplication(appName));
    Assert.assertFalse(appsLiveTable.canDeleteApplication(appName));
}
Also used : AppWithinMinutesHomePage(org.xwiki.appwithinminutes.test.po.AppWithinMinutesHomePage) ApplicationsLiveTableElement(org.xwiki.appwithinminutes.test.po.ApplicationsLiveTableElement) 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