Add Retry

This commit is contained in:
Alfredo Boullosa 2021-03-10 11:33:19 +01:00 committed by Pavel Drozd
parent fca65ac644
commit e126969f82

View file

@ -16,11 +16,12 @@
*/ */
package org.keycloak.testsuite.console.authorization; package org.keycloak.testsuite.console.authorization;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement; import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
import org.junit.Test; import org.junit.Test;
import org.keycloak.common.util.Retry;
/** /**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a> * @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
@ -34,11 +35,14 @@ public class DisableAuthorizationSettingsTest extends AbstractAuthorizationSetti
clientSettingsPage.navigateTo(); clientSettingsPage.navigateTo();
clientSettingsPage.form().setAuthorizationSettingsEnabled(false); clientSettingsPage.form().setAuthorizationSettingsEnabled(false);
waitUntilElement(modalDialog.getMessage()).text().contains(WARNING_MESSAGE); waitUntilElement(modalDialog.getMessage()).text().contains(WARNING_MESSAGE);
clientSettingsPage.form().confirmDisableAuthorizationSettings(); clientSettingsPage.form().confirmDisableAuthorizationSettings();
Thread.sleep(1000); Retry.execute(() -> {
clientSettingsPage.form().save(); clientSettingsPage.form().save();
}, 10, 300);
clientSettingsPage.form().confirmDisableAuthorizationSettings(); clientSettingsPage.form().confirmDisableAuthorizationSettings();
assertAlertSuccess(); Retry.execute(this::assertAlertSuccess, 10, 300);
clientSettingsPage.navigateTo(); clientSettingsPage.navigateTo();
assertFalse(clientSettingsPage.form().isAuthorizationSettingsEnabled()); assertFalse(clientSettingsPage.form().isAuthorizationSettingsEnabled());