Search in sources :

Example 11 with LiveTableElement

use of org.xwiki.test.ui.po.LiveTableElement in project xwiki-platform by xwiki.

the class WatchlistMacro method getWatchList.

public LiveTableElement getWatchList() {
    LiveTableElement liveTableElement = new LiveTableElement("mywatchlist-0");
    liveTableElement.waitUntilReady();
    return liveTableElement;
}
Also used : LiveTableElement(org.xwiki.test.ui.po.LiveTableElement)

Example 12 with LiveTableElement

use of org.xwiki.test.ui.po.LiveTableElement in project xwiki-platform by xwiki.

the class LinkCheckerAllDocsPage method clickLinkCheckerTab.

public LiveTableElement clickLinkCheckerTab() {
    WebElement linkCheckerTab = getDriver().findElement(By.xpath("//li[@id='xwikiexternalLinks']/a"));
    linkCheckerTab.click();
    LiveTableElement lt = new LiveTableElement("links");
    lt.waitUntilReady();
    return lt;
}
Also used : LiveTableElement(org.xwiki.test.ui.po.LiveTableElement) WebElement(org.openqa.selenium.WebElement)

Example 13 with LiveTableElement

use of org.xwiki.test.ui.po.LiveTableElement in project xwiki-platform by xwiki.

the class DocumentFieldsTest method titleAndContent.

