use of org.xwiki.test.ui.browser.IgnoreBrowsers 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.browser.IgnoreBrowsers 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.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class AllDocsTest method attachmentsTabFilteringAndSorting.
/**
* This test is against XWiki Enterprise XE-701 https://jira.xwiki.org/browse/XE-701 (fixed in 2.5M1) WARN:
* calling isReady() and waitUntilReady() from LiveTableElement.java inside this class fails.
*/
@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 attachmentsTabFilteringAndSorting() throws Exception {
// Create 2 pages with attachments so that this test filter returns only one.
// Note that we need to be logged in.
getUtil().createPageWithAttachment(getTestClassName(), "Page", null, null, "attachment1.txt", new ByteArrayInputStream("attachment content1".getBytes()), TestUtils.SUPER_ADMIN_CREDENTIALS);
getUtil().createPageWithAttachment(getTestClassName(), "OtherPage", null, null, "attachment2.txt", new ByteArrayInputStream("attachment content2".getBytes()), TestUtils.SUPER_ADMIN_CREDENTIALS);
AllDocsPage docsPage = AllDocsPage.gotoPage();
LiveTableElement liveTable = docsPage.clickAttachmentsTab();
// Here we test if all the Columns are displayed.
assertTrue("No Type column found", liveTable.hasColumn("Type"));
assertTrue("No Name column found", liveTable.hasColumn("Name"));
assertTrue("No Location column found", liveTable.hasColumn("Location"));
assertTrue("No Size column found", liveTable.hasColumn("Size"));
assertTrue("No Date column found", liveTable.hasColumn("Date"));
assertTrue("No Author column found", liveTable.hasColumn("Author"));
assertEquals(2, liveTable.getRowCount());
// Filter by attachment file name.
liveTable.filterColumn("xwiki-livetable-allattachments-filter-2", "t1");
assertEquals(1, liveTable.getRowCount());
assertEquals("attachment1.txt", liveTable.getCell(liveTable.getRow(1), 2).getText());
// Clear the filter.
liveTable.filterColumn("xwiki-livetable-allattachments-filter-2", "");
// Filter by attachment location.
liveTable.filterColumn("xwiki-livetable-allattachments-filter-3", "th");
assertEquals(1, liveTable.getRowCount());
assertEquals("AllDocsTestOtherPage", liveTable.getCell(liveTable.getRow(1), 3).getText());
// Clear the filter.
liveTable.filterColumn("xwiki-livetable-allattachments-filter-3", "");
// Sort by attachment file name. The live table should be already sorted by file name ascending. This will
// reverse the order.
assertEquals("attachment2.txt", liveTable.getCell(liveTable.getRow(2), 2).getText());
liveTable.sortBy("Name");
assertEquals(2, liveTable.getRowCount());
assertEquals("attachment2.txt", liveTable.getCell(liveTable.getRow(1), 2).getText());
// Sort by attachment location.
liveTable.sortBy("Location");
assertEquals("AllDocsTestPage", liveTable.getCell(liveTable.getRow(2), 3).getText());
liveTable.sortBy("Location");
assertEquals(2, liveTable.getRowCount());
assertEquals("AllDocsTestPage", liveTable.getCell(liveTable.getRow(1), 3).getText());
}
use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class SpacesTest method spacesMacro.
@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 spacesMacro() {
// Create a page with special characters in space name
// See XE-1228: Broken links displayed in the Spaces widget if a space name contains a colon
// See XE-1298: Spaces macro doesn't list spaces that contain a colon in their name
String spaceName = getTestClassName() + ":" + getTestMethodName() + "&";
String referenceEscapedSpaceName = getTestClassName() + "\\:" + getTestMethodName() + "&";
// Make sure the new space's WebHome page doesn't exist.
getUtil().deletePage(spaceName, "WebHome");
// Create the new space using the UI and verify it leads to the space home page being edited.
SpacesMacroPage macroPage = SpacesMacroPage.gotoPage();
macroPage.getSpacesMacroPane().createSpace(spaceName).clickCreate();
WikiEditPage editPage = new WikiEditPage();
// Verify that space creation uses the space name as the space home page's title
assertEquals(spaceName, editPage.getDocumentTitle());
// Verify that the space created is correct by looking at the generate metadata in the HTML header
// (they contain the space reference amongst other data).
// Note: the value will be escaped since it is the space reference, not the space name.
assertEquals(referenceEscapedSpaceName, editPage.getMetaDataValue("space"));
// Go back to the Spaces Macro page and verify that the link to space index works
// First, save the space's home page
editPage.clickSaveAndContinue();
macroPage = SpacesMacroPage.gotoPage();
macroPage.getSpacesMacroPane().clickSpaceIndex(referenceEscapedSpaceName);
// Assert the content of the space index live table.
LiveTableElement spaceIndexLiveTable = new SpaceIndexPage().getLiveTable();
spaceIndexLiveTable.waitUntilReady();
assertEquals(1, spaceIndexLiveTable.getRowCount());
assertTrue(spaceIndexLiveTable.hasRow("Page", "WebHome"));
assertTrue(spaceIndexLiveTable.hasRow("Space", referenceEscapedSpaceName));
// Go back to the Spaces Macro page and this time verify that the link to the space home page works
macroPage = SpacesMacroPage.gotoPage();
ViewPage spaceHomePage = macroPage.getSpacesMacroPane().clickSpaceHome(referenceEscapedSpaceName);
assertEquals(spaceName, spaceHomePage.getDocumentTitle());
}
use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class SchedulerIT method testScheduler.
@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 testScheduler() {
// Make sure the job doesn't exist. Note that we don't delete the job after the test is executed (@After)
// because we want to remain on the same page in case of a test failure so that our TestDebugger rule can
// collect accurate information about the failure. It's not a problem if the job remains scheduled because it
// does nothing. Other tests should not rely on the number of scheduler jobs though.
getUtil().deletePage("Scheduler", "SchedulerTestJob");
// Create Job
SchedulerHomePage schedulerHomePage = SchedulerHomePage.gotoPage();
schedulerHomePage.setJobName("SchedulerTestJob");
SchedulerEditPage schedulerEdit = schedulerHomePage.clickAdd();
String jobName = "Tester problem";
schedulerEdit.setJobName(jobName);
schedulerEdit.setJobDescription(jobName);
schedulerEdit.setCron("0 15 10 ? * MON-FRI");
SchedulerPage schedulerPage = schedulerEdit.clickSaveAndView();
schedulerHomePage = schedulerPage.backToHome();
// View Job
schedulerPage = schedulerHomePage.clickJobActionView(jobName);
// Tests that a scheduler job page's default edit mode is Form
// Note: This line below will fail if the page is not edited in Form mode!
schedulerPage.edit();
new SchedulerEditPage().setJobDescription("test");
schedulerEdit.clickCancel();
schedulerHomePage = schedulerPage.backToHome();
// Edit Job
schedulerEdit = schedulerHomePage.clickJobActionEdit(jobName);
schedulerEdit.setJobDescription("Tester problem2");
schedulerEdit.setCron("0 0/5 14 * * ?");
schedulerPage = schedulerEdit.clickSaveAndView();
schedulerHomePage = schedulerPage.backToHome();
// Delete and Restore Job
schedulerHomePage.clickJobActionDelete(jobName).clickYes();
schedulerHomePage = SchedulerHomePage.gotoPage();
Assert.assertFalse(getDriver().hasElementWithoutWaiting(By.linkText(jobName)));
// Note: since the page doesn't exist, we need to disable the space redirect feature so that we end up on the
// terminal page that was removed.
getUtil().gotoPage("Scheduler", "SchedulerTestJob", "view", "spaceRedirect=false");
getDriver().findElement(By.linkText("Restore")).click();
schedulerPage = new SchedulerPage();
schedulerPage.backToHome();
// Schedule Job
schedulerHomePage.clickJobActionSchedule(jobName);
if (schedulerHomePage.hasError()) {
Assert.fail("Failed to schedule job. Error [" + schedulerHomePage.getErrorMessage() + "]");
}
// Trigger Job (a Job can only be triggered after it's been scheduled)
schedulerHomePage.clickJobActionTrigger(jobName);
if (schedulerHomePage.hasError()) {
Assert.fail("Failed to trigger job. Error [" + schedulerHomePage.getErrorMessage() + "]");
}
// Pause Job
schedulerHomePage.clickJobActionPause(jobName);
if (schedulerHomePage.hasError()) {
Assert.fail("Failed to pause job. Error [" + schedulerHomePage.getErrorMessage() + "]");
}
// Resume Job
schedulerHomePage.clickJobActionResume(jobName);
if (schedulerHomePage.hasError()) {
Assert.fail("Failed to resume job. Error [" + schedulerHomePage.getErrorMessage() + "]");
}
// Unschedule Job
schedulerHomePage.clickJobActionUnschedule(jobName);
if (schedulerHomePage.hasError()) {
Assert.fail("Failed to unschedule job. Error [" + schedulerHomePage.getErrorMessage() + "]");
}
}
Aggregations