use of org.xwiki.test.ui.po.HistoryPane in project xwiki-platform by xwiki.
the class ImportIT method testImportAsBackup.
@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 testImportAsBackup() {
URL fileUrl = this.getClass().getResource("/" + BACKUP_PACKAGE);
this.sectionPage.attachPackage(fileUrl);
this.sectionPage.selectPackage(BACKUP_PACKAGE);
WebElement importAsBackup = getDriver().findElement(By.name("importAsBackup"));
Assert.assertTrue(importAsBackup.isSelected());
this.sectionPage.importPackage();
ViewPage importedPage = this.sectionPage.clickImportedPage("Main.TestPage");
// Since the page by default opens the comments pane, if we instantly click on the history, the two tabs
// will race for completion. Let's wait for comments first.
importedPage.openCommentsDocExtraPane();
HistoryPane history = importedPage.openHistoryDocExtraPane();
Assert.assertEquals("JohnDoe", history.getCurrentAuthor());
}
use of org.xwiki.test.ui.po.HistoryPane in project xwiki-platform by xwiki.
the class ImportIT method testImportWhenImportAsBackupIsNotSelected.
@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 testImportWhenImportAsBackupIsNotSelected() {
URL fileUrl = this.getClass().getResource("/" + BACKUP_PACKAGE);
this.sectionPage.attachPackage(fileUrl);
this.sectionPage.selectPackage(BACKUP_PACKAGE);
WebElement importAsBackup = getDriver().findElement(By.name("importAsBackup"));
importAsBackup.click();
Assert.assertFalse(importAsBackup.isSelected());
this.sectionPage.importPackage();
ViewPage importedPage = this.sectionPage.clickImportedPage("Main.TestPage");
// Since the page by default opens the comments pane, if we instantly click on the history, the two tabs
// will race for completion. Let's wait for comments first.
importedPage.openCommentsDocExtraPane();
HistoryPane history = importedPage.openHistoryDocExtraPane();
Assert.assertEquals("superadmin", history.getCurrentAuthor());
}
use of org.xwiki.test.ui.po.HistoryPane in project xwiki-platform by xwiki.
the class RestoreDeletedPageTest method restore.
/**
* @see "XWIKI-9421: Attachment version is incremented when a document is restored from recycle bin"
*/
@Test
public void restore() throws Exception {
// Clean up.
getUtil().rest().deletePage(getTestClassName(), getTestMethodName());
// Create a new page.
ViewPage page = getUtil().createPage(getTestClassName(), getTestMethodName(), "Once upon a time..", "A story");
// Add an attachment.
page.openAttachmentsDocExtraPane().setFileToUpload(getClass().getResource("/SmallAttachment.txt").getPath());
// Delete the page.
page.delete().clickYes();
DeletingPage deletingPage = new DeletingPage();
deletingPage.waitUntilIsTerminated();
// Restore the page.
page = deletingPage.getDeletePageOutcomePage().clickRestore();
// Check the page title and content.
assertEquals("A story", page.getDocumentTitle());
assertEquals("Once upon a time..", page.getContent());
// Check document version/history.
HistoryPane historyPane = page.openHistoryDocExtraPane();
assertEquals("2.1", historyPane.getCurrentVersion());
// Check the attachment.
AttachmentsPane attachmentsPane = page.openAttachmentsDocExtraPane();
assertEquals(1, attachmentsPane.getNumberOfAttachments());
assertEquals("1.1", attachmentsPane.getLatestVersionOfAttachment("SmallAttachment.txt"));
// Check the attachment content.
attachmentsPane.getAttachmentLink("SmallAttachment.txt").click();
Assert.assertEquals("This is a small attachment.", getDriver().findElement(By.tagName("html")).getText());
}
use of org.xwiki.test.ui.po.HistoryPane 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());
}
use of org.xwiki.test.ui.po.HistoryPane in project xwiki-platform by xwiki.
the class ImportIT method testImportWithHistory.
@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 testImportWithHistory() {
URL fileUrl = this.getClass().getResource("/" + PACKAGE_WITH_HISTORY);
this.sectionPage.attachPackage(fileUrl);
this.sectionPage.selectPackage(PACKAGE_WITH_HISTORY);
this.sectionPage.selectReplaceHistoryOption();
this.sectionPage.importPackage();
ViewPage importedPage = this.sectionPage.clickImportedPage("Main.TestPage");
// Since the page by default opens the comments pane, if we instantly click on the history, the two tabs
// will race for completion. Let's wait for comments first.
importedPage.openCommentsDocExtraPane();
HistoryPane history = importedPage.openHistoryDocExtraPane();
Assert.assertEquals("3.1", history.getCurrentVersion());
Assert.assertEquals("A third version of the document", history.getCurrentVersionComment());
Assert.assertTrue(history.hasVersionWithSummary("A new version of the document"));
}
Aggregations