Пример #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-8728: AWM home page does not list entries when \"Title\" column is set to be the
   *     first one"
   */
  @Test
  public void titleField() {
    // Create an application that has a Title field and add a corresponding column to the live
    // table.
    classEditPage.addField("Title");
    ApplicationHomeEditPage homeEditPage =
        classEditPage.clickNextStep().clickNextStep().waitUntilPageIsLoaded();
    homeEditPage.addLiveTableColumn("Title");
    homeEditPage.moveLiveTableColumnBefore("Title", "Page Title");

    // Add first entry.
    EntryNamePane entryNamePane = homeEditPage.clickFinish().clickAddNewEntry();
    entryNamePane.setName("Foo");
    EntryEditPage entryEditPage = entryNamePane.clickAdd();
    entryEditPage.setTitle("The Mighty Foo");
    entryEditPage.clickSaveAndView().clickBreadcrumbLink(appName);

    // Add second entry.
    entryNamePane = new ApplicationHomePage().clickAddNewEntry();
    entryNamePane.setName("Bar");
    entryEditPage = entryNamePane.clickAdd();
    entryEditPage.setTitle("The Empty Bar");
    entryEditPage.clickSaveAndView().clickBreadcrumbLink(appName);

    // Filter the Title column of the live table.
    LiveTableElement liveTable = new ApplicationHomePage().getEntriesLiveTable();
    liveTable.waitUntilReady();
    Assert.assertEquals(2, liveTable.getRowCount());
    String filterInputId = getFilterInputId(0);
    liveTable.filterColumn(filterInputId, "mighty");
    Assert.assertEquals(1, liveTable.getRowCount());
    Assert.assertTrue(liveTable.hasRow("Location", appName + "Foo"));
    liveTable.filterColumn(filterInputId, "empty");
    Assert.assertEquals(1, liveTable.getRowCount());
    Assert.assertTrue(liveTable.hasRow("Location", appName + "Bar"));
    liveTable.filterColumn(filterInputId, "");
    Assert.assertEquals(2, liveTable.getRowCount());
  }
  /** @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());
  }