@Before
 public void setUp() {
   // Register a simple user, login and go to the AppWithinMinutes home page.
   String userName = RandomStringUtils.randomAlphanumeric(5);
   String password = RandomStringUtils.randomAlphanumeric(6);
   getUtil().createUser(userName, password);
   homePage = AppWithinMinutesHomePage.gotoPage();
 }
  /**
   * 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));
  }