Search in sources :

Example 1 with HistoryPane

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());
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) HistoryPane(org.xwiki.test.ui.po.HistoryPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 2 with HistoryPane

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());
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) HistoryPane(org.xwiki.test.ui.po.HistoryPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 3 with HistoryPane

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());
}
Also used : DeletingPage(org.xwiki.test.ui.po.DeletingPage) AttachmentsPane(org.xwiki.test.ui.po.AttachmentsPane) ViewPage(org.xwiki.test.ui.po.ViewPage) HistoryPane(org.xwiki.test.ui.po.HistoryPane) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 4 with HistoryPane

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

Example 5 with HistoryPane

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"));
}
Also used : ViewPage(org.xwiki.test.ui.po.ViewPage) URL(java.net.URL) HistoryPane(org.xwiki.test.ui.po.HistoryPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest)

Aggregations

HistoryPane (org.xwiki.test.ui.po.HistoryPane)9 ViewPage (org.xwiki.test.ui.po.ViewPage)7 IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)6 Test (org.junit.Test)5 AbstractTest (org.xwiki.test.ui.AbstractTest)5 URL (java.net.URL)4 WebElement (org.openqa.selenium.WebElement)2 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 AttachmentsPane (org.xwiki.test.ui.po.AttachmentsPane)1 ChangesPane (org.xwiki.test.ui.po.ChangesPane)1 DeletingPage (org.xwiki.test.ui.po.DeletingPage)1 DocumentDiffSummary (org.xwiki.test.ui.po.diff.DocumentDiffSummary)1 EntityDiff (org.xwiki.test.ui.po.diff.EntityDiff)1