-
+
${project.build.directory}/containers
${java.home}
${java.home}
-
+
1.1.11.Final
2.52.0
@@ -77,7 +77,7 @@
org.wildfly
wildfly-arquillian-container-managed
${arquillian-wildfly-container.version}
-
+
@@ -102,6 +102,7 @@
servers
tests
+ test-apps
-
+
diff --git a/testsuite/integration-arquillian/test-apps/js-console/README.md b/testsuite/integration-arquillian/test-apps/js-console/README.md
new file mode 100644
index 0000000000..fa9a02d192
--- /dev/null
+++ b/testsuite/integration-arquillian/test-apps/js-console/README.md
@@ -0,0 +1,17 @@
+Basic JavaScript Example
+========================
+
+Start and configure Keycloak
+----------------------------
+
+Start Keycloak:
+
+ bin/standalone.sh
+
+Open the Keycloak admin console, click on Add Realm, click on 'Choose a JSON file', selct example-realm.json and click Upload.
+
+Deploy the JS Console to Keycloak by running:
+
+ mvn install wildfly:deploy
+
+Open the console at http://localhost:8080/js-console and login with username: 'user', and password: 'password'.
diff --git a/testsuite/integration-arquillian/test-apps/js-console/example-realm.json b/testsuite/integration-arquillian/test-apps/js-console/example-realm.json
new file mode 100755
index 0000000000..659e5b4476
--- /dev/null
+++ b/testsuite/integration-arquillian/test-apps/js-console/example-realm.json
@@ -0,0 +1,66 @@
+{
+ "realm": "example",
+ "enabled": true,
+ "sslRequired": "external",
+ "registrationAllowed": true,
+ "privateKey": "MIICXAIBAAKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQABAoGAfmO8gVhyBxdqlxmIuglbz8bcjQbhXJLR2EoS8ngTXmN1bo2L90M0mUKSdc7qF10LgETBzqL8jYlQIbt+e6TH8fcEpKCjUlyq0Mf/vVbfZSNaVycY13nTzo27iPyWQHK5NLuJzn1xvxxrUeXI6A2WFpGEBLbHjwpx5WQG9A+2scECQQDvdn9NE75HPTVPxBqsEd2z10TKkl9CZxu10Qby3iQQmWLEJ9LNmy3acvKrE3gMiYNWb6xHPKiIqOR1as7L24aTAkEAtyvQOlCvr5kAjVqrEKXalj0Tzewjweuxc0pskvArTI2Oo070h65GpoIKLc9jf+UA69cRtquwP93aZKtW06U8dQJAF2Y44ks/mK5+eyDqik3koCI08qaC8HYq2wVl7G2QkJ6sbAaILtcvD92ToOvyGyeE0flvmDZxMYlvaZnaQ0lcSQJBAKZU6umJi3/xeEbkJqMfeLclD27XGEFoPeNrmdx0q10Azp4NfJAY+Z8KRyQCR2BEG+oNitBOZ+YXF9KCpH3cdmECQHEigJhYg+ykOvr1aiZUMFT72HU0jnmQe2FVekuG+LJUt2Tm7GtMjTFoGpf0JwrVuZN39fOYAlo+nTixgeW7X8Y=",
+ "publicKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB",
+ "requiredCredentials": [ "password" ],
+ "users" : [
+ {
+ "username" : "user",
+ "enabled": true,
+ "email" : "sample-user@example",
+ "firstName": "Sample",
+ "lastName": "User",
+ "credentials" : [
+ { "type" : "password",
+ "value" : "password" }
+ ],
+ "realmRoles": [ "user" ],
+ "clientRoles": {
+ "account": ["view-profile", "manage-account"]
+ }
+ }
+ ],
+ "roles" : {
+ "realm" : [
+ {
+ "name": "user",
+ "description": "User privileges"
+ },
+ {
+ "name": "admin",
+ "description": "Administrator privileges"
+ }
+ ]
+ },
+ "scopeMappings": [
+ {
+ "client": "js-console",
+ "roles": ["user"]
+ }
+ ],
+ "clients": [
+ {
+ "clientId": "js-console",
+ "enabled": true,
+ "publicClient": true,
+ "baseUrl": "/js-console",
+ "redirectUris": [
+ "/js-console/*"
+ ],
+ "webOrigins": [
+ "http://localhost:8280"
+ ]
+ }
+ ],
+ "clientScopeMappings": {
+ "account": [
+ {
+ "client": "js-console",
+ "roles": ["view-profile"]
+ }
+ ]
+ }
+}
diff --git a/testsuite/integration-arquillian/test-apps/js-console/pom.xml b/testsuite/integration-arquillian/test-apps/js-console/pom.xml
new file mode 100755
index 0000000000..fdf7d2f14c
--- /dev/null
+++ b/testsuite/integration-arquillian/test-apps/js-console/pom.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+ org.keycloak.testsuite
+ integration-arquillian-test-apps
+ 2.0.0.CR1-SNAPSHOT
+
+
+ 4.0.0
+ integration-arquillian-test-apps-js-console
+ war
+ JS Console
+
+
+
+ js-console
+
+
+ org.jboss.as.plugins
+ jboss-as-maven-plugin
+
+ false
+
+
+
+ org.wildfly.plugins
+ wildfly-maven-plugin
+
+ false
+
+
+
+
+
diff --git a/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/WEB-INF/web.xml b/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..16e8b239d2
--- /dev/null
+++ b/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+ js-console
+
\ No newline at end of file
diff --git a/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/index.html b/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/index.html
new file mode 100755
index 0000000000..1c41fcf11e
--- /dev/null
+++ b/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/index.html
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Result
+
+
+Events
+
+
+
+
+
+
diff --git a/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/keycloak.json b/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/keycloak.json
new file mode 100644
index 0000000000..00f6c9e57e
--- /dev/null
+++ b/testsuite/integration-arquillian/test-apps/js-console/src/main/webapp/keycloak.json
@@ -0,0 +1,8 @@
+{
+ "realm" : "example",
+ "realm-public-key" : "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB",
+ "auth-server-url" : "http://localhost:8180/auth",
+ "ssl-required" : "external",
+ "resource" : "js-console",
+ "public-client" : true
+}
diff --git a/testsuite/integration-arquillian/test-apps/pom.xml b/testsuite/integration-arquillian/test-apps/pom.xml
new file mode 100644
index 0000000000..12c89a06c6
--- /dev/null
+++ b/testsuite/integration-arquillian/test-apps/pom.xml
@@ -0,0 +1,21 @@
+
+
+
+ integration-arquillian
+ org.keycloak.testsuite
+ 2.0.0.CR1-SNAPSHOT
+
+ 4.0.0
+
+ integration-arquillian-test-apps
+ pom
+
+ Test apps
+
+
+ js-console
+ test-apps-dist
+
+
\ No newline at end of file
diff --git a/testsuite/integration-arquillian/test-apps/test-apps-dist/assembly.xml b/testsuite/integration-arquillian/test-apps/test-apps-dist/assembly.xml
new file mode 100644
index 0000000000..5fd736362d
--- /dev/null
+++ b/testsuite/integration-arquillian/test-apps/test-apps-dist/assembly.xml
@@ -0,0 +1,39 @@
+
+
+
+ test-apps-dist
+
+
+ zip
+
+
+ true
+
+
+
+ target/test-apps
+
+
+ **/pom.xml.releaseBackup
+ **/.svn/**
+ **/target/**
+ **/*.iml
+
+
+
+
diff --git a/testsuite/integration-arquillian/test-apps/test-apps-dist/build.xml b/testsuite/integration-arquillian/test-apps/test-apps-dist/build.xml
new file mode 100755
index 0000000000..e48e088698
--- /dev/null
+++ b/testsuite/integration-arquillian/test-apps/test-apps-dist/build.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testsuite/integration-arquillian/test-apps/test-apps-dist/pom.xml b/testsuite/integration-arquillian/test-apps/test-apps-dist/pom.xml
new file mode 100644
index 0000000000..38ce732624
--- /dev/null
+++ b/testsuite/integration-arquillian/test-apps/test-apps-dist/pom.xml
@@ -0,0 +1,85 @@
+
+
+
+ integration-arquillian-test-apps
+ org.keycloak.testsuite
+ 2.0.0.CR1-SNAPSHOT
+
+ 4.0.0
+
+ integration-arquillian-test-apps-dist
+
+ Test apps distribution
+
+
+ ${product.name}-${product.version}-test-apps
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 2.8.2
+
+ false
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+ 1.8
+ false
+
+
+ build-test-apps
+
+ run
+
+ compile
+
+
+
+
+
+
+
+
+
+
+
+ ant-contrib
+ ant-contrib
+ 1.0b3
+
+
+ ant
+ ant
+
+
+
+
+
+
+ maven-assembly-plugin
+
+
+ assemble
+ package
+
+ single
+
+
+
+ assembly.xml
+
+ target
+ target/assembly/work
+ false
+
+
+
+ 2.5.5
+
+
+
+
\ No newline at end of file
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/page/JSConsoleExample.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/page/JSConsoleExample.java
old mode 100644
new mode 100755
index dff81a0818..15f03085ee
--- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/page/JSConsoleExample.java
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/adapter/page/JSConsoleExample.java
@@ -22,6 +22,7 @@ import org.jboss.arquillian.test.api.ArquillianResource;
import org.keycloak.testsuite.page.AbstractPageWithInjectedUrl;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.ui.Select;
import java.net.URL;
@@ -32,7 +33,7 @@ import java.net.URL;
public class JSConsoleExample extends AbstractPageWithInjectedUrl {
public static final String DEPLOYMENT_NAME = "js-console-example";
- public static final String CLIENT_ID = "js-console";
+ public static final String CLIENT_ID = "integration-arquillian-test-apps-js-console";
@ArquillianResource
@OperateOnDeployment(DEPLOYMENT_NAME)
@@ -45,6 +46,8 @@ public class JSConsoleExample extends AbstractPageWithInjectedUrl {
return fixedUrl != null ? fixedUrl : url;
}
+ @FindBy(xpath = "//button[text() = 'Init']")
+ private WebElement initButton;
@FindBy(xpath = "//button[text() = 'Login']")
private WebElement logInButton;
@FindBy(xpath = "//button[text() = 'Logout']")
@@ -67,6 +70,17 @@ public class JSConsoleExample extends AbstractPageWithInjectedUrl {
@FindBy(xpath = "//button[text() = 'Show Details']")
private WebElement showDetailsButton;
+ @FindBy(id = "flowSelect")
+ private Select flowSelect;
+ @FindBy(id = "responseModeSelect")
+ private Select responseModeSelect;
+
+ @FindBy(id = "output")
+ private WebElement outputArea;
+
+ @FindBy(id = "events")
+ private WebElement eventsArea;
+
public void logIn() {
logInButton.click();
}
@@ -87,4 +101,23 @@ public class JSConsoleExample extends AbstractPageWithInjectedUrl {
getProfileButton.click();
}
+ public void setFlow(String value) {
+ flowSelect.selectByValue(value);
+ }
+
+ public void init() {
+ initButton.click();
+ }
+
+ public void setResponseMode(String value) {
+ responseModeSelect.selectByValue(value);
+ }
+
+ public String getOutputText() {
+ return outputArea.getText();
+ }
+
+ public String getEventsText() {
+ return eventsArea.getText();
+ }
}
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractExampleAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractExampleAdapterTest.java
index 3a5012ac3a..9e7f4f1355 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractExampleAdapterTest.java
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/AbstractExampleAdapterTest.java
@@ -38,6 +38,7 @@ public abstract class AbstractExampleAdapterTest extends AbstractAdapterTest {
public static final String EXAMPLES_HOME;
public static final String EXAMPLES_VERSION_SUFFIX;
public static final String EXAMPLES_HOME_DIR;
+ public static final String TEST_APPS_HOME_DIR;
public static final String EXAMPLES_WEB_XML;
static {
@@ -49,7 +50,13 @@ public abstract class AbstractExampleAdapterTest extends AbstractAdapterTest {
Assert.assertNotNull("Property ${examples.version.suffix} must bet set.", EXAMPLES_VERSION_SUFFIX);
System.out.println(EXAMPLES_VERSION_SUFFIX);
- EXAMPLES_HOME_DIR = EXAMPLES_HOME + "/keycloak-examples-" + EXAMPLES_VERSION_SUFFIX;
+ if (!System.getProperty("unpacked.container.folder.name","").isEmpty()) {
+ EXAMPLES_HOME_DIR = EXAMPLES_HOME + "/" + System.getProperty("unpacked.container.folder.name","") + "-examples";
+ TEST_APPS_HOME_DIR = EXAMPLES_HOME + "/" + System.getProperty("unpacked.container.folder.name","") + "-test-apps";
+ } else {
+ EXAMPLES_HOME_DIR = EXAMPLES_HOME + "/keycloak-examples-" + EXAMPLES_VERSION_SUFFIX;
+ TEST_APPS_HOME_DIR = EXAMPLES_HOME + "/Keycloak-" + EXAMPLES_VERSION_SUFFIX + "-test-apps";
+ }
EXAMPLES_WEB_XML = EXAMPLES_HOME + "/web.xml";
}
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/AbstractJSConsoleExampleAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/AbstractJSConsoleExampleAdapterTest.java
old mode 100644
new mode 100755
index 3251c3497a..e4c9226f97
--- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/AbstractJSConsoleExampleAdapterTest.java
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/AbstractJSConsoleExampleAdapterTest.java
@@ -73,7 +73,7 @@ public abstract class AbstractJSConsoleExampleAdapterTest extends AbstractExampl
@Override
public void addAdapterTestRealms(List testRealms) {
- RealmRepresentation jsConsoleRealm = loadRealm(new File(EXAMPLES_HOME_DIR + "/js-console/example-realm.json"));
+ RealmRepresentation jsConsoleRealm = loadRealm(new File(TEST_APPS_HOME_DIR + "/js-console/example-realm.json"));
fixClientUrisUsingDeploymentUrl(jsConsoleRealm,
JSConsoleExample.CLIENT_ID, jsConsoleExamplePage.buildUri().toASCIIString());
@@ -96,6 +96,7 @@ public abstract class AbstractJSConsoleExampleAdapterTest extends AbstractExampl
pause(1000);
+ jsConsoleExamplePage.init();
jsConsoleExamplePage.logIn();
testRealmLoginPage.form().login("user", "invalid-password");
assertCurrentUrlDoesntStartWith(jsConsoleExamplePage);
@@ -105,14 +106,17 @@ public abstract class AbstractJSConsoleExampleAdapterTest extends AbstractExampl
testRealmLoginPage.form().login("user", "password");
assertCurrentUrlStartsWith(jsConsoleExamplePage);
- assertTrue(driver.getPageSource().contains("Init Success (Authenticated)"));
- assertTrue(driver.getPageSource().contains("Auth Success"));
+ jsConsoleExamplePage.init();
+ assertTrue(jsConsoleExamplePage.getOutputText().contains("Init Success (Authenticated)"));
+ assertTrue(jsConsoleExamplePage.getEventsText().contains("Auth Success"));
pause(1000);
jsConsoleExamplePage.logOut();
assertCurrentUrlStartsWith(jsConsoleExamplePage);
- assertTrue(driver.getPageSource().contains("Init Success (Not Authenticated)"));
+ jsConsoleExamplePage.init();
+
+ assertTrue(jsConsoleExamplePage.getOutputText().contains("Init Success (Not Authenticated)"));
}
@Test
@@ -120,38 +124,41 @@ public abstract class AbstractJSConsoleExampleAdapterTest extends AbstractExampl
jsConsoleExamplePage.navigateTo();
assertCurrentUrlStartsWith(jsConsoleExamplePage);
+ jsConsoleExamplePage.init();
jsConsoleExamplePage.refreshToken();
- assertTrue(driver.getPageSource().contains("Failed to refresh token"));
+ assertTrue(jsConsoleExamplePage.getOutputText().contains("Failed to refresh token"));
jsConsoleExamplePage.logIn();
testRealmLoginPage.form().login("user", "password");
assertCurrentUrlStartsWith(jsConsoleExamplePage);
- assertTrue(driver.getPageSource().contains("Auth Success"));
+ jsConsoleExamplePage.init();
+ assertTrue(jsConsoleExamplePage.getEventsText().contains("Auth Success"));
jsConsoleExamplePage.refreshToken();
- assertTrue(driver.getPageSource().contains("Auth Refresh Success"));
+ assertTrue(jsConsoleExamplePage.getEventsText().contains("Auth Refresh Success"));
}
@Test
public void testRefreshTokenIfUnder30s() {
jsConsoleExamplePage.navigateTo();
assertCurrentUrlStartsWith(jsConsoleExamplePage);
-
+ jsConsoleExamplePage.init();
jsConsoleExamplePage.refreshToken();
- assertTrue(driver.getPageSource().contains("Failed to refresh token"));
+ assertTrue(jsConsoleExamplePage.getOutputText().contains("Failed to refresh token"));
jsConsoleExamplePage.logIn();
testRealmLoginPage.form().login("user", "password");
assertCurrentUrlStartsWith(jsConsoleExamplePage);
- assertTrue(driver.getPageSource().contains("Auth Success"));
+ jsConsoleExamplePage.init();
+ assertTrue(jsConsoleExamplePage.getEventsText().contains("Auth Success"));
jsConsoleExamplePage.refreshTokenIfUnder30s();
- assertTrue(driver.getPageSource().contains("Token not refreshed, valid for"));
+ assertTrue(jsConsoleExamplePage.getOutputText().contains("Token not refreshed, valid for"));
pause((TOKEN_LIFESPAN_LEEWAY + 2) * 1000);
jsConsoleExamplePage.refreshTokenIfUnder30s();
- assertTrue(driver.getPageSource().contains("Auth Refresh Success"));
+ assertTrue(jsConsoleExamplePage.getEventsText().contains("Auth Refresh Success"));
}
@Test
@@ -159,17 +166,18 @@ public abstract class AbstractJSConsoleExampleAdapterTest extends AbstractExampl
jsConsoleExamplePage.navigateTo();
assertCurrentUrlStartsWith(jsConsoleExamplePage);
+ jsConsoleExamplePage.init();
jsConsoleExamplePage.getProfile();
- assertTrue(driver.getPageSource().contains("Failed to load profile"));
+ assertTrue(jsConsoleExamplePage.getOutputText().contains("Failed to load profile"));
jsConsoleExamplePage.logIn();
testRealmLoginPage.form().login("user", "password");
assertCurrentUrlStartsWith(jsConsoleExamplePage);
- assertTrue(driver.getPageSource().contains("Auth Success"));
+ jsConsoleExamplePage.init();
+ assertTrue(jsConsoleExamplePage.getEventsText().contains("Auth Success"));
jsConsoleExamplePage.getProfile();
- assertTrue(driver.getPageSource().contains("Failed to load profile"));
- assertTrue(driver.getPageSource().contains("\"username\": \"user\""));
+ assertTrue(jsConsoleExamplePage.getOutputText().contains("\"username\": \"user\""));
}
@Test
@@ -194,6 +202,7 @@ public abstract class AbstractJSConsoleExampleAdapterTest extends AbstractExampl
testRealmResource().update(realm);
jsConsoleExamplePage.navigateTo();
+ jsConsoleExamplePage.init();
jsConsoleExamplePage.logIn();
testRealmLoginPage.form().login("user", "password");
@@ -201,12 +210,14 @@ public abstract class AbstractJSConsoleExampleAdapterTest extends AbstractExampl
assertTrue(oAuthGrantPage.isCurrent());
oAuthGrantPage.accept();
- assertTrue(driver.getPageSource().contains("Init Success (Authenticated)"));
+ jsConsoleExamplePage.init();
+ assertTrue(jsConsoleExamplePage.getOutputText().contains("Init Success (Authenticated)"));
applicationsPage.navigateTo();
applicationsPage.revokeGrantForApplication("js-console");
jsConsoleExamplePage.navigateTo();
+ jsConsoleExamplePage.init();
jsConsoleExamplePage.logIn();
assertTrue(oAuthGrantPage.isCurrent());
@@ -223,7 +234,7 @@ public abstract class AbstractJSConsoleExampleAdapterTest extends AbstractExampl
resultList.get(0).findElement(By.xpath(".//td[text()='REVOKE_GRANT']"));
resultList.get(0).findElement(By.xpath(".//td[text()='Client']/../td[text()='account']"));
- resultList.get(0).findElement(By.xpath(".//td[text()='IP Address']/../td[text()='127.0.0.1']"));
+ resultList.get(0).findElement(By.xpath(".//td[text()='IP Address']/../td[text()='127.0.0.1' or text()='0:0:0:0:0:0:0:1']"));
resultList.get(0).findElement(By.xpath(".//td[text()='revoked_client']/../td[text()='js-console']"));
loginEventsPage.table().reset();
@@ -235,9 +246,87 @@ public abstract class AbstractJSConsoleExampleAdapterTest extends AbstractExampl
resultList.get(0).findElement(By.xpath(".//td[text()='LOGIN']"));
resultList.get(0).findElement(By.xpath(".//td[text()='Client']/../td[text()='js-console']"));
- resultList.get(0).findElement(By.xpath(".//td[text()='IP Address']/../td[text()='127.0.0.1']"));
+ resultList.get(0).findElement(By.xpath(".//td[text()='IP Address']/../td[text()='127.0.0.1' or text()='0:0:0:0:0:0:0:1']"));
resultList.get(0).findElement(By.xpath(".//td[text()='username']/../td[text()='user']"));
resultList.get(0).findElement(By.xpath(".//td[text()='consent']/../td[text()='consent_granted']"));
}
+
+ @Test
+ public void implicitFlowTest() {
+ jsConsoleExamplePage.navigateTo();
+ jsConsoleExamplePage.setFlow("implicit");
+ jsConsoleExamplePage.init();
+
+ jsConsoleExamplePage.logIn();
+ assertTrue(driver.getPageSource().contains("Implicit flow is disabled for the client"));
+
+ setImplicitFlowFroClient();
+
+ jsConsoleExamplePage.navigateTo();
+ jsConsoleExamplePage.init();
+ jsConsoleExamplePage.logIn();
+ assertTrue(driver.getPageSource().contains("Standard flow is disabled for the client"));
+
+ logInAndInit("implicit");
+
+ assertTrue(jsConsoleExamplePage.getOutputText().contains("Init Success (Authenticated)"));
+ }
+
+ @Test
+ public void implicitFlowQueryTest() {
+ setImplicitFlowFroClient();
+
+ jsConsoleExamplePage.navigateTo();
+ jsConsoleExamplePage.setFlow("implicit");
+ jsConsoleExamplePage.setResponseMode("query");
+ jsConsoleExamplePage.init();
+ jsConsoleExamplePage.logIn();
+ assertTrue(driver.getPageSource().contains("Invalid parameter: response_mode"));
+ }
+
+ @Test
+ public void implicitFlowRefreshTokenTest() {
+ setImplicitFlowFroClient();
+
+ logInAndInit("implicit");
+
+ jsConsoleExamplePage.refreshToken();
+
+ assertTrue(jsConsoleExamplePage.getOutputText().contains("Failed to refresh token"));
+ }
+
+ @Test
+ public void implicitFlowOnTokenExpireTest() {
+ RealmRepresentation realm = testRealmResource().toRepresentation();
+ realm.setAccessTokenLifespanForImplicitFlow(5);
+ testRealmResource().update(realm);
+
+ setImplicitFlowFroClient();
+
+ logInAndInit("implicit");
+
+ pause(5000);
+
+ assertTrue(jsConsoleExamplePage.getEventsText().contains("Access token expired"));
+ }
+
+ private void setImplicitFlowFroClient() {
+ ClientResource clientResource = ApiUtil.findClientResourceByClientId(testRealmResource(), "js-console");
+ ClientRepresentation client = clientResource.toRepresentation();
+ client.setImplicitFlowEnabled(true);
+ client.setStandardFlowEnabled(false);
+ clientResource.update(client);
+ }
+
+ private void logInAndInit(String flow) {
+ jsConsoleExamplePage.navigateTo();
+ jsConsoleExamplePage.setFlow(flow);
+ jsConsoleExamplePage.init();
+ jsConsoleExamplePage.logIn();
+ testRealmLoginPage.form().login("user", "password");
+ jsConsoleExamplePage.setFlow(flow);
+ jsConsoleExamplePage.init();
+ }
+
}
diff --git a/testsuite/integration-arquillian/tests/other/adapters/jboss/eap/src/test/java/org/keycloak/testsuite/adapter/example/EAPJSConsoleExampleAdapterTest.java b/testsuite/integration-arquillian/tests/other/adapters/jboss/eap/src/test/java/org/keycloak/testsuite/adapter/example/EAPJSConsoleExampleAdapterTest.java
new file mode 100644
index 0000000000..0674eeacd9
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/other/adapters/jboss/eap/src/test/java/org/keycloak/testsuite/adapter/example/EAPJSConsoleExampleAdapterTest.java
@@ -0,0 +1,13 @@
+package org.keycloak.testsuite.adapter.example;
+
+import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
+import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
+import org.junit.Ignore;
+/**
+ * @author tkyjovsk
+ */
+@AppServerContainer("app-server-eap")
+//@AdapterLibsLocationProperty("adapter.libs.eap")
+public class EAPJSConsoleExampleAdapterTest extends AbstractJSConsoleExampleAdapterTest {
+
+}
diff --git a/testsuite/integration-arquillian/tests/other/adapters/jboss/eap6/src/test/java/org/keycloak/testsuite/adapter/example/EAP6JSConsoleExampleAdapterTest.java b/testsuite/integration-arquillian/tests/other/adapters/jboss/eap6/src/test/java/org/keycloak/testsuite/adapter/example/EAP6JSConsoleExampleAdapterTest.java
index 20bd52eb57..4f167baf2f 100644
--- a/testsuite/integration-arquillian/tests/other/adapters/jboss/eap6/src/test/java/org/keycloak/testsuite/adapter/example/EAP6JSConsoleExampleAdapterTest.java
+++ b/testsuite/integration-arquillian/tests/other/adapters/jboss/eap6/src/test/java/org/keycloak/testsuite/adapter/example/EAP6JSConsoleExampleAdapterTest.java
@@ -1,5 +1,6 @@
package org.keycloak.testsuite.adapter.example;
+import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.junit.Ignore;
/**
@@ -7,7 +8,6 @@ import org.junit.Ignore;
*/
@AppServerContainer("app-server-eap6")
//@AdapterLibsLocationProperty("adapter.libs.eap6")
-@Ignore //jsconsole example has hardcoded relative path to keycloak.js
public class EAP6JSConsoleExampleAdapterTest extends AbstractJSConsoleExampleAdapterTest {
}
diff --git a/testsuite/integration-arquillian/tests/other/adapters/jboss/wildfly/src/test/java/org/keycloak/testsuite/adapter/example/WildflyJSConsoleExampleAdapterTest.java b/testsuite/integration-arquillian/tests/other/adapters/jboss/wildfly/src/test/java/org/keycloak/testsuite/adapter/example/WildflyJSConsoleExampleAdapterTest.java
new file mode 100644
index 0000000000..783446103b
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/other/adapters/jboss/wildfly/src/test/java/org/keycloak/testsuite/adapter/example/WildflyJSConsoleExampleAdapterTest.java
@@ -0,0 +1,16 @@
+
+package org.keycloak.testsuite.adapter.example;
+
+import org.keycloak.testsuite.arquillian.annotation.AdapterLibsLocationProperty;
+import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
+
+
+/**
+ *
+ * @author tkyjovsk
+ */
+@AppServerContainer("app-server-wildfly")
+//@AdapterLibsLocationProperty("adapter.libs.wildfly")
+public class WildflyJSConsoleExampleAdapterTest extends AbstractJSConsoleExampleAdapterTest {
+
+}
diff --git a/testsuite/integration-arquillian/tests/other/adapters/pom.xml b/testsuite/integration-arquillian/tests/other/adapters/pom.xml
index 518d184807..4189dad2e9 100644
--- a/testsuite/integration-arquillian/tests/other/adapters/pom.xml
+++ b/testsuite/integration-arquillian/tests/other/adapters/pom.xml
@@ -220,8 +220,8 @@
war
- org.keycloak.example.demo
- js-console
+ org.keycloak.testsuite
+ integration-arquillian-test-apps-js-console
${project.version}
war
@@ -287,6 +287,13 @@
zip
**/*realm.json,**/testsaml.json
+
+ org.keycloak.testsuite
+ integration-arquillian-test-apps-dist
+ ${project.version}
+ zip
+ **/*realm.json,**/testsaml.json
+
${examples.home}
true