/** * 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 and deletes 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 testDeleteApplication() { // Create the application. String appName = RandomStringUtils.randomAlphabetic(6); createApplication(appName); // Check the the applications live table lists the created application. ApplicationsLiveTableElement appsLiveTable = homePage.getAppsLiveTable(); appsLiveTable.waitUntilReady(); Assert.assertTrue(appsLiveTable.hasColumn("Actions")); appsLiveTable.filterApplicationName(appName.substring(0, 3)); Assert.assertTrue(appsLiveTable.isApplicationListed(appName)); // Click the delete icon then cancel the confirmation. appsLiveTable.clickDeleteApplication(appName).clickNo(); // We should be taken back to the AppWithinMinutes home page. homePage = new AppWithinMinutesHomePage(); appsLiveTable = homePage.getAppsLiveTable(); appsLiveTable.waitUntilReady(); // The application name filter should've been preserved. Assert.assertEquals(appName.substring(0, 3), appsLiveTable.getApplicationNameFilter()); // Click the delete icon again and this confirm the action. appsLiveTable.clickDeleteApplication(appName).clickYes(); // We should be taken back to the AppWithinMinutes home page. homePage = new AppWithinMinutesHomePage(); appsLiveTable = homePage.getAppsLiveTable(); appsLiveTable.waitUntilReady(); // The application name filter should've been preserved. Assert.assertEquals(appName.substring(0, 3), appsLiveTable.getApplicationNameFilter()); // And the deleted application shouldn't be listed anymore. Assert.assertFalse(appsLiveTable.isApplicationListed(appName)); }
/** * Tests that the actions are displayed only when the current user has the right to perform them. */ @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 testActionRights() { // Create the application. String appName = RandomStringUtils.randomAlphabetic(6); createApplication(appName); // The application author should be able to edit and delete the application. ApplicationsLiveTableElement appsLiveTable = homePage.getAppsLiveTable(); appsLiveTable.waitUntilReady(); appsLiveTable.filterApplicationName(appName); Assert.assertTrue(appsLiveTable.canEditApplication(appName)); Assert.assertTrue(appsLiveTable.canDeleteApplication(appName)); // Logout. Guests shouldn't be able to edit nor delete the application. homePage.logout(); getUtil().recacheSecretToken(); homePage = new AppWithinMinutesHomePage(); appsLiveTable = homePage.getAppsLiveTable(); appsLiveTable.waitUntilReady(); appsLiveTable.filterApplicationName(appName); Assert.assertFalse(appsLiveTable.canEditApplication(appName)); Assert.assertFalse(appsLiveTable.canDeleteApplication(appName)); // Login with a different user. The new user shouldn't be able to delete the application. getUtil().createUser("someOtherUser", "somePassword"); appsLiveTable = AppWithinMinutesHomePage.gotoPage().getAppsLiveTable(); appsLiveTable.waitUntilReady(); appsLiveTable.filterApplicationName(appName); Assert.assertTrue(appsLiveTable.canEditApplication(appName)); Assert.assertFalse(appsLiveTable.canDeleteApplication(appName)); }