From 2945eb63b79732746b0cda97efa7c325976d13f1 Mon Sep 17 00:00:00 2001 From: aboullos Date: Mon, 23 Mar 2020 11:42:03 +0100 Subject: [PATCH] KEYCLOAK-8836 Add test to check product name on welcome page Modify import KEYCLOAK-8836 Add test to check product name on welcome page --- .../org/keycloak/testsuite/auth/page/WelcomePage.java | 10 +++++++++- .../testsuite/welcomepage/WelcomePageTest.java | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/auth/page/WelcomePage.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/auth/page/WelcomePage.java index d95f72a0bf..c65424e500 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/auth/page/WelcomePage.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/auth/page/WelcomePage.java @@ -21,6 +21,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; +import static org.keycloak.testsuite.util.UIUtils.getTextFromElement; import static org.keycloak.testsuite.util.UIUtils.setTextInputValue; import static org.keycloak.testsuite.util.UIUtils.clickLink; @@ -41,6 +42,9 @@ public class WelcomePage extends AuthServer { @FindBy(id = "create-button") private WebElement createButton; + @FindBy(css = ".welcome-header h1") + private WebElement welcomeMessage; + public boolean isPasswordSet() { return !(driver.getPageSource().contains("Please create an initial admin user to get started.") || driver.getPageSource().contains("You need local access to create the initial admin user.")); @@ -61,5 +65,9 @@ public class WelcomePage extends AuthServer { public void navigateToAdminConsole() { clickLink(driver.findElement(By.linkText("Administration Console"))); } - + + public String getWelcomeMessage() { + return getTextFromElement(welcomeMessage); + } + } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/welcomepage/WelcomePageTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/welcomepage/WelcomePageTest.java index ad93c8fc8e..a76092becc 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/welcomepage/WelcomePageTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/welcomepage/WelcomePageTest.java @@ -161,4 +161,14 @@ public class WelcomePageTest extends AbstractKeycloakTest { driver.getPageSource().contains("Invalid username or password.")); } + @Test + public void test_6_CheckProductNameOnWelcomePage() { + welcomePage.navigateTo(); + + String actualMessage = welcomePage.getWelcomeMessage(); + String expectedMessage = suiteContext.getAuthServerInfo().isEAP() ? "Red Hat Single Sign-On" : "Keycloak"; + + Assert.assertEquals("Welcome to " + expectedMessage, actualMessage); + } + }