diff --git a/ui-test/src/main/java/pages/EsignetIdpPage.java b/ui-test/src/main/java/pages/EsignetIdpPage.java new file mode 100644 index 000000000..28428d557 --- /dev/null +++ b/ui-test/src/main/java/pages/EsignetIdpPage.java @@ -0,0 +1,33 @@ +package pages; + +import base.BasePage; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; + +public class EsignetIdpPage extends BasePage { + + public EsignetIdpPage(WebDriver driver) { + super(driver); + PageFactory.initElements(driver, this); + } + + @FindBy(xpath = "//img[@class='brand-logo']") + WebElement brandLogo; + + @FindBy(id = "login-header") + WebElement loginHeader; + + public boolean isBrandLogoDisplayed() { + return isElementVisible(brandLogo); + } + + public boolean isLoginHeaderDisplayed() { + return isElementVisible(loginHeader); + } + + public boolean isIdpUIScreenDisplayed() { + return isBrandLogoDisplayed() && isLoginHeaderDisplayed(); + } +} diff --git a/ui-test/src/main/java/pages/HealthServicesPage.java b/ui-test/src/main/java/pages/HealthServicesPage.java new file mode 100644 index 000000000..77df782d2 --- /dev/null +++ b/ui-test/src/main/java/pages/HealthServicesPage.java @@ -0,0 +1,37 @@ +package pages; + +import base.BasePage; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; + +public class HealthServicesPage extends BasePage { + + public HealthServicesPage(WebDriver driver) { + super(driver); + PageFactory.initElements(driver, this); + } + + @FindBy(xpath = "//span[@class='title-font text-3xl text-gray-900 font-medium']") + WebElement healthPortalTitle; + + @FindBy(id = "sign-in-with-esignet") + WebElement signInWithEsignetButton; + + public boolean isHealthPortalTitleDisplayed() { + return isElementVisible(healthPortalTitle); + } + + public String getHealthPortalTitleText() { + return getText(healthPortalTitle); + } + + public boolean isSignInWithEsignetButtonDisplayed() { + return isElementVisible(signInWithEsignetButton); + } + + public void clickOnSignInWithEsignet() { + clickOnElement(signInWithEsignetButton); + } +} diff --git a/ui-test/src/main/java/stepdefinitions/MultilingualSupportStepDef.java b/ui-test/src/main/java/stepdefinitions/MultilingualSupportStepDef.java new file mode 100644 index 000000000..e4cdace75 --- /dev/null +++ b/ui-test/src/main/java/stepdefinitions/MultilingualSupportStepDef.java @@ -0,0 +1,74 @@ +package stepdefinitions; + +import static org.junit.Assert.assertTrue; +import java.time.Duration; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +import base.BaseTest; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import pages.HealthServicesPage; +import pages.EsignetIdpPage; +import utils.EsignetConfigManager; + +public class MultilingualSupportStepDef { + + public WebDriver driver; + BaseTest baseTest; + HealthServicesPage healthServicesPage; + EsignetIdpPage esignetIdpPage; + + public MultilingualSupportStepDef(BaseTest baseTest) { + this.baseTest = baseTest; + this.driver = BaseTest.getDriver(); + healthServicesPage = new HealthServicesPage(driver); + esignetIdpPage = new EsignetIdpPage(driver); + } + + @When("Launch the health services url") + public void launchTheHealthServicesUrl() { + String url = EsignetConfigManager.getproperty("baseurl"); + driver.get(url); + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); + wait.until(ExpectedConditions.titleContains("Health")); + } + + @Then("User should be redirected to Health service portal UI screen") + public void userShouldBeRedirectedToHealthServicePortalUIScreen() { + assertTrue("Health Portal title should be displayed", + healthServicesPage.isHealthPortalTitleDisplayed()); + } + + @Then("Verify whether launching url navigates to health service UI Screen") + public void verifyWhetherLaunchingUrlNavigatesToHealthServiceUIScreen() { + assertTrue("Health Portal title should be displayed", + healthServicesPage.isHealthPortalTitleDisplayed()); + } + + @When("User clicks on sign in with esignet option") + public void userClicksOnSignInWithEsignetOption() { + assertTrue("Sign in with esignet button should be displayed", + healthServicesPage.isSignInWithEsignetButtonDisplayed()); + healthServicesPage.clickOnSignInWithEsignet(); + + + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); + wait.until(ExpectedConditions.urlContains("esignet")); + } + + @Then("User should be redirected to IDP UI screen") + public void userShouldBeRedirectedToIdpUIScreen() { + assertTrue("IDP UI screen should be displayed", + esignetIdpPage.isIdpUIScreenDisplayed()); + } + + @Then("Verify user is redirected to IDP UI screen") + public void verifyUserIsRedirectedToIdpUIScreen() { + assertTrue("Brand logo should be displayed", + esignetIdpPage.isBrandLogoDisplayed()); + assertTrue("Login header should be displayed", + esignetIdpPage.isLoginHeaderDisplayed()); + } +} diff --git a/ui-test/src/main/resources/config.properties b/ui-test/src/main/resources/config.properties index 3464ac892..b3a7e4e62 100644 --- a/ui-test/src/main/resources/config.properties +++ b/ui-test/src/main/resources/config.properties @@ -1,26 +1,24 @@ # url -baseurl = - +baseurl = https://healthservices.es-qa.mosip.net/ # For single browser browserName=chrome - # For multi-browser execution runMultipleBrowsers=false browsers=chrome,edge - # For BrowserStack (required fields) browserVersion=latest browserStackOs=Windows osVersion=10 -runOnBrowserStack=true -threadCount=4 - +runOnBrowserStack=false +threadCount=1 # BrowserStack credentials browserstack_username= browserstack_access_key= - # Other flags -headless=true +headless=false mobileEmulation=false mobileDevice=Pixel 5 -explicitWaitTimeout= \ No newline at end of file +explicitWaitTimeout= +keycloak-external-url = https://iam.es-qa.mosip.net +mosip_components_base_urls = idauthentication=api-internal.qa-base.mosip.net; +enableDebug=yes \ No newline at end of file diff --git a/ui-test/src/main/resources/featurefiles/MultilingualSupport.feature b/ui-test/src/main/resources/featurefiles/MultilingualSupport.feature new file mode 100644 index 000000000..6fb430672 --- /dev/null +++ b/ui-test/src/main/resources/featurefiles/MultilingualSupport.feature @@ -0,0 +1,17 @@ +@smokeAndRegression +Feature: Multilingual Support + This feature file contains test cases for multilingual support functionality + +@smoke @multilingualSupport +Scenario: Verify whether launching url navigates to health service UI Screen + When Launch the health services url + Then Verify whether launching url navigates to health service UI Screen + And User should be redirected to Health service portal UI screen + +@smoke @multilingualSupport +Scenario: User click on sign in with esignet option displayed in healthService.com screen + When Launch the health services url + Then User should be redirected to Health service portal UI screen + When User clicks on sign in with esignet option + Then Verify user is redirected to IDP UI screen + And User should be redirected to IDP UI screen