@Test
  @LoginAs(anonymous = true)
  public void testLogInOutsideAllowedDomainsIsProhibited()
      throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
    JiraLoginPage loginPage = jira.visit(JiraLoginPage.class);
    Poller.waitUntilTrue(loginPage.isOpenIdButtonVisible());
    loginPage.startAuthenticationDanceFor("Google");

    loginDance(
        (String) getProperty(passwords, "gmail.user"),
        (String) getProperty(passwords, "gmail.password"));

    ErrorPage errorPage = jira.getPageBinder().bind(ErrorPage.class);
    Poller.waitUntil(errorPage.getErrorMessage(), containsString("allowed domains"));
  }
  protected void loginDance(String email, String password)
      throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {

    Preconditions.checkNotNull(email);
    Preconditions.checkNotNull(password);

    GoogleLoginPage googleLoginPage;

    DelayedBinder<GoogleLoginPage> delayedLoginPage =
        jira.getPageBinder().delayedBind(GoogleLoginPage.class);
    if (delayedLoginPage.canBind()) {
      googleLoginPage = delayedLoginPage.bind();
      if (!googleLoginPage.isEmailVisible()) {
        googleLoginPage = googleLoginPage.selectDifferentAccount().addAccount();
      }
    } else {
      googleLoginPage = jira.getPageBinder().bind(GoogleAccountChooserPage.class).addAccount();
    }

    GooglePasswordPage passwordPage = googleLoginPage.setEmail(email).next();
    passwordPage.setPassword(password);

    Poller.waitUntilTrue(passwordPage.isSignInEnabled());
    DelayedBinder<GoogleApprovePage> approvePage = passwordPage.signIn();
    if (approvePage.canBind()) {
      approvePage.bind().approve();
    }
  }
 @Test
 public void testManagePlugins() {
   visualComparer.setWaitforJQueryTimeout(1000);
   visualComparer.setRefreshAfterResize(false);
   goTo("/plugins/servlet/upm/manage/action-required");
   Poller.waitUntilFalse(
       finder
           .find(By.className(".loading.filter-box"))
           .withTimeout(TimeoutType.SLOW_PAGE_LOAD)
           .timed()
           .isPresent());
   assertUIMatches("upm-manage");
 }
  @Test
  @LoginAs(anonymous = true)
  public void testLogInWithinAllowedDomainsWork()
      throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
    JiraLoginPage loginPage = jira.visit(JiraLoginPage.class);
    Poller.waitUntilTrue(loginPage.isOpenIdButtonVisible());
    loginPage.startAuthenticationDanceFor("Google");

    loginDance(
        (String) getProperty(passwords, "teamstatus.user"),
        (String) getProperty(passwords, "teamstatus.password"));

    jira.getPageBinder().bind(DashboardPage.class);
  }
  @Test
  @LoginAs(anonymous = true)
  public void testLogInRedirectsToReturnUrl()
      throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
    jira.getTester()
        .getDriver()
        .navigate()
        .to(
            jira.getProductInstance().getBaseUrl()
                + "/login.jsp?os_destination=%2Fsecure%2FViewProfile.jspa");
    JiraLoginPage loginPage = jira.getPageBinder().bind(JiraLoginPage.class);
    Poller.waitUntilTrue(loginPage.isOpenIdButtonVisible());
    loginPage.startAuthenticationDanceFor("Google");

    loginDance(
        (String) getProperty(passwords, "teamstatus.user"),
        (String) getProperty(passwords, "teamstatus.password"));

    jira.getPageBinder().bind(ViewProfilePage.class);
  }
Example #6
0
 @WaitUntil
 public void waitUntilReady() {
   Poller.waitUntilTrue(getWaitCondition(elementFinder));
 }