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