diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f44d20ac..a79d42e9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,9 @@ jobs: tests: name: Jakarta runs-on: ubuntu-latest + strategy: + matrix: + group: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 diff --git a/jakarta/servlet-saml-service-provider/src/test/java/org/keycloak/quickstart/PageHelper.java b/jakarta/servlet-saml-service-provider/src/test/java/org/keycloak/quickstart/PageHelper.java index 9f6400418..bae945a44 100644 --- a/jakarta/servlet-saml-service-provider/src/test/java/org/keycloak/quickstart/PageHelper.java +++ b/jakarta/servlet-saml-service-provider/src/test/java/org/keycloak/quickstart/PageHelper.java @@ -20,7 +20,6 @@ import org.jboss.arquillian.drone.api.annotation.Drone; import org.jboss.arquillian.graphene.Graphene; import org.jboss.logging.Logger; -import org.junit.Assert; import org.openqa.selenium.By; import org.openqa.selenium.TimeoutException; import org.openqa.selenium.WebDriver; @@ -37,6 +36,15 @@ public boolean isOnStartPage() { return browser.findElements(By.name("loginBtn")).size() > 0; } + public void waitForStartPage() { + fixStylesPage(); + try { + Graphene.waitAjax().until().element(By.name("loginBtn")).is().present(); + } catch (TimeoutException ex) { + throw new TimeoutException("timeout on page " + browser.getCurrentUrl(), ex); + } + } + public void waitForAccountBtn() { fixStylesPage(); try { @@ -61,4 +69,12 @@ public void isOnLoginPage() { throw new TimeoutException("timeout on page " + browser.getCurrentUrl(), ex); } } + + public void waitUntilTitle(String title) { + try { + Graphene.waitAjax().until((WebDriver driver) -> driver.getTitle().contains(title)); + } catch (TimeoutException ex) { + throw new TimeoutException("timeout on page " + browser.getCurrentUrl(), ex); + } + } } diff --git a/jakarta/servlet-saml-service-provider/src/test/java/org/keycloak/quickstart/SAMLServiceProviderTest.java b/jakarta/servlet-saml-service-provider/src/test/java/org/keycloak/quickstart/SAMLServiceProviderTest.java index e56e2177d..f2ad78494 100644 --- a/jakarta/servlet-saml-service-provider/src/test/java/org/keycloak/quickstart/SAMLServiceProviderTest.java +++ b/jakarta/servlet-saml-service-provider/src/test/java/org/keycloak/quickstart/SAMLServiceProviderTest.java @@ -108,6 +108,7 @@ public void setup() { public void testLogin() { try { indexPage.clickLogin(); + pageHelper.waitUntilTitle("Sign in to quickstart"); loginPage.login("alice", "alice"); // due to https://issues.redhat.com/browse/KEYCLOAK-14103 a second click to login is required // need to upgrade to Wildfly 19.1.0 to support a solution to this @@ -118,6 +119,7 @@ public void testLogin() { pageHelper.waitForAccountBtn(); assertEquals(profilePage.getUsername(), "alice"); profilePage.clickLogout(); + pageHelper.waitForStartPage(); assertTrue(pageHelper.isOnStartPage()); indexPage.clickLogin(); pageHelper.isOnLoginPage(); @@ -131,6 +133,7 @@ public void testLogin() { public void testAccessAccountManagement() { try { indexPage.clickLogin(); + pageHelper.waitUntilTitle("Sign in to quickstart"); loginPage.login("alice", "alice"); // due to https://issues.redhat.com/browse/KEYCLOAK-14103 a second click to login is required // need to upgrade to Wildfly 19.1.0 to support a solution to this @@ -140,6 +143,7 @@ public void testAccessAccountManagement() { } pageHelper.waitForAccountBtn(); profilePage.clickAccount(); + pageHelper.waitUntilTitle("Account Management"); assertTrue(webDriver.getTitle().contains("Account Management")); } catch (Exception e) { debugTest(e);