Search in sources :

Example 61 with IgnoreBrowsers

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

the class EditWikiTest method testSwitchToWysiwygWithAdvancedContent.

/**
 * Tests that the warning about loosing some of the page content when switching to the WYSIWYG editor is not
 * displayed if the page syntax is xwiki/2.0.
 */
@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 testSwitchToWysiwygWithAdvancedContent() {
    // Place some HTML in the page content.
    this.editPage.setContent("{{html}}<hr/>{{/html}}");
    // If we are asked to confirm the editor switch then we choose to remain on the wiki editor.
    getDriver().makeConfirmDialogSilent(false);
    // Switch to WYSIWYG editor.
    WYSIWYGEditPage wysiwygEditPage = this.editPage.editWYSIWYG();
    // Check that we are indeed in WYSIWYG edit mode.
    Assert.assertEquals(Editor.WYSIWYG, wysiwygEditPage.getEditor());
}
Also used : WYSIWYGEditPage(org.xwiki.test.ui.po.editor.WYSIWYGEditPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 62 with IgnoreBrowsers

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

the class KeyboardShortcutsTest method testKeyboardShortcuts.

@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 testKeyboardShortcuts() {
    ViewPage vp = getUtil().gotoPage("Sandbox", "WebHome");
    // Test default edit mode (WYSIWYG for Sandbox.WebHome) key
    vp.sendKeys("e");
    // Test Cancel key
    vp.sendKeys(Keys.chord(Keys.ALT, "c"));
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(getUtil().isInViewMode());
    // Test Wiki edit key
    vp.sendKeys("k");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(getUtil().isInWikiEditMode());
    // Test WYSIWYG edit mode key
    vp = getUtil().gotoPage("Sandbox", "WebHome");
    vp.sendKeys("g");
    // Test Inline Form edit mode key
    vp = getUtil().gotoPage("Sandbox", "WebHome");
    vp.sendKeys("f");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(getUtil().isInInlineEditMode());
    // Test Rights edit mode key on a terminal document
    vp = getUtil().gotoPage("Sandbox", "TestPage1");
    vp.sendKeys("r");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(getUtil().isInRightsEditMode());
    // Test Rights edit mode key on a non terminal document
    vp = getUtil().gotoPage("Sandbox", "WebHome");
    vp.sendKeys("r");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(getUtil().isInAdminMode());
    AdministrationPage administrationPage = new AdministrationPage();
    Assert.assertTrue(administrationPage.hasSection("PageRights"));
    // Test Object edit mode key
    vp = getUtil().gotoPage("Sandbox", "WebHome");
    vp.sendKeys("o");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(getUtil().isInObjectEditMode());
    // Test Class edit mode key
    vp = getUtil().gotoPage("Sandbox", "WebHome");
    vp.sendKeys("s");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(getUtil().isInClassEditMode());
    // Test Delete key
    vp = getUtil().gotoPage("Sandbox", "WebHome");
    vp.sendKeys(Keys.DELETE);
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(getUtil().isInDeleteMode());
    // Test Rename key
    vp = getUtil().gotoPage("Sandbox", "WebHome");
    vp.sendKeys(Keys.F2);
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(getUtil().isInRenameMode());
    // Test View Source key
    vp = getUtil().gotoPage("Sandbox", "WebHome");
    vp.sendKeys("d");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(getUtil().isInSourceViewMode());
}
Also used : AdministrationPage(org.xwiki.administration.test.po.AdministrationPage) ViewPage(org.xwiki.test.ui.po.ViewPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 63 with IgnoreBrowsers

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

the class LoginTest method testRedirectPreservesPOSTParameters.

@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 testRedirectPreservesPOSTParameters() {
    String test = "Test string " + System.currentTimeMillis();
    final String space = "Main";
    final String page = "POSTTest";
    LoginPage loginPage = this.vp.login();
    loginPage.loginAsAdmin();
    // start editing a page
    WikiEditPage editPage = WikiEditPage.gotoPage(space, page);
    editPage.setTitle(test);
    editPage.setContent(test);
    // emulate expired session: delete the cookies
    getDriver().manage().deleteAllCookies();
    // try to save
    editPage.clickSaveAndView();
    // we should have been redirected to login
    String wantUrl = getUtil().getURL("XWiki", "XWikiLogin", "login");
    if (wantUrl.indexOf('?') > 0) {
        // strip parameters
        wantUrl = wantUrl.substring(0, wantUrl.indexOf('?'));
    }
    Assert.assertTrue(getDriver().getCurrentUrl().startsWith(wantUrl));
    loginPage.loginAsAdmin();
    // we should have been redirected back to view, and the page should have been saved
    Assert.assertTrue(getDriver().getCurrentUrl().startsWith(getUtil().getURL(space, page)));
    editPage = WikiEditPage.gotoPage(space, page);
    Assert.assertEquals(test, editPage.getTitle());
    Assert.assertEquals(test, editPage.getContent());
}
Also used : WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) LoginPage(org.xwiki.test.ui.po.LoginPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 64 with IgnoreBrowsers

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

the class LoginTest method testLoginWithInvalidCredentials.

@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 testLoginWithInvalidCredentials() {
    LoginPage loginPage = this.vp.login();
    loginPage.loginAs("Admin", "wrong password");
    Assert.assertTrue(loginPage.hasInvalidCredentialsErrorMessage());
}
Also used : LoginPage(org.xwiki.test.ui.po.LoginPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 65 with IgnoreBrowsers

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

the class VersionTest method testDeleteLatestVersion.

/**
 * See XWIKI-8781
 */
@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 testDeleteLatestVersion() 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 and delete the latest version.
    HistoryPane historyTab = vp.openHistoryDocExtraPane();
    Assert.assertEquals("2.1", historyTab.getCurrentVersion());
    historyTab = historyTab.deleteVersion("2.1");
    // Verify that the current version is now the previous one.
    Assert.assertEquals("1.1", historyTab.getCurrentVersion());
    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)

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