@Test
public void titleAndContent() {
    // Create a new application.
    String appName = RandomStringUtils.randomAlphabetic(6);
    ApplicationCreatePage appCreatePage = ApplicationCreatePage.gotoPage();
    appCreatePage.setApplicationName(appName);
    appCreatePage.waitForApplicationNamePreview();
    ApplicationClassEditPage classEditPage = appCreatePage.clickNextStep();
    // Add a standard field.
    ClassFieldEditPane numberField = classEditPage.addField("Number");
    // Add the Title and Content fields.
    ClassFieldEditPane titleField = classEditPage.addField("Title");
    ClassFieldEditPane contentField = classEditPage.addField("Content");
    // Change the default field pretty names.
    // See XWIKI-9154: The application live table uses the standard 'Page title' heading instead of the pretty name
    // set for the Title field
    titleField.setPrettyName("My Title");
    contentField.setPrettyName("My Content");
    // Set the default values that will be saved in the template.
    numberField.setDefaultValue("13");
    String defaultTitle = "Enter title here";
    titleField.setDefaultValue(defaultTitle);
    String defaultContent = "Enter content here";
    contentField.setDefaultValue(defaultContent);
    // Add live table columns for Title and Content.
    ApplicationHomeEditPage homeEditPage = classEditPage.clickNextStep().clickNextStep().waitUntilPageIsLoaded();
    homeEditPage.addLiveTableColumn("My Title");
    homeEditPage.addLiveTableColumn("My Content");
    // Add an application entry.
    EntryNamePane entryNamePane = homeEditPage.clickFinish().clickAddNewEntry();
    entryNamePane.setName("Test");
    EntryEditPage entryEditPage = entryNamePane.clickAdd();
    Assert.assertEquals("13", entryEditPage.getValue("number1"));
    // The page name is used as the default value for the title field.
    Assert.assertEquals("Test", entryEditPage.getDocumentTitle());
    Assert.assertEquals("Test", entryEditPage.getTitle());
    entryEditPage.setTitle("Foo");
    Assert.assertEquals(defaultContent, entryEditPage.getContent());
    entryEditPage.setContent("Bar");
    // Check that the title and the content of the entry have been updated.
    ViewPage entryViewPage = entryEditPage.clickSaveAndView();
    Assert.assertEquals("Foo", entryViewPage.getDocumentTitle());
    Assert.assertTrue(entryViewPage.getContent().contains("Bar"));
    entryViewPage.clickBreadcrumbLink(appName);
    // Check the entries live table.
    LiveTableElement liveTable = new ApplicationHomePage().getEntriesLiveTable();
    liveTable.waitUntilReady();
    Assert.assertEquals(1, liveTable.getRowCount());
    Assert.assertTrue(liveTable.hasRow("My Title", "Foo"));
    Assert.assertTrue(liveTable.hasRow("My Content", "Bar"));
    // Check that the title and the content of the class have not been changed.
    getUtil().gotoPage(new LocalDocumentReference(Arrays.asList(appName, "Code"), appName + "Class"), "edit", "editor=wiki");
    WikiEditPage editPage = new WikiEditPage();
    Assert.assertEquals(appName + " Class", editPage.getTitle());
    Assert.assertEquals("", editPage.getContent());
    // Now edit the class and check if the default values for title and content are taken from the template.
    editPage.editInline();
    Assert.assertEquals(defaultTitle, new ClassFieldEditPane("title1").getDefaultValue());
    Assert.assertEquals(defaultContent, new ClassFieldEditPane("content1").getDefaultValue());
}
Also used : LocalDocumentReference(org.xwiki.model.reference.LocalDocumentReference) EntryEditPage(org.xwiki.appwithinminutes.test.po.EntryEditPage) ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) LiveTableElement(org.xwiki.test.ui.po.LiveTableElement) EntryNamePane(org.xwiki.appwithinminutes.test.po.EntryNamePane) ApplicationHomeEditPage(org.xwiki.appwithinminutes.test.po.ApplicationHomeEditPage) ViewPage(org.xwiki.test.ui.po.ViewPage) ApplicationCreatePage(org.xwiki.appwithinminutes.test.po.ApplicationCreatePage) WikiEditPage(org.xwiki.test.ui.po.editor.WikiEditPage) ApplicationHomePage(org.xwiki.appwithinminutes.test.po.ApplicationHomePage) ApplicationClassEditPage(org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 14 with LiveTableElement

use of org.xwiki.test.ui.po.LiveTableElement in project xwiki-platform by xwiki.

the class LiveTableEditorTest method testManageColumns.

/**
 * Adds, removes and reorders live table columns.
 */
@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 testManageColumns() {
    editPage.addLiveTableColumn("First Name");
    Assert.assertTrue(editPage.hasLiveTableColumn("First Name"));
    editPage.moveLiveTableColumnBefore("First Name", "Location");
    editPage.removeLiveTableColumn("Page Title");
    Assert.assertFalse(editPage.hasLiveTableColumn("Page Title"));
    LiveTableElement liveTable = ((ApplicationHomePage) editPage.clickSaveAndView()).getEntriesLiveTable();
    liveTable.waitUntilReady();
    // The column headers aren't translated because we haven't generated the document translation bundle.
    Assert.assertFalse(liveTable.hasColumn("xwikiusers.livetable.doc.title"));
    Assert.assertEquals(0, liveTable.getColumnIndex("xwikiusers.livetable.first_name"));
    Assert.assertEquals(1, liveTable.getColumnIndex("xwikiusers.livetable.doc.location"));
}
Also used : LiveTableElement(org.xwiki.test.ui.po.LiveTableElement) ApplicationHomePage(org.xwiki.appwithinminutes.test.po.ApplicationHomePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 15 with LiveTableElement

use of org.xwiki.test.ui.po.LiveTableElement in project xwiki-platform by xwiki.

the class AddEntryTest method testEntryNameWithURLSpecialCharacters.

/**
 * Tests that entry name is URL encoded.
 */
@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 testEntryNameWithURLSpecialCharacters() {
    EntryNamePane entryNamePane = homePage.clickAddNewEntry();
    String entryName = "A?b=c&d#" + RandomStringUtils.randomAlphanumeric(3);
    entryNamePane.setName(entryName);
    EntryEditPage entryEditPage = entryNamePane.clickAdd();
    entryEditPage.setValue("description", "This is a test panel.");
    entryEditPage.clickSaveAndView();
    getUtil().gotoPage(getTestClassName(), getTestMethodName());
    homePage = new ApplicationHomePage();
    LiveTableElement entriesLiveTable = homePage.getEntriesLiveTable();
    entriesLiveTable.waitUntilReady();
    // The column header is not translated because we haven't generated the document translation bundle.
    Assert.assertTrue(entriesLiveTable.hasRow("panel.livetable.doc.title", entryName));
}
Also used : EntryEditPage(org.xwiki.appwithinminutes.test.po.EntryEditPage) LiveTableElement(org.xwiki.test.ui.po.LiveTableElement) EntryNamePane(org.xwiki.appwithinminutes.test.po.EntryNamePane) ApplicationHomePage(org.xwiki.appwithinminutes.test.po.ApplicationHomePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Aggregations

LiveTableElement (org.xwiki.test.ui.po.LiveTableElement)26 Test (org.junit.Test)16 AbstractTest (org.xwiki.test.ui.AbstractTest)15 ApplicationHomePage (org.xwiki.appwithinminutes.test.po.ApplicationHomePage)8 IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)6 ApplicationHomeEditPage (org.xwiki.appwithinminutes.test.po.ApplicationHomeEditPage)5 EntryEditPage (org.xwiki.appwithinminutes.test.po.EntryEditPage)5 EntryNamePane (org.xwiki.appwithinminutes.test.po.EntryNamePane)5 ViewPage (org.xwiki.test.ui.po.ViewPage)4 ByteArrayInputStream (java.io.ByteArrayInputStream)2 WebElement (org.openqa.selenium.WebElement)2 ApplicationClassEditPage (org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage)2 ClassFieldEditPane (org.xwiki.appwithinminutes.test.po.ClassFieldEditPane)2 AllDocsPage (org.xwiki.index.test.po.AllDocsPage)2 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)2 ServerSetupTest (com.icegreen.greenmail.util.ServerSetupTest)1 UsernamePasswordCredentials (org.apache.commons.httpclient.UsernamePasswordCredentials)1 WebDriver (org.openqa.selenium.WebDriver)1 AdministrationPage (org.xwiki.administration.test.po.AdministrationPage)1 AppWithinMinutesHomePage (org.xwiki.appwithinminutes.test.po.AppWithinMinutesHomePage)1