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