コード例 #1
0
  @Test
  public void addAndGetHeaders() {
    Header[] headers = {
      new Header("foo", 1), // $NON-NLS-1$
      new Header("bar", 2), // $NON-NLS-1$
      new Header("baz", 3) // $NON-NLS-1$
    };
    for (Header header : headers) {
      htmlSerializerContext.addHeader(header.getText(), header.getLevel());
    }

    List<Header> result = htmlSerializerContext.getHeaders();
    for (int i = 0; i < result.size(); i++) {
      assertTrue(EqualsBuilder.reflectionEquals(result.get(i), headers[i], true));
    }
  }
  @Test
  @InSequence(2)
  public void adminCreateApplicationTest() {
    driver.get(contextRoot.toExternalForm());
    loginPage.waitForPage();
    loginPage.login(ADMIN_USERNAME, PASSWORD);
    if (passwordChangePage.isPagePresent()) {
      passwordChangePage.changePassword(PASSWORD);
    }
    navigation.goToApplications();
    pushAppsPage.waitForPage();

    navigation.goToApplications();
    // initially there shouldn't exist any push applications
    while (!pushAppsPage.getApplicationList().isEmpty()) {
      Application application = pushAppsPage.getApplicationList().get(0);
      application.remove();
      modal.waitForDialog();
      modal.confirmName(application.getName());
      modal.remove();
    }

    pushAppsPage.pressCreateButton();
    pushAppEditPage.registerNewPushApp(ADMIN_APPLICATION, "");

    header.logout();
  }
  @Test
  @InSequence(5)
  public void developerCreateAppTest() {
    pushAppsPage.pressCreateButton();
    pushAppEditPage.registerNewPushApp(DEVELOPER_APPLICATION, "");

    pushAppsPage.waitForPage();

    assertEquals(1, pushAppsPage.countApplications());

    header.logout();
  }
  @Test
  @InSequence(6)
  public void adminApplicationListTest() {
    driver.get(contextRoot.toExternalForm());
    loginPage.login(ADMIN_USERNAME, PASSWORD);
    if (passwordChangePage.isPagePresent()) {
      passwordChangePage.changePassword(PASSWORD);
    }

    navigation.goToApplications();
    pushAppsPage.waitForPage();

    assertEquals(3, pushAppsPage.countApplications());
    assertTrue(pushAppsPage.applicationExists(ADMIN_APPLICATION, ""));
    assertTrue(pushAppsPage.applicationExists(DEVELOPER_APPLICATION, ""));
    assertTrue(pushAppsPage.applicationExists(NEW_USER_APPLICATION, ""));
    header.logout();
    loginPage.waitForPage();
  }
  @Test
  @InSequence(3)
  public void newUserCreateApplicationTest() {
    driver.get(contextRoot.toExternalForm());
    loginPage.waitForPage();
    loginPage.login(NEW_USER_USERNAME, NEW_USER_PASSWORD);
    if (passwordChangePage.isPagePresent()) {
      passwordChangePage.changePassword(NEW_USER_PASSWORD);
    }
    navigation.goToApplications();
    pushAppsPage.waitForPage();

    navigation.goToApplications();

    pushAppsPage.pressCreateButton();
    pushAppEditPage.registerNewPushApp(NEW_USER_APPLICATION, "");

    header.logout();
  }