Search in sources :

Example 36 with IgnoreBrowsers

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

the class LoginTest method testDataIsPreservedAfterLogin.

@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 testDataIsPreservedAfterLogin() {
    getUtil().gotoPage("Test", "TestData", "save", "content=this+should+not+be+saved");
    getUtil().gotoPage("Test", "TestData", "save", "content=this+should+be+saved+instead&parent=Main.WebHome");
    LoginPage loginPage = new LoginPage();
    loginPage.loginAsAdmin();
    // we switched to another user, CSRF protection (if enabled) will ask for confirmation
    ResubmissionPage resubmissionPage = new ResubmissionPage();
    if (resubmissionPage.isOnResubmissionPage()) {
        resubmissionPage.resubmit();
    }
    Assert.assertTrue(getDriver().getCurrentUrl().contains("/xwiki/bin/view/Test/TestData"));
    ViewPage viewPage = new ViewPage();
    Assert.assertEquals("this should be saved instead", viewPage.getContent());
}
Also used : ResubmissionPage(org.xwiki.test.ui.po.ResubmissionPage) ViewPage(org.xwiki.test.ui.po.ViewPage) LoginPage(org.xwiki.test.ui.po.LoginPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 37 with IgnoreBrowsers

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

the class LoginTest method testLoginLogoutAsAdmin.

@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 testLoginLogoutAsAdmin() {
    LoginPage loginPage = this.vp.login();
    loginPage.loginAsAdmin();
    // Verify that after logging in we're redirected to the page on which the login button was clicked, i.e. the
    // non existent page here.
    Assert.assertEquals(this.nonExistentPageURL, getDriver().getCurrentUrl());
    Assert.assertTrue(this.vp.isAuthenticated());
    Assert.assertEquals("Administrator", this.vp.getCurrentUser());
    // Test Logout and verify we stay on the same page
    this.vp.logout();
    Assert.assertFalse(this.vp.isAuthenticated());
    Assert.assertEquals(this.nonExistentPageURL, getDriver().getCurrentUrl());
}
Also used : LoginPage(org.xwiki.test.ui.po.LoginPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 38 with IgnoreBrowsers

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

the class LoginTest method testCorrectUrlIsAccessedAfterLogin.

@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 testCorrectUrlIsAccessedAfterLogin() {
    // We will choose the Scheduler.WebHome page to make our testing
    // since it can't be viewed without being logged in
    getUtil().gotoPage("Scheduler", "WebHome");
    LoginPage loginPage = new LoginPage();
    Assert.assertFalse(loginPage.isAuthenticated());
    loginPage.loginAsAdmin();
    // We should be redirected back to Scheduler.WebHome
    Assert.assertTrue(getDriver().getCurrentUrl().contains("/xwiki/bin/view/Scheduler/WebHome"));
    Assert.assertTrue(getDriver().getTitle().contains("Job Scheduler"));
}
Also used : LoginPage(org.xwiki.test.ui.po.LoginPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 39 with IgnoreBrowsers

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

the class SectionTest method testSectionSaveDoesNotOverwriteTheWholeContentWhenSyntax20.

/**
 * Verify section save does not override the whole document content (xwiki/2.0).
 * See XWIKI-4033: When saving after section edit entire page is overwritten.
 */
@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 testSectionSaveDoesNotOverwriteTheWholeContentWhenSyntax20() {
    ViewPage vp = createTestPages("xwiki/2.0");
    vp.editSection(4).editWiki().clickSaveAndView();
    WikiEditPage wep = vp.editWiki();
    Assert.assertEquals("= Section1 = Content1 = Section2 = Content2 == Section3 == Content3 " + "{{include document=\"Test.SectionEditingIncluded\"/}} = Section7 = Content7", wep.getContent());
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 40 with IgnoreBrowsers

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

the class WatchThisPageAndWholeSpaceTest method testWatchThisPageAndWholeSpace.

@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 testWatchThisPageAndWholeSpace() throws Exception {
    // Clear the list of watched documents and spaces
    getUtil().updateObject("XWiki", this.testUserName, "XWiki.WatchListClass", 0, "spaces", "", "documents", "");
    // Watch Test.TestWatchThisPage
    ViewPage page = getUtil().createPage(testSinglePageToWatchSpace, testSinglePageToWatch, "TestWatchThisPage ui", null);
    page.watchDocument();
    // Watch TestWatchWholeSpace.Test1
    page = getUtil().createPage(testSpaceToWatch, testSpaceToWatchPage, "TestWatchWholeSpace ui", null);
    page.watchSpace();
    // Verify that the watched page & space are present in the watchlist manager
    WatchlistUserProfilePage watchlistPage = WatchlistUserProfilePage.gotoPage(this.testUserName);
    Assert.assertTrue(watchlistPage.getWatchlistMacro().isWatched(testSinglePageToWatchSpace, testSinglePageToWatch));
    Assert.assertTrue(watchlistPage.getWatchlistMacro().isWatched(testSpaceToWatch));
    // Ensure that the watchlist notified is set to Daily since we're going to trigger that notifier scheduler job
    WatchlistPreferencesEditPage watchlistPreferences = watchlistPage.editPreferences();
    watchlistPreferences.setNotifierDaily();
    watchlistPreferences.clickSaveAndContinue();
    // Switch to superadmin user and go to the scheduler home page
    SchedulerHomePage schedulerHomePage = new SchedulerHomePage();
    getUtil().loginAsSuperAdminAndGotoPage(schedulerHomePage.getURL());
    // Trigger the notification for the Daily job
    schedulerHomePage.clickJobActionTrigger("WatchList daily notifier");
    // Wait for the email with a timeout
    Assert.assertTrue("Scheduled notification mail not received", this.greenMail.waitForIncomingEmail(70000, 1));
    // Verify email content
    MimeMessage[] receivedMails = this.greenMail.getReceivedMessages();
    assertEquals(1, receivedMails.length);
    String messageFromXWiki = GreenMailUtil.getBody(receivedMails[0]).replaceAll("=\r?\n", "");
    Assert.assertFalse("should have no exception in " + messageFromXWiki, messageFromXWiki.contains("Exception"));
    Assert.assertTrue("should have test page in the message " + messageFromXWiki, messageFromXWiki.contains(testSinglePageToWatch));
    Assert.assertTrue("should have test space in the message " + messageFromXWiki, messageFromXWiki.contains(testSpaceToWatch));
    // // Clear the mock inbox for the following step.
    // GreenMailUser mailUser = this.greenMail.getManagers().getUserManager().getUser("admin@localhost");
    // this.greenMail.getManagers().getImapHostManager().deleteMailbox(mailUser, "INBOX");
    // TODO: we might need the commented code above to make sure the mail is destined for our current test user and
    // not other users created by previous tests.
    testRealtimeNotifier();
}
Also used : SchedulerHomePage(org.xwiki.scheduler.test.po.SchedulerHomePage) MimeMessage(javax.mail.internet.MimeMessage) WatchlistUserProfilePage(org.xwiki.watchlist.test.po.WatchlistUserProfilePage) WatchlistPreferencesEditPage(org.xwiki.watchlist.test.po.editor.WatchlistPreferencesEditPage) ViewPage(org.xwiki.test.ui.po.ViewPage) 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