use of org.xwiki.test.ui.po.ViewPage 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.po.ViewPage in project xwiki-platform by xwiki.
the class LoginTest method setUp.
@Before
public void setUp() {
// Force log out (we're using the fast way since this is not part of what we want to test)
getUtil().forceGuestUser();
// Go to any page in view mode. We choose to go to a nonexisting page so that it loads as fast as possible
// Note: since the page doesn't exist, we need to disable the space redirect feature so that we end up on the
// terminal page and not on WebHome in the space.
getUtil().gotoPage("NonExistentSpace", "NonExistentPage", "view", "spaceRedirect=false");
this.vp = new ViewPage();
this.nonExistentPageURL = getDriver().getCurrentUrl();
}
use of org.xwiki.test.ui.po.ViewPage 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.po.ViewPage in project xwiki-platform by xwiki.
the class SectionTest method testSectionEditInWikiEditorWhenSyntax2x.
private void testSectionEditInWikiEditorWhenSyntax2x(String syntaxId) {
ViewPage vp = createTestPages(syntaxId);
// Edit the second section in the wiki editor
WikiEditPage wikiEditPage = vp.editSection(2).editWiki();
Assert.assertEquals("= Section2 = Content2 == Section3 == Content3 " + "{{include document=\"Test.SectionEditingIncluded\"/}}", wikiEditPage.getContent());
vp = wikiEditPage.clickCancel();
// Edit the third section in the wiki editor
wikiEditPage = vp.editSection(3).editWiki();
Assert.assertEquals("== Section3 == Content3 {{include document=\"Test.SectionEditingIncluded\"/}}", wikiEditPage.getContent());
vp = wikiEditPage.clickCancel();
// Edit the fourth section in the wiki editor
// Note: we prove that included documents don't generate editable sections by checking that the fourth section
// is "Section7".
wikiEditPage = vp.editSection(4).editWiki();
Assert.assertEquals("= Section7 = Content7", wikiEditPage.getContent());
}
use of org.xwiki.test.ui.po.ViewPage in project xwiki-platform by xwiki.
the class MailTest method sendMailWithInvalidMailSetup.
private void sendMailWithInvalidMailSetup() throws Exception {
// Remove existing pages (for pages that we create below)
getUtil().deletePage(getTestClassName(), "SendInvalidMail");
// Create a page with the Velocity script to send the template email.
// Note that we don't set the type and thus this message should not appear in the LiveTable filter at the end
// of the test.
String velocity = "{{velocity}}\n" + "#set ($message = $services.mailsender.createMessage('from@doe.com', 'to@doe.com', 'Subject'))\n" + "#set ($discard = $message.addPart('text/plain', 'text message'))\n" + "#set ($result = $services.mailsender.send([$message], 'database'))\n" + "#foreach ($status in $result.statusResult.getAllErrors())\n" + " MSGID $status.messageId SUMMARY $status.errorSummary DESCRIPTION $status.errorDescription\n" + "#end\n" + "{{/velocity}}";
// This will create the page and execute its content and thus send the mail
ViewPage vp = getUtil().createPage(getTestClassName(), "SendInvalidMail", velocity, "");
// Verify that the page is not empty (and thus an error message is displayed). Note that it's difficult to
// assert what is displayed because it could vary from system to system. This is why we only assert that
// something is displayed and that it matches the defined pattern.
assertTrue(vp.getContent().matches("(?s)MSGID.*SUMMARY.*DESCRIPTION.*"));
}
Aggregations