@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 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"));
  }
  @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);
  }