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());
}
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());
}
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"));
}
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());
}
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();
}
Aggregations