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