Fix Flaky test: RequiredActionTotpSetupTest.setupTotpExistingReusableCodeDisabled (#15779)
Closes #15564
This commit is contained in:
parent
60ce949304
commit
8e6437e596
1 changed files with 6 additions and 7 deletions
|
@ -352,7 +352,9 @@ public class RequiredActionTotpSetupTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
String totpSecret = totpPage.getTotpSecret();
|
String totpSecret = totpPage.getTotpSecret();
|
||||||
|
|
||||||
totpPage.configure(totp.generateTOTP(totpSecret));
|
String firstCode = totp.generateTOTP(totpSecret);
|
||||||
|
|
||||||
|
totpPage.configure(firstCode);
|
||||||
|
|
||||||
String authSessionId = events.expectRequiredAction(EventType.UPDATE_TOTP).assertEvent()
|
String authSessionId = events.expectRequiredAction(EventType.UPDATE_TOTP).assertEvent()
|
||||||
.getDetails().get(Details.CODE_ID);
|
.getDetails().get(Details.CODE_ID);
|
||||||
|
@ -366,17 +368,14 @@ public class RequiredActionTotpSetupTest extends AbstractTestRealmKeycloakTest {
|
||||||
|
|
||||||
events.expectLogout(authSessionId).assertEvent();
|
events.expectLogout(authSessionId).assertEvent();
|
||||||
|
|
||||||
if (!reusableCodesEnabled) {
|
|
||||||
setTimeOffset(TimeBasedOTP.DEFAULT_INTERVAL_SECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
loginPage.open();
|
loginPage.open();
|
||||||
loginPage.login("test-user@localhost", "password");
|
loginPage.login("test-user@localhost", "password");
|
||||||
String src = driver.getPageSource();
|
|
||||||
loginTotpPage.login(totp.generateTOTP(totpSecret));
|
loginTotpPage.login(firstCode);
|
||||||
|
|
||||||
if (!reusableCodesEnabled) {
|
if (!reusableCodesEnabled) {
|
||||||
loginTotpPage.assertCurrent();
|
loginTotpPage.assertCurrent();
|
||||||
|
assertEquals("Invalid authenticator code.", loginTotpPage.getInputError());
|
||||||
} else {
|
} else {
|
||||||
assertEquals(RequestType.AUTH_RESPONSE, appPage.getRequestType());
|
assertEquals(RequestType.AUTH_RESPONSE, appPage.getRequestType());
|
||||||
events.expectLogin().assertEvent();
|
events.expectLogin().assertEvent();
|
||||||
|
|
Loading…
Reference in a new issue