@Test public void setupTotp() { totpPage.open(); loginPage.login("test-user@localhost", "password"); events .expectLogin() .client("account") .detail(Details.REDIRECT_URI, ACCOUNT_REDIRECT + "?path=totp") .assertEvent(); Assert.assertTrue(totpPage.isCurrent()); Assert.assertFalse(driver.getPageSource().contains("Remove Google")); // Error with false code totpPage.configure(totp.generate(totpPage.getTotpSecret() + "123")); Assert.assertEquals("Invalid authenticator code.", profilePage.getError()); totpPage.configure(totp.generate(totpPage.getTotpSecret())); Assert.assertEquals("Mobile authenticator configured.", profilePage.getSuccess()); events.expectAccount(EventType.UPDATE_TOTP).assertEvent(); Assert.assertTrue(driver.getPageSource().contains("pficon-delete")); totpPage.removeTotp(); events.expectAccount(EventType.REMOVE_TOTP).assertEvent(); }
@Test public void returnToAppFromQueryParam() { driver.navigate().to(AccountUpdateProfilePage.PATH + "?referrer=test-app"); loginPage.login("test-user@localhost", "password"); Assert.assertTrue(profilePage.isCurrent()); profilePage.backToApplication(); Assert.assertTrue(appPage.isCurrent()); driver .navigate() .to( AccountUpdateProfilePage.PATH + "?referrer=test-app&referrer_uri=http://localhost:8081/app?test"); Assert.assertTrue(profilePage.isCurrent()); profilePage.backToApplication(); Assert.assertTrue(appPage.isCurrent()); Assert.assertEquals(appPage.baseUrl + "?test", driver.getCurrentUrl()); driver.navigate().to(AccountUpdateProfilePage.PATH + "?referrer=test-app"); Assert.assertTrue(profilePage.isCurrent()); driver.findElement(By.linkText("Authenticator")).click(); Assert.assertTrue(totpPage.isCurrent()); driver.findElement(By.linkText("Account")).click(); Assert.assertTrue(profilePage.isCurrent()); profilePage.backToApplication(); Assert.assertTrue(appPage.isCurrent()); events.clear(); }
@Test public void setupTotp() { totpPage.open(); loginPage.login("test-user@localhost", "password"); Assert.assertTrue(totpPage.isCurrent()); Assert.assertFalse(driver.getPageSource().contains("Remove Google")); // Error with false code totpPage.configure(totp.generate(totpPage.getTotpSecret() + "123")); Assert.assertTrue(profilePage.isError()); totpPage.configure(totp.generate(totpPage.getTotpSecret())); Assert.assertTrue(profilePage.isSuccess()); Assert.assertTrue(driver.getPageSource().contains("Remove Google")); }