From 244848afc4ce82b0666fca8937044811a7cc88d4 Mon Sep 17 00:00:00 2001 From: mhajas Date: Fri, 16 Oct 2015 11:31:45 +0200 Subject: [PATCH] Fix events tests stability --- .../testsuite/console/events/AdminEventsTest.java | 15 +++++++++------ .../testsuite/console/events/LoginEventsTest.java | 15 ++++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/AdminEventsTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/AdminEventsTest.java index 5b22ca4f90..74418dd36c 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/AdminEventsTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/AdminEventsTest.java @@ -4,6 +4,7 @@ import org.jboss.arquillian.graphene.page.Page; import org.junit.Before; import org.junit.Test; import org.keycloak.representations.idm.ClientRepresentation; +import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.testsuite.admin.ApiUtil; import org.keycloak.testsuite.console.AbstractConsoleTest; import org.keycloak.testsuite.console.clients.AbstractClientTest; @@ -13,11 +14,11 @@ import org.keycloak.testsuite.console.page.events.Config; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static org.junit.Assert.assertEquals; - import javax.ws.rs.core.Response; import java.util.List; +import static org.junit.Assert.assertEquals; + /** * @author mhajas @@ -37,10 +38,12 @@ public class AdminEventsTest extends AbstractConsoleTest { @Before public void beforeAdminEventsTest() { - configPage.navigateTo(); - configPage.form().setSaveAdminEvents(true); - configPage.form().setIncludeRepresentation(true); - configPage.form().save(); + RealmRepresentation realm = testRealmResource().toRepresentation(); + + realm.setAdminEventsEnabled(true); + realm.setAdminEventsDetailsEnabled(true); + + testRealmResource().update(realm); } @Test diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java index d8d112463b..bb0ac8d06c 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java @@ -3,6 +3,7 @@ package org.keycloak.testsuite.console.events; import org.jboss.arquillian.graphene.page.Page; import org.junit.Before; import org.junit.Test; +import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.testsuite.admin.Users; import org.keycloak.testsuite.console.AbstractConsoleTest; import org.keycloak.testsuite.console.page.events.Config; @@ -10,6 +11,7 @@ import org.keycloak.testsuite.console.page.events.LoginEvents; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; +import java.util.Arrays; import java.util.List; import static org.junit.Assert.assertEquals; @@ -26,13 +28,12 @@ public class LoginEventsTest extends AbstractConsoleTest { @Before public void beforeLoginEventsTest() { - configPage.navigateTo(); - configPage.form().setSaveEvents(true); - configPage.form().waitForClearEventsButtonPresent(); - configPage.form().addSaveType("LOGIN"); - configPage.form().addSaveType("LOGIN_ERROR"); - configPage.form().addSaveType("LOGOUT"); - configPage.form().save(); + RealmRepresentation realm = testRealmResource().toRepresentation(); + + realm.setEventsEnabled(true); + realm.setEnabledEventTypes(Arrays.asList("LOGIN", "LOGIN_ERROR", "LOGOUT")); + + testRealmResource().update(realm); } @Test