/** * Creates an application and edits it using the Actions column from the applications live table. */ @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 testEditApplication() { // Create the application. String appName = RandomStringUtils.randomAlphabetic(6); createApplication(appName); // Edit the application. ApplicationsLiveTableElement appsLiveTable = homePage.getAppsLiveTable(); appsLiveTable.waitUntilReady(); ApplicationClassEditPage classEditor = appsLiveTable.clickEditApplication(appName); // Edit the existing class field. ClassFieldEditPane fieldEditPane = new ClassFieldEditPane("shortText1"); fieldEditPane.setPrettyName("City Name"); fieldEditPane.openConfigPanel(); fieldEditPane.setName("cityName"); // Move to the next step. ApplicationHomeEditPage homeEditPage = classEditor.clickNextStep(); homeEditPage.setDescription("demo"); // Finish editing. ApplicationHomePage homePage = homeEditPage.clickFinish(); Assert.assertTrue(homePage.getContent().contains("demo")); }
/** * Creates an application with the specified name. The application class will have just one field. * * @param appName the name of the application to create */ private void createApplication(String appName) { ApplicationCreatePage appCreatePage = homePage.clickCreateApplication(); appCreatePage.setApplicationName(appName); appCreatePage.waitForApplicationNamePreview(); ApplicationClassEditPage classEditPage = appCreatePage.clickNextStep(); classEditPage.addField("Short Text"); // Wait for the application home edit page to load before clicking finish to be sure the page // layout is stable. classEditPage .clickNextStep() .waitUntilPageIsLoaded() .clickFinish() .clickBreadcrumbLink(AppWithinMinutesHomePage.TITLE); homePage = new AppWithinMinutesHomePage(); }
/** * @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()); }