KEYCLOAK-6806 Wait for query error to appear in query response mode test (#5130)
This commit is contained in:
parent
fac3118b0a
commit
b78f0aa9db
1 changed files with 8 additions and 11 deletions
|
@ -7,6 +7,7 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.admin.client.resource.ClientResource;
|
import org.keycloak.admin.client.resource.ClientResource;
|
||||||
|
import org.keycloak.common.util.Retry;
|
||||||
import org.keycloak.events.Details;
|
import org.keycloak.events.Details;
|
||||||
import org.keycloak.events.EventType;
|
import org.keycloak.events.EventType;
|
||||||
import org.keycloak.representations.idm.ClientRepresentation;
|
import org.keycloak.representations.idm.ClientRepresentation;
|
||||||
|
@ -28,7 +29,6 @@ import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebDriverException;
|
import org.openqa.selenium.WebDriverException;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -87,6 +87,8 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest {
|
||||||
assertCurrentUrlStartsWith(testAppUrl, jsDriver);
|
assertCurrentUrlStartsWith(testAppUrl, jsDriver);
|
||||||
|
|
||||||
jsDriver.manage().deleteAllCookies();
|
jsDriver.manage().deleteAllCookies();
|
||||||
|
|
||||||
|
setStandardFlowForClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
private JSObjectBuilder defaultArguments() {
|
private JSObjectBuilder defaultArguments() {
|
||||||
|
@ -206,7 +208,6 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest {
|
||||||
.loginForm(testUser, this::assertOnTestAppUrl)
|
.loginForm(testUser, this::assertOnTestAppUrl)
|
||||||
.init(defaultArguments().implicitFlow(), this::assertSuccessfullyLoggedIn);
|
.init(defaultArguments().implicitFlow(), this::assertSuccessfullyLoggedIn);
|
||||||
|
|
||||||
setStandardFlowForClient();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -223,12 +224,11 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest {
|
||||||
@Test
|
@Test
|
||||||
public void implicitFlowQueryTest() {
|
public void implicitFlowQueryTest() {
|
||||||
setImplicitFlowForClient();
|
setImplicitFlowForClient();
|
||||||
testExecutor.init(defaultArguments().implicitFlow().queryResponse(), this::assertInitNotAuth)
|
testExecutor.init(JSObjectBuilder.create().implicitFlow().queryResponse(), this::assertInitNotAuth)
|
||||||
.login(((driver1, output, events) -> {
|
.login((driver1, output, events1) -> Retry.execute(
|
||||||
waitUntilElement(By.tagName("body")).is().present();
|
() -> assertThat(driver1.getCurrentUrl(), containsString("Response_mode+%27query%27+not+allowed")),
|
||||||
Assert.assertThat(driver1.getCurrentUrl(), containsString("Response_mode+%27query%27+not+allowed"));
|
20, 50)
|
||||||
}));
|
);
|
||||||
setStandardFlowForClient();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -236,7 +236,6 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest {
|
||||||
setImplicitFlowForClient();
|
setImplicitFlowForClient();
|
||||||
testExecutor.logInAndInit(defaultArguments().implicitFlow(), testUser, this::assertSuccessfullyLoggedIn)
|
testExecutor.logInAndInit(defaultArguments().implicitFlow(), testUser, this::assertSuccessfullyLoggedIn)
|
||||||
.refreshToken(9999, assertOutputContains("Failed to refresh token"));
|
.refreshToken(9999, assertOutputContains("Failed to refresh token"));
|
||||||
setStandardFlowForClient();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -255,7 +254,6 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest {
|
||||||
// Get to origin state
|
// Get to origin state
|
||||||
realm.setAccessTokenLifespanForImplicitFlow(storeAccesTokenLifespan);
|
realm.setAccessTokenLifespanForImplicitFlow(storeAccesTokenLifespan);
|
||||||
adminClient.realms().realm(REALM_NAME).update(realm);
|
adminClient.realms().realm(REALM_NAME).update(realm);
|
||||||
setStandardFlowForClient();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -268,7 +266,6 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest {
|
||||||
.addHeader("Accept", "application/json")
|
.addHeader("Accept", "application/json")
|
||||||
.addHeader("Authorization", "Bearer ' + keycloak.token + '"),
|
.addHeader("Authorization", "Bearer ' + keycloak.token + '"),
|
||||||
assertResponseStatus(200));
|
assertResponseStatus(200));
|
||||||
setStandardFlowForClient();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue