Ejemplo n.º 1
0
  /** Tests that entry name is URL encoded. */
  @Test
  @IgnoreBrowsers({
    @IgnoreBrowser(
        value = "internet.*",
        version = "8\\.*",
        reason = "See http://jira.xwiki.org/browse/XE-1146"),
    @IgnoreBrowser(
        value = "internet.*",
        version = "9\\.*",
        reason = "See http://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();
    Assert.assertTrue(entriesLiveTable.hasRow("Page name", entryName));
  }
  /** @see "XWIKI-8616: Filter a static list in an AWM livetable does not work." */
  @Test
  public void filterStaticList() {
    // Create an application that has a Static List field and add a corresponding column to the live
    // table.
    classEditPage.addField("Static List");
    ApplicationHomeEditPage homeEditPage =
        classEditPage.clickNextStep().clickNextStep().waitUntilPageIsLoaded();
    homeEditPage.addLiveTableColumn("Static List");

    // Add first entry.
    EntryNamePane entryNamePane = homeEditPage.clickFinish().clickAddNewEntry();
    entryNamePane.setName("Foo");
    EntryEditPage entryEditPage = entryNamePane.clickAdd();
    entryEditPage.setValue("staticList1", "value1");
    entryEditPage.clickSaveAndView().clickBreadcrumbLink(appName);

    // Add second entry.
    entryNamePane = new ApplicationHomePage().clickAddNewEntry();
    entryNamePane.setName("Bar");
    entryEditPage = entryNamePane.clickAdd();
    entryEditPage.setValue("staticList1", "value2");
    entryEditPage.clickSaveAndView().clickBreadcrumbLink(appName);

    // Filter the Static List column of the live table.
    LiveTableElement liveTable = new ApplicationHomePage().getEntriesLiveTable();
    liveTable.waitUntilReady();
    Assert.assertEquals(2, liveTable.getRowCount());
    String filterInputId = getFilterInputId(liveTable.getColumnIndex("Static List"));
    liveTable.filterColumn(filterInputId, "Second Choice");
    Assert.assertEquals(1, liveTable.getRowCount());
    Assert.assertTrue(liveTable.hasRow("Page Title", "Bar"));
    liveTable.filterColumn(filterInputId, "First Choice");
    Assert.assertEquals(1, liveTable.getRowCount());
    Assert.assertTrue(liveTable.hasRow("Page Title", "Foo"));
    liveTable.filterColumn(filterInputId, "All");
    Assert.assertEquals(2, liveTable.getRowCount());
  }