From b44a0b480d0cf38eb5e5a27fe5e40642c2cdebfd Mon Sep 17 00:00:00 2001 From: Basant <139444457+basasnt32@users.noreply.github.com> Date: Fri, 8 Aug 2025 17:02:11 +0530 Subject: [PATCH 1/4] ES-2399:Automated testcases for Login feature Signed-off-by: Basant <139444457+basasnt32@users.noreply.github.com> --- .../src/main/java/pages/LoginOptionsPage.java | 334 +++++++++++++++++- .../LoginOptionsStepDefinition.java | 319 ++++++++++++++++- .../featurefiles/LoginOptions.feature | 127 ++++++- 3 files changed, 772 insertions(+), 8 deletions(-) diff --git a/ui-test/src/main/java/pages/LoginOptionsPage.java b/ui-test/src/main/java/pages/LoginOptionsPage.java index 2bf1a53b1..51f38e35f 100644 --- a/ui-test/src/main/java/pages/LoginOptionsPage.java +++ b/ui-test/src/main/java/pages/LoginOptionsPage.java @@ -1,10 +1,18 @@ package pages; import base.BasePage; + +import java.time.Duration; +import java.util.List; + +import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; public class LoginOptionsPage extends BasePage { @@ -18,10 +26,118 @@ public LoginOptionsPage(WebDriver driver) { @FindBy(xpath = "//img[@class='brand-logo']") WebElement brandLogo; - + @FindBy(id = "signup-url-button") WebElement signUpWithUnifiedLogin; + @FindBy(id = "login_with_pwd") + WebElement loginWithPasswordButton; + + @FindBy(id = "Password_KHM") + WebElement registeredMobileNumber; + + @FindBy(id = "Password_mobile") + WebElement passwordField; + + @FindBy(id = "verify_password") + WebElement loginButton; + + @FindBy(id = "error-banner-message") + WebElement invalidNumberError; + + @FindBy(id = "password-eye") + WebElement passwordEyeIcon; + + @FindBy(xpath = "//span[contains(text(),'Please Enter Valid Password')]") + WebElement invalidPasswordError; + + @FindBy(id = "error-banner-message") + WebElement invalidUsernameOrPasswordError; + + @FindBy(id = "error-close-button") + WebElement errorCloseIcon; + + @FindBy(id = "navbar-header") + WebElement proceedToAttentionScreen; + + @FindBy(id = "login-subheader") + WebElement userIsOnLogInEsignetPage; + + @FindBy(id = "proceed-button") + WebElement proceedButtonInAttentionPage; + + @FindBy(xpath = "//button[@class='inline-flex items-center justify-center whitespace-nowrap text-lg rounded-lg ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:bg-muted disabled:pointer-events-none bg-primary text-primary-foreground hover:bg-primary/90 h-[62px] py-2 px-[6rem] font-semibold sm:w-full sm:p-4']") + WebElement proceedButton; + + @FindBy(id = "mock-identity-verifier") + WebElement eKycServiceProvider; + + @FindBy(id = "proceed-preview-button") + WebElement proceedBtnInServiceProviderPage; + + @FindBy(id = "consent-button") + WebElement termsAndConditionCheckBox; + + @FindBy(id = "proceed-tnc-button") + WebElement proceedBtnInTandCPage; + + @FindBy(id = "proceed-preview-button") + WebElement proceedBtnInCameraPreviewPage; + + @FindBy(xpath = "//p[@class='text-[#4E4E4E] font-semibold']") + WebElement consentScreen; + + @FindBy(xpath = "//div[@class='text-center']") + WebElement headerScreenOnConsentPage; + + @FindBy(xpath = "//img[@class='object-contain client-logo-size']") + WebElement imageOfHealthCareDesign; + + @FindBy(xpath = "//img[@class='object-contain brand-only-logo client-logo-size']") + WebElement imageOfEsignetLogo; + + @FindBy(id = "essential_claims_tooltip") + WebElement essentialIicon; + + @FindBy(xpath = "//div[@class='divide-y']") + WebElement lookForEssentialClaims; + + @FindBy(id = "voluntary_claims_tooltip") + WebElement voluntarIicon; + + @FindBy(xpath = "//div[@class='divide-y']") + WebElement lookForVoluntarClaims; + + @FindBy(id = "continue") + WebElement allowButtonInConsentScreen; + + @FindBy(id = "cancel") + WebElement cancelButtonInConsentScreen; + + @FindBy(xpath = "//div[@class='react-tooltip styles-module_tooltip__mnnfp styles-module_dark__xNqje md:w-3/6 lg:max-w-sm m-0 md:m-auto styles-module_show__2NboJ']") + WebElement essentialClaimToolTipMessege; + + @FindBy(xpath = "//label[@class='text-sm text-[#01070DD5]']") + WebElement phoneNumberFieldUnderEssentialClaims; + + @FindBy(xpath = "//div[@class='relative text-center text-dark font-semibold text-xl text-[#2B3840] mt-4']") + WebElement cancelWarningHeader; + + @FindBy(xpath = "//p[@class='text-base text-[#707070]']") + WebElement cancelWarningMessage; + + @FindBy(xpath = "//button[@class='flex justify-center w-full font-medium rounded-lg text-sm px-5 py-4 text-center border-2 secondary-button']") + WebElement discontinueButton; + + @FindBy(xpath = "//button[@class='flex justify-center w-full font-medium rounded-lg text-sm px-5 py-4 text-center border-2 primary-button']") + WebElement stayButton; + + @FindBy(xpath = "//label[@labelfor='voluntary_claims']") + WebElement voluntaryClaimMasterToggle; + + @FindBy(xpath = "//span[@class='self-center text-2xl font-semibold whitespace-nowrap']") + WebElement welcomePageOfRelyingParty; + public void clickOnSignInWIthEsignet() { clickOnElement(signInWithEsignet); } @@ -29,13 +145,225 @@ public void clickOnSignInWIthEsignet() { public boolean isLogoDisplayed() { return isElementVisible(brandLogo); } - + public boolean isSignUpWithUnifiedLoginOptionDisplayed() { return isElementVisible(signUpWithUnifiedLogin); } - + public void clickOnSignUpWithUnifiedLogin() { clickOnElement(signUpWithUnifiedLogin); } + public boolean isLoginEsignetPageDisplayed() { + return userIsOnLogInEsignetPage.isDisplayed(); + } + + public void enterRegisteredMobileNumber(String number) { + registeredMobileNumber.clear(); + enterText(registeredMobileNumber, number); + } + + public void enterPassword(String Password) { + clearField(passwordField); + enterText(passwordField, Password); + } + + public void clickOnLoginButton() { + loginButton.click(); + } + /* + * public void enterOtpToLogin(String otp) { for (WebElement field : otpField) { + * field.click(); field.sendKeys(Keys.chord(Keys.CONTROL, "a")); + * field.sendKeys(Keys.BACK_SPACE); } for (int i = 0; i < otp.length(); i++) { + * WebElement field = otpField.get(i); field.click(); + * field.sendKeys(String.valueOf(otp.charAt(i))); } } + */ + + public void clickOnLoginWithPasswordOption() { + loginWithPasswordButton.click(); + } + + public boolean isInvalidNumberErrorDisplayed() { + return invalidNumberError.isDisplayed(); + } + + public void userTaboutOfPasswordField() { + clickOnElement(passwordEyeIcon); + } + + public boolean isInvalidPasswordErrorDisplayed() { + return invalidPasswordError.isDisplayed(); + } + + public boolean isInvalidUsernameOrPasswordErrorDisplayed() { + return invalidUsernameOrPasswordError.isDisplayed(); + } + + public boolean isLoginButtonEnabled() { + return isButtonEnabled(loginButton); + } + + public void clickOnErrorCloseIcon() { + clickOnElement(errorCloseIcon); + } + + public void verifyErrorDisappearsAfterClose() { + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(2)); + wait.until(ExpectedConditions.invisibilityOf(invalidUsernameOrPasswordError)); + } + + public void verifyErrorMessageDisappearsAfterTenSeconds() { + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(12)); + wait.until(ExpectedConditions.invisibilityOf(invalidUsernameOrPasswordError)); + } + + public boolean isOnAttentionScreen() { + return proceedToAttentionScreen.isDisplayed(); + } + + public void clickOnProceedButtonInAttentionPage() { + clickOnElement(proceedButtonInAttentionPage); + } + + public void clickOnProceedButton() { + clickOnElement(proceedButton); + } + + public void clickOnMockIdentifyVerifier() { + clickOnElement(eKycServiceProvider); + } + + public void clickOnProceedButtonInServiceProviderPage() { + clickOnElement(proceedBtnInServiceProviderPage); + } + + public void checkTermsAndConditions() { + if (!termsAndConditionCheckBox.isSelected()) { + clickOnElement(termsAndConditionCheckBox); + } + } + + public void clickOnProceedButtonInTermsAndConditionPage() { + clickOnElement(proceedBtnInTandCPage); + } + + public void clickOnProceedButtonInCameraPreviewPage() { + clickWhenClickable(proceedBtnInCameraPreviewPage); + } + + public void waitUntilLivenessCheckCompletes() { + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(50)); + wait.until(ExpectedConditions.visibilityOf(allowButtonInConsentScreen)); + } + + private void clickWhenClickable(WebElement element) { + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30)); + WebElement stableElement = wait + .until(ExpectedConditions.refreshed(ExpectedConditions.elementToBeClickable(element))); + stableElement.click(); + } + + public boolean isConsentSceenDisplayed() { + return headerScreenOnConsentPage.isDisplayed(); + } + + public boolean areLogosDisplayed() { + return imageOfHealthCareDesign.isDisplayed() && imageOfEsignetLogo.isDisplayed(); + } + + public boolean isEssentialIconDisplayed() { + return essentialIicon.isDisplayed(); + } + + public boolean isEssentialClaimsDisplayed() { + return lookForEssentialClaims.isDisplayed(); + } + + public boolean isVoluntaryClaimsIconDisplayed() { + return voluntarIicon.isDisplayed(); + } + + public boolean isVoluntaryClaimsDisplayed() { + return lookForVoluntarClaims.isDisplayed(); + } + + public boolean isAllowButtonInConsentScreenVisible() { + return allowButtonInConsentScreen.isDisplayed(); + } + + public boolean isCancelButtonInConsentScreenVisible() { + return cancelButtonInConsentScreen.isDisplayed(); + } + + public void clickOnEssentialTooltipIcon() { + clickOnElement(essentialIicon); + } + + public String getEssentialClaimsTooltipText() { + Actions actions = new Actions(driver); + actions.moveToElement(essentialIicon).perform(); + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); + WebElement tooltip = wait.until(ExpectedConditions.visibilityOf(essentialClaimToolTipMessege)); + return tooltip.getText(); + } + + public boolean isPhoneNumberListedUnderEssentialClaims() { + return phoneNumberFieldUnderEssentialClaims.isDisplayed(); + } + + public boolean isPhoneNumberFieldNonEditable() { + String tagName = phoneNumberFieldUnderEssentialClaims.getTagName(); + return tagName.equalsIgnoreCase("label"); + } + + public void clickOnCancelBtnInConsentScreen() { + clickOnElement(cancelButtonInConsentScreen); + } + + public boolean isCancelWarningHeaderDisplayed() { + return cancelWarningHeader.isDisplayed(); + } + + public boolean isCancelWarningMessageDisplayed() { + return cancelWarningMessage.isDisplayed(); + } + + public boolean isStayButtonDisplayed() { + return stayButton.isDisplayed(); + } + + public boolean isDiscontinueButtonDisplayed() { + return discontinueButton.isDisplayed(); + } + + public void clickOnStayBtnInConsentScreen() { + clickOnElement(stayButton); + } + + public boolean isRetainsOnConsentSceenDisplayed() { + return headerScreenOnConsentPage.isDisplayed(); + } + + public void clickOnDiscontinueButton() { + clickOnElement(discontinueButton); + } + + public boolean isHealthPortalPageDisplayed() { + return signInWithEsignet.isDisplayed(); + } + + public void enableMasterToggleVoluntaryClaims() { + if (!voluntaryClaimMasterToggle.isSelected()) { + voluntaryClaimMasterToggle.click(); + } + } + + public void clickOnAllowBtnInConsentScreen() { + clickOnElement(allowButtonInConsentScreen); + } + + public boolean isWelcomePageDisplayed() { + return welcomePageOfRelyingParty.isDisplayed(); + } + } diff --git a/ui-test/src/main/java/stepdefinitions/LoginOptionsStepDefinition.java b/ui-test/src/main/java/stepdefinitions/LoginOptionsStepDefinition.java index 002324810..9ac9f28f0 100644 --- a/ui-test/src/main/java/stepdefinitions/LoginOptionsStepDefinition.java +++ b/ui-test/src/main/java/stepdefinitions/LoginOptionsStepDefinition.java @@ -1,33 +1,344 @@ package stepdefinitions; import static org.junit.Assert.assertTrue; +import static org.testng.Assert.assertFalse; import org.openqa.selenium.WebDriver; +import org.testng.Assert; + import base.BaseTest; +import io.cucumber.java.en.And; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; import pages.LoginOptionsPage; +import pages.RegistrationPage; public class LoginOptionsStepDefinition { - + public WebDriver driver; BaseTest baseTest; LoginOptionsPage loginOptionsPage; - + RegistrationPage registrationPage; + public LoginOptionsStepDefinition(BaseTest baseTest) { this.baseTest = baseTest; this.driver = BaseTest.getDriver(); loginOptionsPage = new LoginOptionsPage(driver); + registrationPage = new RegistrationPage(driver); } - + @Given("click on Sign In with eSignet") public void clickOnSignInWithEsignet() { loginOptionsPage.clickOnSignInWIthEsignet(); } - + @Then("validate that the logo is displayed") public void validateTheLogo() { assertTrue(loginOptionsPage.isLogoDisplayed()); } + + @Then("user clicks on continue button on success page") + public void userClicksOnContinueButtonOnSuccessPage() { + registrationPage.clickOnContinueButtonInSucessScreen(); + } + + @And("user prolonged to registration page") + public void user_prolonged_to_registration_page() { + Assert.assertTrue(registrationPage.isProlongedToRegistrationPageVisible(), + "Registration page container should be visible"); + } + + @And("user click out side on password field") + public void userClickOutsideOnPasswordField() { + registrationPage.tabsOutOfField(); + } + + @Then("verify invalid password error should be shown") + public void verifyInvalidPasswordErrorShouldBeShown() { + Assert.assertTrue(registrationPage.isInvalidPasswordErrorVisible(), "Invalid password error should be shown"); + } + + @When("user enters {string} into the password field") + public void enterLongPasswordIntoPasswordField(String Password) { + registrationPage.enterPassword(Password); + } + + @Then("system should restrict password input to max allowed") + public void systemShouldRestrictPasswordInputToMaxAllowed() { + Assert.assertTrue(registrationPage.isPasswordRestrictionMessageDisplayed(), + "Password restriction message should be visible"); + } + + @When("user enters {string} into password field for confirm") + public void user_enters_confirm_password(String confirmPassword) { + registrationPage.enterConfirmPassword(confirmPassword); + } + + @And("user clicks on agrees terms condition check-box") + public void userClicksOnAgreesTermsCheckbox() { + registrationPage.checkTermsAndConditions(); + } + + @Then("user clicks on continue button on registration page") + public void userClicksOnContinueButtonOnRegistrationPage() { + registrationPage.clickOnSetupAccountContinueButton(); + } + + @Then("it will redirect to congratulations on login page") + public void verifyCongratulationPageIsDisplayed() { + Assert.assertTrue(registrationPage.isCongratulationScreenDisplayed(), "Congratulations page should be visible"); + } + + @Then("user clicks on login button") + public void user_clicks_on_login_button() { + registrationPage.clickOnLoginButtonInSuccessScreen(); + } + + @Then("verify user is redirected to login page of relying portal") + public void redirectedToLoginUsingEsignetPage() { + Assert.assertTrue(loginOptionsPage.isLoginEsignetPageDisplayed(), + "User should be redirected to login using e-Signet page"); + } + + @And("user clicks on login with password button") + public void user_clicks_on_login_with_password_button() { + loginOptionsPage.clickOnLoginWithPasswordOption(); + } + + @Then("verify login button is disabled") + public void verifyLoginButtonIsDisabled() { + assertFalse(loginOptionsPage.isLoginButtonEnabled()); + } + + @When("user enter {string} into mobile number field") + public void userEntersMobileNumber(String number) { + loginOptionsPage.enterRegisteredMobileNumber(number); + } + + @Then("user enters {string} into password field") + public void userFillsConfirmPasswordField(String Password) { + loginOptionsPage.enterPassword(Password); + } + + @And("user clicks on login button in login page") + public void userClicksOnLoginBtnInLoginPage() { + loginOptionsPage.clickOnLoginButton(); + } + + @Then("verify error Please Enter Valid Individual ID. is displayed") + public void verifyInvalidErrorDisplayed() { + assertTrue(loginOptionsPage.isInvalidNumberErrorDisplayed()); + } + + @And("user tabout of password field") + public void userTabOut() { + loginOptionsPage.userTaboutOfPasswordField(); + } + + @Then("verify error Please Enter Valid Password is displayed") + public void verifyInvalidPasswordErrorDisplayed() { + assertTrue(loginOptionsPage.isInvalidPasswordErrorDisplayed()); + } + + @Then("verify error Username or password is not valid. Please enter valid credentials. is displayed") + public void verifyInvalidUsernameOrPasswordErrorDisplayed() { + assertTrue(loginOptionsPage.isInvalidUsernameOrPasswordErrorDisplayed()); + } + + @When("user click on the close icon in error message") + public void userClickOnErrorCloseIcon() { + loginOptionsPage.clickOnErrorCloseIcon(); + } + + @Then("verify the error message disappears") + public void verifyErrorMessageIsGone() { + loginOptionsPage.verifyErrorDisappearsAfterClose(); + } + + @Then("verify error message disappears automatically after 10 seconds") + public void waitForErrorMessageToDisappear() { + loginOptionsPage.verifyErrorMessageDisappearsAfterTenSeconds(); + } + + @Then("verify login button is enabled") + public void verifyLoginButtonIsEnabled() { + assertTrue(loginOptionsPage.isLoginButtonEnabled()); + } + + @Then("verify consent should ask user to proceed in attention page") + public void userGoesToAttentionScreen() { + Assert.assertTrue(loginOptionsPage.isOnAttentionScreen(), "User is not on the attention screen."); + } + + @And("clicks on proceed button in attention page") + public void clickOnProceedButtonInAttentionPage() { + loginOptionsPage.clickOnProceedButtonInAttentionPage(); + } + + @And("clicks on proceed button in next page") + public void clickOnProceedButtonInNextPage() { + loginOptionsPage.clickOnProceedButton(); + } + + @Then("select the e-kyc verification provider") + public void selectEKycVerificationProvider() { + loginOptionsPage.clickOnMockIdentifyVerifier(); + } + + @And("clicks on proceed button in e-kyc verification provider page") + public void clickOnProceedButton() { + loginOptionsPage.clickOnProceedButtonInServiceProviderPage(); + } + + @And("user select the check box in terms and condition page") + public void userSelectTheCheckBoxInTermsAndConditionPage() { + loginOptionsPage.checkTermsAndConditions(); + } + + @And("user clicks on proceed button in terms and condition page") + public void userClicksOnProceedButtonInTermsAndConditionPage() { + loginOptionsPage.clickOnProceedButtonInTermsAndConditionPage(); + } + + @And("user clicks on proceed button in camera preview page") + public void userClicksOnProceedButtonInCameraPreviewPage() { + loginOptionsPage.clickOnProceedButtonInCameraPreviewPage(); + } + + @Then("user is navigated to consent screen once liveness check completes") + public void waitUntilLivenessCheckCompletesInCameraPage() { + loginOptionsPage.waitUntilLivenessCheckCompletes(); + } + + @And("verify the header Please take appropriate action in xx:xx is displayed") + public void verifyConsentHeaderDisplayed() { + Assert.assertTrue(loginOptionsPage.isConsentSceenDisplayed(), "Consent page should be displayed"); + } + + @And("verify logos of the relying party and e-Signet is displayed") + public void verifyBothLogosAreDisplayed() { + Assert.assertTrue(loginOptionsPage.areLogosDisplayed(), + "Logos of relying party and e-Signet should be visible"); + } + + @And("verify the essential claims with \"i\" icon is displayed") + public void verifyEssentialIIconIsDisplayed() { + Assert.assertTrue(loginOptionsPage.isEssentialIconDisplayed(), + "\"i\" icon for essential claims should be visible"); + } + + @And("verify required essential claims is displayed") + public void verifyEssentialClaimsDisplayed() { + Assert.assertTrue(loginOptionsPage.isEssentialClaimsDisplayed(), "Essential claims should be displayed"); + } + + @And("verify the voluntary claims with \"i\" icon is displayed") + public void verifyVoluntaryClaimsIconIsDisplayed() { + Assert.assertTrue(loginOptionsPage.isVoluntaryClaimsIconDisplayed(), + "\"i\" icon for voluntary claims should be displayed"); + } + + @And("verify list of voluntary claims displayed") + public void verifyListOfVoluntaryClaimsDisplayed() { + Assert.assertTrue(loginOptionsPage.isVoluntaryClaimsDisplayed(), "Voluntary claims list is not displayed."); + } + + @And("verify allow button is visible consent screen") + public void verifyAllowButtonInConsentScreen() { + Assert.assertTrue(loginOptionsPage.isAllowButtonInConsentScreenVisible(), + "Allow button should be visible on Consent screen"); + } + + @And("verify cancel button is visible consent screen") + public void verifyCancelButtonInConsentScreen() { + Assert.assertTrue(loginOptionsPage.isCancelButtonInConsentScreenVisible(), + "Allow button should be visible on Consent screen"); + } + + @Then("verify the tooltip message for Essential Claims info icon") + public void verifyTooltipMessageForEssentialClaimsIcon() { + String expectedMessage = "Mandatory user information required by the Service provider"; + String actualTooltip = loginOptionsPage.getEssentialClaimsTooltipText(); + Assert.assertEquals(actualTooltip.trim(), expectedMessage, "Tooltip message does not match"); + } + + @And("verify Phone Number should be listed under Essential Claims") + public void verifyPhoneNumberListedUnderEssentialClaims() { + Assert.assertTrue(loginOptionsPage.isPhoneNumberListedUnderEssentialClaims(), + "Phone Number is not listed under Essential Claims"); + } + + @And("Verify the state of phone number field under Essential Claims") + public void verifyPhoneNumberFieldNonEditable() { + Assert.assertTrue(loginOptionsPage.isPhoneNumberFieldNonEditable(), + "Phone Number field is editable, but should be non-editable (label expected)."); + } + + @When("user click on cancel button in consent screen") + public void userClickOnCancelBtn() { + loginOptionsPage.clickOnCancelBtnInConsentScreen(); + } + + @Then("verify the header Please Confirm is displayed") + public void verifyWarningMessage() { + assertTrue(loginOptionsPage.isCancelWarningHeaderDisplayed()); + } + + @Then("verify the message Are you sure you want to discontinue the login process? is displayed") + public void verifyWarningHeader() { + assertTrue(loginOptionsPage.isCancelWarningMessageDisplayed()); + } + + @Then("verify discontinue button is displayed") + public void verifyDiscontinueButton() { + assertTrue(loginOptionsPage.isDiscontinueButtonDisplayed()); + } + + @Then("verify stay button is displayed") + public void verifWarningHeader() { + assertTrue(loginOptionsPage.isStayButtonDisplayed()); + } + + @When("user click on Stay button") + public void userClickOnStayBtn() { + loginOptionsPage.clickOnStayBtnInConsentScreen(); + } + + @Then("verify user is retained on same consent screen") + public void verifyOnSameConsentScreen() { + assertTrue(loginOptionsPage.isRetainsOnConsentSceenDisplayed()); + } + + @Then("user click on Discontinue button") + public void userClickOnDiscontinueBtn() { + loginOptionsPage.clickOnDiscontinueButton(); + } + + @And("verify user is redirected to relying party portal page") + public void verifyRedirectedToMainScreen() { + assertTrue(loginOptionsPage.isHealthPortalPageDisplayed()); + } + + @When("user enables the master toggle of voluntary claims") + public void enableMasterToggleOfVoluntaryClaims() { + loginOptionsPage.enableMasterToggleVoluntaryClaims(); + } + + @And("click on allow button in consent page") + public void userClickOnAllowButton() { + loginOptionsPage.clickOnAllowBtnInConsentScreen(); + } + + @Then("verify user is navigated to landing page of relying party") + public void verifyRedirectedToRelyingPartyPage() { + assertTrue(loginOptionsPage.isWelcomePageDisplayed()); + } + + @And("verify welcome message is displayed with the registered name") + public void verifyWelcomeWithNameIsDisplayed() { + assertTrue(loginOptionsPage.isWelcomePageDisplayed()); + } + } diff --git a/ui-test/src/main/resources/featurefiles/LoginOptions.feature b/ui-test/src/main/resources/featurefiles/LoginOptions.feature index b7ef6ec05..f34dd9a8b 100644 --- a/ui-test/src/main/resources/featurefiles/LoginOptions.feature +++ b/ui-test/src/main/resources/featurefiles/LoginOptions.feature @@ -10,4 +10,129 @@ Feature: Esignet Login Options Page #And validate that header is displayed #And validate that sub-header is displayed #And I validate the outcomes - #And check more outcomes \ No newline at end of file + #And check more outcomes + +@smoke @loginfeature +Scenario Outline: Verify the Login feature + Given click on Sign In with eSignet + When user clicks on the Sign-Up with Unified Login hyperlink + Then verify user is navigated to the Mobile Number Registration screen + Then user verify the mobile number text field should be pre-filled with country code + Then user verify a text box for entering an 8–9 digit mobile number + Then user verify a Continue button + + When user enters "" in the mobile number text box + Then validate that the Continue button enabled + And user clicks on the Continue button + Then verify user is navigated to the OTP screen + When user enters the complete 6-digit OTP + And user clicks on the Verify OTP button + + And verify user is redirected to the success screen + Then user clicks on continue button on success page + And user prolonged to registration page + When user enters text "" in the Full Name in Khmer field + When user enters "" into the password field + And user click out side on password field + Then verify invalid password error should be shown + When user enters "" into the password field + Then system should restrict password input to max allowed + When user enters "" into the password field + When user enters text "" in the Full Name in Khmer field + When user enters "" into the password field + When user enters "" into password field for confirm + And user clicks on agrees terms condition check-box + Then user clicks on continue button on registration page + Then it will redirect to congratulations on login page + And user clicks on login button + And verify user is redirected to login page of relying portal + And user clicks on login with password button + Then verify login button is disabled + + When user enter "" into mobile number field + Then verify login button is disabled + And user enters "" into password field + And user clicks on login button in login page + Then verify error Please Enter Valid Individual ID. is displayed + + When user clicks on the navigate back button + And user clicks on login with password button + When user enters "" into password field + Then verify login button is disabled + And user enter "<9 zero>" into mobile number field + And user clicks on login button in login page + Then verify error Please Enter Valid Individual ID. is displayed + + And user enter "" into mobile number field + And user enters "" into password field + And user tabout of password field + Then verify error Please Enter Valid Password is displayed + + When user enter "" into mobile number field + And user enters "" into password field + And user clicks on login button in login page + Then verify error Username or password is not valid. Please enter valid credentials. is displayed + When user click on the close icon in error message + Then verify the error message disappears + + When user enter "" into mobile number field + And user enters "" into password field + And user clicks on login button in login page + Then verify error Username or password is not valid. Please enter valid credentials. is displayed + Then verify error message disappears automatically after 10 seconds + + When user enter "" into mobile number field + And user enters "" into password field + And user clicks on login button in login page + Then verify error Please Enter Valid Password is displayed + + And user enter "" into mobile number field + And user enters "" into password field + And user tabout of password field + Then verify login button is enabled + And user clicks on login button in login page + Then verify consent should ask user to proceed in attention page + And clicks on proceed button in attention page + And clicks on proceed button in next page + Then select the e-kyc verification provider + And clicks on proceed button in e-kyc verification provider page + And user select the check box in terms and condition page + And user clicks on proceed button in terms and condition page + And user clicks on proceed button in camera preview page + Then user is navigated to consent screen once liveness check completes + And verify the header Please take appropriate action in xx:xx is displayed + And verify logos of the relying party and e-Signet is displayed + And verify the essential claims with "i" icon is displayed + And verify required essential claims is displayed + And verify the voluntary claims with "i" icon is displayed + And verify list of voluntary claims displayed + And verify allow button is visible consent screen + And verify cancel button is visible consent screen + Then verify the tooltip message for Essential Claims info icon + And verify Phone Number should be listed under Essential Claims + And Verify the state of phone number field under Essential Claims + When user click on cancel button in consent screen + Then verify the header Please Confirm is displayed + And verify the message Are you sure you want to discontinue the login process? is displayed + And verify discontinue button is displayed + And verify stay button is displayed + When user click on Stay button + Then verify user is retained on same consent screen + When user click on cancel button in consent screen + Then user click on Discontinue button + And verify user is redirected to relying party portal page + + Given click on Sign In with eSignet + And user clicks on login with password button + And user enter "" into mobile number field + And user enters "" into password field + And user clicks on login button in login page + + When user enables the master toggle of voluntary claims + And click on allow button in consent page + Then verify user is navigated to landing page of relying party + And verify welcome message is displayed with the registered name + +Examples: + | valid mobile number | shortPassword | longPassword | khmer name |valid name | valid password | confrimPassword | registered mobile number | specialCharacter| less than 8 digit | registered password | 9 zero | Unregistered password | Unregistered mobile number | random char | + | 74638418 | pa@12 | prodevtester@12345576 | បាសាន់ | អ៊ូសាស៊ី | Pass@2004 | Pass@2004 | 74638418 | #$%@#! | 96785 | Pass@2004 | 000000000 | pass@1234 | 87546789 | q1@13m | \ No newline at end of file From 073f9042ac3094186fcb811ac309d1f65b5c3518 Mon Sep 17 00:00:00 2001 From: Basant <139444457+basasnt32@users.noreply.github.com> Date: Thu, 14 Aug 2025 17:51:43 +0530 Subject: [PATCH 2/4] es-2399 Signed-off-by: Basant <139444457+basasnt32@users.noreply.github.com> --- .../stepdefinitions/L1OptionStepDefPage.java | 274 ++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100644 ui-test/src/main/java/stepdefinitions/L1OptionStepDefPage.java diff --git a/ui-test/src/main/java/stepdefinitions/L1OptionStepDefPage.java b/ui-test/src/main/java/stepdefinitions/L1OptionStepDefPage.java new file mode 100644 index 000000000..9af186573 --- /dev/null +++ b/ui-test/src/main/java/stepdefinitions/L1OptionStepDefPage.java @@ -0,0 +1,274 @@ +package stepdefinitions; + +import static org.junit.Assert.assertTrue; +import static org.testng.Assert.assertFalse; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.testng.Assert; + +import base.BaseTest; +import io.cucumber.java.en.And; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import pages.L1OptionPage; +import pages.R1Page; +import pages.S1Page; + +public class L1OptionStepDefPage { + public WebDriver driver; + BaseTest baseTest; + L1OptionPage L1OptionPage; + R1Page R1Page; + S1Page S1Page; + + public L1OptionStepDefPage(BaseTest baseTest) { + this.baseTest = baseTest; + this.driver = BaseTest.getDriver(); + L1OptionPage = new L1OptionPage(driver); + R1Page = new R1Page(driver); + S1Page = new S1Page(driver); + + } + + @Given("user is on relying Health Party Portal") + public void userIsOnRelyingHealthPartyPortal() { + S1Page.isUserOnRelyingPortal(); + } + + @Then("user clicks on signup with unified button") + public void userClicksOnSignupWithUnifiedButton() { + S1Page.clickOnSignUpWithUnifiedButton(); + } + + @Then("user is on esignet logo page") + public void userIsOnEsignetLogoPage() { + S1Page.verifyEsignetLogoPage(); + } + + @Then("user clicks on signup with unified login hyperlink button") + public void clickSignupWithUnifiedLoginHyperlinkButton() { + S1Page.clickSignupWithUnifiedLoginLink(); + } + + @And("user clicks on {string} in the same page") + public void userClicksOnValidMobileNumber(String mobileNumber) { + R1Page.clickValidMobileNumber(); + } + + @Then("continue button remains enabled") + public void continueButtonRemainsEnabled() { + Assert.assertTrue(R1Page.isContinueButtonEnabled(), "Continue button is not enabled"); + } + + @When("user clicks on continue button") + public void userClicksOnContinueButton() { + R1Page.clickPushOnContinueButton(); + } + + @Then("user should be redirected to Enter OTP page") + public void userShouldBeRedirectedToEnterOtpPage() { + R1Page.isEnterOtpPageDisplayed(); + } + + @Then("user enters complete 6 digit otp {string}") + public void userEntersComplete6DigitOtp(String otp) { + R1Page.enterCompleteOtp(otp); + } + + @Then("verify button should be enabled") + public void verifyButtonShouldBeEnabled() { + Assert.assertTrue(R1Page.isVerifyButtonEnabled(), "Verify button is not enabled"); + } + + @When("user clicks on the verify button") + public void userClicksOnVerifyButton() { + R1Page.clickPushOnContinueButton(); + } + + @Then("it will come to Your mobile number has been verified successfully page") + public void verifyMobileNumberSuccessfullyPage() { + Assert.assertTrue(R1Page.isSuccessFullScreenDisplayed()); + } + + @When("user clicks on continue button in success page") + public void userClicksOnContinueButtonInSuccessPage() { + R1Page.clickContinueButtonInSuccessPage(); + } + + @Then("it will be redirected to setup account page") + public void itWillBeRedirectedToSetupAccountPage() { + R1Page.verifySetUpAccountPageIsDisplayed(); + } + + @When("user enters on username which is not editable") + public void userClicksOnUsernameWhichIsNotEditable() { + R1Page.clickUsernameNoneditable(); + } + + @Then("user enters on {string} in khmer word") + public void userEntersOnInKhmerWord(String fullName) { + R1Page.enterFullNameInKhmer(fullName); + } + + @When("user enters {string} in the password field") + public void userEntersPassword(String password) { + R1Page.enterPassword(password); + } + + @And("user enters on {string} in the password field") + public void userEntersOnInThePasswordField(String confirmPasswordValue) { + R1Page.enterConfirmPassword(confirmPasswordValue); + } + + @And("user clicks on Agrees terms and condition checkbox in setup-account page") + public void userClicksOnTermsAndConditionCheckBoxInSetupAccountPage() { + R1Page.clickTermsAndConditionCheckBoxInSetupAccountPage(); + } + + @Then("continue button remains enabled in setup account page") + public void continueButtonRemainsEnabledInSetupAccountPage() { + Assert.assertTrue(R1Page.continueButtonEnabled()); + } + + @Then("user click on continue button in setup account page") + public void userClickOnContinueButtonInSetupAccountPage() { + R1Page.clickContinueInSetUpAccountPage(); + } + + @Then("congratulation screen is displayed") + public void congratulationScreenIsDisplayed() { + R1Page.isCongratulationsPageDisplayed(); + } + + @Then("user clicks on ok button in congratulation page") + public void userClicksOnOkButtonInCongratulationPage() { + R1Page.clickOkButtonInSuccessPage(); + } + + @Then("user is redirected to relying party portal page") + public void userIsRedirectedToRelyingPartyPortalPage() { + Assert.assertTrue(S1Page.isUserOnRelyingPortal()); + } + + @And("user clicks on Login with password") + public void userClicksOnLoginWithPassword() { + L1OptionPage.clickLoginWithPassword(); + } + + @And("user enters {string} in the field") + public void userEntersRegisteredMobileNumber(String mobileNumber) { + L1OptionPage.enterRegisteredMobileNumber(mobileNumber); + } + + @Then("user enters on {string} in the field") + public void userEntersRegisteredPassword(String password) { + L1OptionPage.enterRegisteredPassword(password); + } + + @And("user clicks on login in the same page") + public void userClicksOnLoginButton() { + L1OptionPage.clickLoginButton(); + } + + @Then("it will redirect to Health Portal is requesting access to the following page") + public void itWillRedirectToHealthPortalIsRequestingAccessToTheFollowingPage() { + Assert.assertTrue(L1OptionPage.isHealthPortalRequestPageDisplayed(), + "Health Portal access request page is not displayed"); + } + + @Then("user clicks on allow button in requesting access to the following page") + public void userClicksOnAllowButtonInRequestingAccessPage() { + L1OptionPage.clickAllowButtonInRequestAccessPage(); + } + + @Then("it will redirect to attention screen") + public void it_will_redirect_to_attention_screen() { + Assert.assertTrue(L1OptionPage.isAttentionPageDisplayed(), + "Attention page is not displayed after clicking allow button."); + } + + @Then("user clicks on proceed button in attention page") + public void user_clicks_on_proceed_button_in_attention_page() { + L1OptionPage.clickProceedButtonInAttentionPage(); + } + + @Then("it will redirect to Complete your eKYC verification with the below simple steps page") + public void itShouldRedirectToEkycVerificationPage() { + Assert.assertTrue(L1OptionPage.isEKYCVerificationPageDisplayed(), + "User is not redirected to the eKYC verification page"); + } + + @Then("clicks on proceed button in Complete your eKYC verification with the below simple steps page") + public void clicksOnProceedButtonInKycPage() { + L1OptionPage.clickProceedButtonInKycPage(); + } + + @Then("it goes to eKYC provider page") + public void it_goes_to_ekyc_provider_page() { + L1OptionPage.isEkycProviderPageDisplayed(); + } + + @Then("clicks on mock identity verifier") + public void clicks_on_mock_identity_verifier() { + L1OptionPage.clickMockIdentityVerifier(); + } + + @Then("proceed button is enabled in ekyc provider page") + public void proceed_button_is_enabled_in_ekyc_provider_page() { + Assert.assertTrue(L1OptionPage.isProceedButtonEnabledInMockPage()); + } + + @Then("user clicks on proceed button in ekyc provider page") + public void user_clicks_on_proceed_button_in_ekyc_provider_page() { + L1OptionPage.clickProceedButtonInMockPage(); + } + + @Then("it will redirect to terms and condition page of consent screen") + public void it_will_redirect_to_terms_and_condition_page_of_consent_screen() { + L1OptionPage.verifyRedirectToTermsAndConditionPage(); + } + + @Then("user clicks on checkbox in consent screen page") + public void userClicksOnCheckboxInConsentScreenPage() { + L1OptionPage.clickConsentCheckBox(); + } + + @Then("proceed button remains enabled in terms and condition page") + public void proceedButtonRemainsEnabledInTermsAndConditionPage() { + Assert.assertTrue(L1OptionPage.isProceedButtonEnabledInTcPage(), "Proceed button is not enabled in T&C page"); + } + + @Then("user clicks on proceed button in terms and condition box") + public void userClicksOnProceedButtonInTermsAndConditionPage() { + L1OptionPage.clickProceedButtonInTcPage(); + } + + @Then("User should be navigated to the camera page") + public void user_should_be_navigated_to_the_camera_page() { + assertTrue(L1OptionPage.isCameraPageDisplayed()); + } + + @Then("user navigates to liveness check complete steps") + public void waitUntilLivenessCheckCompletesInCameraPage() { + L1OptionPage.waitUntilLivenessCheckCompletes(); + } + + @And("user verify Please take appropriate action page displayed") + public void userVerifyPleaseTakeAppropriateActionPageDisplayed() { + Assert.assertTrue(L1OptionPage.isAppropriateActionPageDisplayed()); + } + + @Then("user clicks on allow button on visible consent screen") + public void userClicksOnAllowButtonOnVisibleConsentScreen() { + L1OptionPage.clickAllowButtonOnConsentScreen(); + } + + @Then("user redirected to welcome message of relying portal") + public void userRedirectedToWelcomeMessageOfRelyingPortal() { + Assert.assertTrue(L1OptionPage.isWelcomeMessageDisplayed()); + } + +} \ No newline at end of file From f41bac1ccca329358563a1fbd5832acae4e15a07 Mon Sep 17 00:00:00 2001 From: Basant <139444457+basasnt32@users.noreply.github.com> Date: Thu, 21 Aug 2025 16:59:53 +0530 Subject: [PATCH 3/4] ES-2400:signup features Signed-off-by: Basant <139444457+basasnt32@users.noreply.github.com> --- ui-test/src/main/java/pages/r1pages.java | 282 ++++++++++++++++++ ui-test/src/main/java/pages/s1pages.java | 45 +++ .../stepdefinitions/s1stepdefinition.java | 241 +++++++++++++++ .../featurefiles/SignUpFeatures.feature | 100 +++++++ 4 files changed, 668 insertions(+) create mode 100644 ui-test/src/main/java/pages/r1pages.java create mode 100644 ui-test/src/main/java/pages/s1pages.java create mode 100644 ui-test/src/main/java/stepdefinitions/s1stepdefinition.java create mode 100644 ui-test/src/main/resources/featurefiles/SignUpFeatures.feature diff --git a/ui-test/src/main/java/pages/r1pages.java b/ui-test/src/main/java/pages/r1pages.java new file mode 100644 index 000000000..9daee7af9 --- /dev/null +++ b/ui-test/src/main/java/pages/r1pages.java @@ -0,0 +1,282 @@ +package pages; + +import base.BasePage; +import utils.EsignetConfigManager; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +import java.util.List; +import java.time.Duration; + +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.Keys; + +public class r1pages extends BasePage { + + public r1pages(WebDriver driver) { + super(driver); + PageFactory.initElements(driver, this); + } + + @FindBy(xpath = "//div[@class='grow px-3 text-center font-semibold tracking-normal xs:px-2']") + WebElement redirectToRegistration; + + @FindBy(xpath = "//div[@class='grow px-3 text-center font-semibold tracking-normal xs:px-2']") + WebElement headerInRegistrationScreen; + + @FindBy(id = "phone_input") + WebElement enterMobileNumberTextField; + + @FindBy(id = "continue-button") + WebElement continueButtonDisplayed; + + @FindBy(id = "continue-button") + WebElement placeholderOutside; + + @FindBy(id = "back-button") + WebElement backButtonDisplayed; + + @FindBy(id = "language-select-button") + WebElement languageSelectionOption; + + @FindBy(xpath = "//*[@id='root']/div/div/div/footer/span") + WebElement footerTextLogo; + + @FindBy(xpath = "//img[@class='footer-brand-logo']") + WebElement footerLogoTag; + + @FindBy(xpath = "//div[@id=':r4:-form-item']/span") + WebElement prefilledCountryCodeDisplayed; + + @FindBy(id = "phone_input") + WebElement helpTextInTextField; + + @FindBy(id = ":r4:-form-item-message") + List enterUserNameError; + + @FindBy(id = ":r4:-form-item-message") + WebElement numberCannotStartWithZeroErrorMassage; + + @FindBy(id = "back-button") + WebElement backButtonInReg; + + @FindBy(id = "login-header") + WebElement loginPageHeaders; + + @FindBy(xpath = "//div[@class='w-full text-center text-[22px] font-semibold']") + WebElement otpPageDisplayed; + + @FindBy(xpath = "//div[@class='text-muted-neutral-gray']") + WebElement otpPageDescriptionDisplay; + + @FindBy(xpath = "//div[@class='pincode-input-container']/input") + List otpInputFieldsVisible; + + @FindBy(xpath = "//div[@class='pincode-input-container']") + WebElement otpInputFields; + + @FindBy(id = "verify-otp-button") + WebElement verifyOtpButtonDisplay; + + @FindBy(xpath = "//div[@class='flex gap-x-1 text-center']/span") + WebElement otpCountDownTimerDisplayed; + + @FindBy(id = "resend-otp-button") + WebElement resendOtpButtonDisplay; + + @FindBy(xpath = "//p[@class='truncate text-xs text-destructive']") + WebElement otpExpiredErrorDisplay; + + @FindBy(id = "cross_icon") + WebElement errorCloseIconDisplay; + + @FindBy(xpath = "//p[@class='w-max rounded-md bg-[#FFF7E5] p-2 px-8 text-center text-sm font-semibold text-[#8B6105]']") + WebElement attemptLeftOptionDisplay; + + public boolean isRedirectedToMobileNumberRegistrationPage() { + return redirectToRegistration.isDisplayed(); + } + + public boolean isHeaderInRegistrationScreenDisplayed() { + return headerInRegistrationScreen.isDisplayed(); + } + + public boolean isEnterMobileNumberTextFieldDisplayed() { + return enterMobileNumberTextField.isDisplayed(); + } + + public boolean isContinueButtonDisplayed() { + return continueButtonDisplayed.isDisplayed(); + } + + public boolean isBackButtonDisplayed() { + return backButtonDisplayed.isDisplayed(); + } + + public boolean isLanguageSelectionOptionDisplayed() { + return languageSelectionOption.isDisplayed(); + } + + public boolean isFooterTextDisplayed() { + return footerTextLogo.isDisplayed(); + } + + public boolean isFooterLogoDisplayed() { + return footerLogoTag.isDisplayed(); + } + + public boolean isPrefilledCountryCodeDisplayed() { + return prefilledCountryCodeDisplayed.isDisplayed(); + } + + private String lastEnteredMobileNumber; + + public void enterMobileNumber(String number) { + enterMobileNumberTextField.clear(); + enterText(enterMobileNumberTextField, number); + enterMobileNumberTextField.clear(); + lastEnteredMobileNumber = "+855 " + number; + } + + public void userTabsOut() { + enterMobileNumberTextField.sendKeys(Keys.TAB); + } + + public void enterLessThanEightDigitMobileNumber(String number) { + enterMobileNumberTextField.clear(); + enterMobileNumberTextField.sendKeys(number); + } + + public boolean isErrorMessageDisplayed() { + return !enterUserNameError.isEmpty() && enterUserNameError.get(0).isDisplayed(); + } + + public boolean isNumberCannotStartWithZeroErrorDisplayed() { + return numberCannotStartWithZeroErrorMassage.isDisplayed(); + } + + public boolean isEnterValidUsernameErrorDisplayed() { + return !enterUserNameError.isEmpty() && enterUserNameError.get(0).isDisplayed(); + } + + public boolean isContinueButtonDisabled() { + return !continueButtonDisplayed.isEnabled(); + } + + public boolean isContinueButtonEnabled() { + return isButtonEnabled(continueButtonDisplayed); + } + + public void clickOnBackButton() { + backButtonDisplayed.click(); + } + + public boolean isPreviousScreenVisible() { + return isElementVisible(loginPageHeaders); + } + + public void clickContinueButton() { + continueButtonDisplayed.click(); + } + + public boolean isOtpPageVisible() { + return otpPageDisplayed.isDisplayed(); + } + + public boolean isEnterOtpPageDisplayed() { + return isElementVisible(otpPageDescriptionDisplay); + } + + public boolean isOtpInputFieldVisible() { + return otpInputFields.isDisplayed(); + } + + public boolean isVerifyOtpButtonVisible() { + return verifyOtpButtonDisplay.isDisplayed(); + } + + public boolean isOtpCountDownTimerVisible() { + return otpCountDownTimerDisplayed.isDisplayed(); + } + + public boolean isResendOtpButtonVisible() { + return resendOtpButtonDisplay.isDisplayed(); + } + + public boolean isBackToEditMobileNumberOptionVisible() { + return isElementVisible(backButtonInReg); + } + + public void clickBackButtonOnOtpScreen() { + backButtonInReg.click(); + } + + public void waitUntilOtpExpires() { + int otpExpiry = Integer.parseInt(EsignetConfigManager.getProperty("otp.expiry.seconds", "")); + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(otpExpiry)); + wait.until(ExpectedConditions.textToBePresentInElement(otpCountDownTimerDisplayed, "00:00")); + } + + public void enterOtp(String otp) { + for (WebElement field : otpInputFieldsVisible) { + field.click(); + field.sendKeys(Keys.chord(Keys.CONTROL, "a")); + field.sendKeys(Keys.BACK_SPACE); + } + for (int i = 0; i < otp.length(); i++) { + WebElement field = otpInputFieldsVisible.get(i); + field.click(); + field.sendKeys(String.valueOf(otp.charAt(i))); + } + } + + public void clickOnVerifyOtpButton() { + verifyOtpButtonDisplay.click(); + } + + public boolean isOtpExpiredMessageDisplayed() { + return isElementVisible(otpExpiredErrorDisplay); + } + + public void clickOnErrorCloseIcon() { + clickOnElement(errorCloseIconDisplay); + } + + public void verifyErrorMessageIsNotDisplayed() { + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(2)); + wait.until(ExpectedConditions.invisibilityOf(otpExpiredErrorDisplay)); + } + + public void clickOnResendOtpButton() { + clickOnElement(resendOtpButtonDisplay); + } + + public void checkAttemptLeftInOtpScreen() { + attemptLeftOptionDisplay.isDisplayed(); + } + + public void userIsOnOtpScreen() { + otpPageDisplayed.isDisplayed(); + } + + + + + + + + + + + + + + + + +} diff --git a/ui-test/src/main/java/pages/s1pages.java b/ui-test/src/main/java/pages/s1pages.java new file mode 100644 index 000000000..6966f38b5 --- /dev/null +++ b/ui-test/src/main/java/pages/s1pages.java @@ -0,0 +1,45 @@ +package pages; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; + +import base.BasePage; + +public class s1pages extends BasePage { + + public s1pages(WebDriver driver) { + super(driver); + PageFactory.initElements(driver, this); + } + + @FindBy(xpath = "//span[@class='title-font text-3xl text-gray-900 font-medium']") + WebElement userIsOnRelyingPortal; + + @FindBy(xpath = "//span[@class='SignInWithEsignet-module_textbox__k2CkO']") + WebElement signInEsignetButton; + + @FindBy(id = "signup-url-button") + WebElement signUpWithUnifiedLoginButton; + + public boolean isUserOnRelyingPortal() { + return userIsOnRelyingPortal.isDisplayed(); + } + + public void clickOnSignInEsignetButton() { + signInEsignetButton.click(); + } + + public boolean isSignUpWithUnifiedLoginButtonDisplayed() { + return signUpWithUnifiedLoginButton.isDisplayed(); + } + + public void clickOnSignUpWithUnifiedLoginButton() { + signUpWithUnifiedLoginButton.click(); + } + + + + +} diff --git a/ui-test/src/main/java/stepdefinitions/s1stepdefinition.java b/ui-test/src/main/java/stepdefinitions/s1stepdefinition.java new file mode 100644 index 000000000..7e5aa9d80 --- /dev/null +++ b/ui-test/src/main/java/stepdefinitions/s1stepdefinition.java @@ -0,0 +1,241 @@ +package stepdefinitions; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import org.testng.Assert; +import org.openqa.selenium.WebDriver; + +import base.BasePage; +import base.BaseTest; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import io.mosip.testrig.apirig.testrunner.OTPListener; +import pages.s1pages; +import pages.r1pages; +import pages.SignUpPage; + +public class s1stepdefinition { + + public WebDriver driver; + BaseTest baseTest; + SignUpPage signUpPage; + BasePage basePage; + s1pages s1pages; + r1pages r1pages; + + public s1stepdefinition(BaseTest baseTest) { + this.baseTest = baseTest; + this.driver = BaseTest.getDriver(); + signUpPage = new SignUpPage(driver); + basePage = new BasePage(driver); + s1pages = new s1pages(driver); + r1pages = new r1pages(driver); + } + + @Given("user is on relying party portal") + public void userIsOnRelyingPartyPortal() { + Assert.assertTrue(s1pages.isUserOnRelyingPortal(), "User is not on relying party portal"); + } + + @Then("user clicks on login button in relying portal page") + public void userClicksOnLoginButtonInRelyingPortalPage() { + s1pages.clickOnSignInEsignetButton(); + } + + @Then("user verify that Sign-Up with unified login button should display") + public void userVerifyThatSignUpWithUnifiedLoginButtonShouldDisplay() { + Assert.assertTrue(s1pages.isSignUpWithUnifiedLoginButtonDisplayed()); + } + + @Then("user clicks on Sign-Up with unified login button hyperlink") + public void userClicksOnSignUpWithUnifiedLoginButtonHyperlink() { + s1pages.clickOnSignUpWithUnifiedLoginButton(); + } + + @Then("user will redirected to mobile number registration page") + public void userWillBeRedirectedToMobileNumberRegistrationPage() { + assertTrue("User is not redirected to Mobile Number Registration Page", + r1pages.isRedirectedToMobileNumberRegistrationPage()); + } + + @Then("user verify Header text in same page") + public void userVerifyHeaderTextInSamePage() { + Assert.assertTrue(r1pages.isHeaderInRegistrationScreenDisplayed()); + } + + @Then("user verify Enter 8-9 digit number is visible") + public void userVerifyEnterEightNineDigitNumberIsVisible() { + Assert.assertTrue(r1pages.isEnterMobileNumberTextFieldDisplayed()); + } + + @Then("user verify continue button is visible") + public void userVerifyContinueButtonIsVisible() { + Assert.assertTrue(r1pages.isContinueButtonDisplayed()); + } + + @Then("user will check previous navigate arrow is visible") + public void userWillCheckPreviousNavigateArrowIsVisible() { + Assert.assertTrue(r1pages.isBackButtonDisplayed()); + } + + @Then("user verify for preferred language option is visible") + public void userVerifyForPreferredLanguageOptionIsVisible() { + Assert.assertTrue(r1pages.isLanguageSelectionOptionDisplayed()); + } + + @Then("user verify footer text powered by esignet logo display") + public void userVerifyFooterTextPoweredByEsignetLogoDisplay() { + Assert.assertTrue(r1pages.isFooterTextDisplayed()); + Assert.assertTrue(r1pages.isFooterLogoDisplayed()); + } + + @Then("user verify mobile number text should prefilled with country code") + public void userVerifyMobileNumberTextShouldPrefilledWithCountryCode() { + Assert.assertTrue(r1pages.isPrefilledCountryCodeDisplayed()); + } + + String mobileNumber; + + @When("user enters {string} in the mobile text field") + public void userEntersInMobileTextField(String number) { + this.mobileNumber = number; + r1pages.enterMobileNumber(number); + } + + @Then("validate that Enter a valid username error massage should display") + public void validateEnterValidUsernameErrorIsDisplayed() { + Assert.assertTrue(r1pages.isEnterValidUsernameErrorDisplayed(), + "Enter a valid username error message is not displayed!"); + } + + @Then("user tabs out on mobile field") + public void userTabsOut() { + r1pages.userTabsOut(); + } + + @Then("continue button remains disabled") + public void continueButtonShouldBeDisabled() { + assertFalse(r1pages.isContinueButtonEnabled()); + } + + @Then("validate that Number cannot start with zero. Enter a valid mobile number. massage will display") + public void validateThatNumberCannotStartWithZeroErrorMessageShouldDisplay() { + Assert.assertTrue(r1pages.isNumberCannotStartWithZeroErrorDisplayed(), + "Number cannot start with zero error message was not displayed!"); + } + + @When("user clicks on navigate back button") + public void userClicksOnNavigateBackButton() { + r1pages.clickOnBackButton(); + } + + @Then("user will redirected to previous screen") + public void userWillRedirectedToPreviousScreen() { + Assert.assertTrue(r1pages.isPreviousScreenVisible()); + } + + @When("user clicks on browser back button") + public void userClicksTheBrowserBackButton() { + basePage.browserBackButton(); + } + + @Then("user clicks on continue button") + public void userClicksOnContinueButton() { + r1pages.clickContinueButton(); + } + + @Given("user is on OTP screen") + public void userIsOnOtpScreen() { + assertTrue(r1pages.isEnterOtpPageDisplayed()); + } + + @Then("user navigated to enter OTP header screen") + public void userNavigatedToEnterOtpScreen() { + Assert.assertTrue(r1pages.isOtpPageVisible()); + } + + @Then("user verifies the OTP screen description should contain a masked mobile number verify it") + public void verifyOtpDescriptionMasked() { + assertTrue(r1pages.isEnterOtpPageDisplayed()); + } + + @Then("user verify OTP input field is visible") + public void userVerifyOtpInputFieldIsVisible() { + Assert.assertTrue(r1pages.isOtpInputFieldVisible()); + } + + @Then("user verifies the verify OTP field is visible") + public void userVerifiesTheVerifyOtpFieldIsVisible() { + Assert.assertTrue(r1pages.isVerifyOtpButtonVisible()); + } + + @Then("user verify the time count down for 3 minutes") + public void userVerifyTheTimeCountDownForThreeMinutes() { + Assert.assertTrue(r1pages.isOtpCountDownTimerVisible()); + } + + @Then("user verifies for Resend OTP is visible") + public void userVerifiesForResendOtpIsVisible() { + Assert.assertTrue(r1pages.isResendOtpButtonVisible()); + } + + @Then("user go back and update the mobile number") + public void verifyBackOptionVisible() { + Assert.assertTrue(r1pages.isBackToEditMobileNumberOptionVisible()); + + } + + @When("user clicks on back button on OTP screen") + public void userClicksOnBackButtonOnOtpScreen() { + r1pages.clickBackButtonOnOtpScreen(); + } + + @Then("user waits for OTP time expire") + public void userWaitsForOtpTimeExpire() { + r1pages.waitUntilOtpExpires(); + } + + @When("user enters {string} in the OTP field screen") + public void userEntersOtp(String otp) { + r1pages.enterOtp(otp); + } + + @Then("user clicks on verify OTP button") + public void userClicksOnVerifyOtpButton() { + r1pages.clickOnVerifyOtpButton(); + } + + @Then("verify an error message OTP expired. Please request a new one and try again. is displayed at the top check it") + public void verifyOtpExpiredErrorMessages() { + assertTrue(r1pages.isOtpExpiredMessageDisplayed()); + } + + @When("user click on the close icon of the error message") + public void userClicksOnErrorCloseIcon() { + r1pages.clickOnErrorCloseIcon(); + } + + @Then("verify the error message is not display") + public void verifyTheErrorMessageIsNotDisplay() { + r1pages.verifyErrorMessageIsNotDisplayed(); + } + + @Then("user clicks on Resend OTP button") + public void userClicksOnResendButton() { + r1pages.clickOnResendOtpButton(); + } + + + + + + + + + + + + +} \ No newline at end of file diff --git a/ui-test/src/main/resources/featurefiles/SignUpFeatures.feature b/ui-test/src/main/resources/featurefiles/SignUpFeatures.feature new file mode 100644 index 000000000..99bb7464d --- /dev/null +++ b/ui-test/src/main/resources/featurefiles/SignUpFeatures.feature @@ -0,0 +1,100 @@ +@smokeAndRegression +Feature: Esignet SignUpFeatures page + This Feature is for SignUpFeatures page + + @smoke @signupfeatures + Scenario Outline: Verify SignUpFeatures feature + Given user is on relying party portal + Then user clicks on login button in relying portal page + Then user verify that Sign-Up with unified login button should display + Then user clicks on Sign-Up with unified login button hyperlink + Then user will redirected to mobile number registration page + Then user verify Header text in same page + And user verify Enter 8-9 digit number is visible + Then user verify continue button is visible + Then user will check previous navigate arrow is visible + Then user verify for preferred language option is visible + Then user verify footer text powered by esignet logo display + Then user verify mobile number text should prefilled with country code + + When user enters "<8 digit number>" in the mobile text field + And user tabs out on mobile field + + When user enters "<9 digit number>" in the mobile text field + And user tabs out on mobile field + + When user enters "" in the mobile text field + Then user tabs out on mobile field + And validate that Enter a valid username error massage should display + And continue button remains disabled + + When user enters "<8 digit number start with 0>" in the mobile text field + And user tabs out on mobile field + And validate that Number cannot start with zero. Enter a valid mobile number. massage will display + + When user enters "<9 digit number start with 0>" in the mobile text field + Then user tabs out on mobile field + And validate that Number cannot start with zero. Enter a valid mobile number. massage will display + + When user enters "<9 zero>" in the mobile text field + Then user tabs out on mobile field + And validate that Number cannot start with zero. Enter a valid mobile number. massage will display + + When user enters "" in the mobile text field + + When user enters "" in the mobile text field + When user clicks on navigate back button + Then user will redirected to previous screen + Then user clicks on Sign-Up with unified login button hyperlink + When user clicks on browser back button + Then user will redirected to previous screen + + + Examples: + | 8 digit number | 9 digit number | 8 digit number start with 0 | 9 digit number start with 0 | 9 zero | special character | alpha numeric character | less than 8 digit | + | 98345678 | 907345789 | 01245678 | 0123456789 | 000000000 | !@$$@* | abc123 | 98567 | + @smoke @OtpPage + Scenario Outline: OTP input acceptance and verify button state + Given user clicks on login button in relying portal page + Then user clicks on Sign-Up with unified login button hyperlink + Then user enters "" in the mobile text field + Then user clicks on continue button + Then user navigated to enter OTP header screen + + Given user is on OTP screen + Then user navigated to enter OTP header screen + Then user verifies the OTP screen description should contain a masked mobile number verify it + And user verify OTP input field is visible + Then user verifies the verify OTP field is visible + Then user verify the time count down for 3 minutes + Then user verifies for Resend OTP is visible + Then user go back and update the mobile number + When user clicks on back button on OTP screen + Then user will redirected to mobile number registration page + Then user enters "" in the mobile text field + Then user clicks on continue button + Then user navigated to enter OTP header screen + + Then user waits for OTP time expire + Then user enters "" in the OTP field screen + And user clicks on verify OTP button + Then verify an error message OTP expired. Please request a new one and try again. is displayed at the top check it + When user click on the close icon of the error message + Then verify the error message is not display + + Then user clicks on Resend OTP button + + + + + + + + + + + + + Examples: + |already registered number| expired OTP | + | 98545678 | 111111 | \ No newline at end of file From c47b461d37e0ecac84a3df9af8ea0f40af0e80e4 Mon Sep 17 00:00:00 2001 From: Basant <139444457+basasnt32@users.noreply.github.com> Date: Mon, 1 Sep 2025 16:32:35 +0530 Subject: [PATCH 4/4] ES-2400:esignetsignupfeatures Signed-off-by: Basant <139444457+basasnt32@users.noreply.github.com> --- ui-test/src/main/java/pages/r1pages.java | 290 ++++++++++++++---- ui-test/src/main/java/pages/s1pages.java | 33 +- .../stepdefinitions/s1stepdefinition.java | 239 +++++++++++---- .../featurefiles/SignUpFeatures.feature | 115 +++++-- 4 files changed, 516 insertions(+), 161 deletions(-) diff --git a/ui-test/src/main/java/pages/r1pages.java b/ui-test/src/main/java/pages/r1pages.java index 9daee7af9..df8ba2af0 100644 --- a/ui-test/src/main/java/pages/r1pages.java +++ b/ui-test/src/main/java/pages/r1pages.java @@ -76,10 +76,10 @@ public r1pages(WebDriver driver) { @FindBy(xpath = "//div[@class='pincode-input-container']/input") List otpInputFieldsVisible; - + @FindBy(xpath = "//div[@class='pincode-input-container']") WebElement otpInputFields; - + @FindBy(id = "verify-otp-button") WebElement verifyOtpButtonDisplay; @@ -88,16 +88,67 @@ public r1pages(WebDriver driver) { @FindBy(id = "resend-otp-button") WebElement resendOtpButtonDisplay; - + @FindBy(xpath = "//p[@class='truncate text-xs text-destructive']") WebElement otpExpiredErrorDisplay; - + @FindBy(id = "cross_icon") WebElement errorCloseIconDisplay; - + @FindBy(xpath = "//p[@class='w-max rounded-md bg-[#FFF7E5] p-2 px-8 text-center text-sm font-semibold text-[#8B6105]']") WebElement attemptLeftOptionDisplay; + @FindBy(xpath = "//h1[@class='text-center text-2xl font-semibold']") + WebElement successfulScreenDisplay; + + @FindBy(xpath = "//p[@class='text-center text-gray-500']") + WebElement massageOnSuccessScreen; + + @FindBy(xpath = "//div[@class='text-center text-gray-500']") + WebElement accountHeaderMassageDisplay; + + @FindBy(id = "mobile-number-verified-continue-button") + WebElement continueButtonOnSuccessScreenPage; + + @FindBy(id = "mobile-number-verified-continue-button") + WebElement onRegistrationPage; + + @FindBy(xpath = "//h3[@class='text-3xl font-medium leading-none tracking-tight']") + WebElement setUpAccountHeaderDisplay; + + @FindBy(id = "username") + WebElement userNameVisible; + + @FindBy(id = "fullNameInKhmer") + WebElement fullNameInKhmerVisible; + + @FindBy(id = "password") + WebElement passwordFieldVisible; + + @FindBy(id = "confirmPassword") + WebElement confirmPasswordField; + + @FindBy(id = "consent-button") + WebElement termsAndConditionCheckBoxVisible; + + @FindBy(id = "account-setup-submit-button") + WebElement continueButtonInSetUpAccountPage; + + @FindBy(xpath = "//p[@class='text-center text-gray-500']") + WebElement congratulationScreenDisplay; + + @FindBy(id = "success-continue-button") + WebElement loginButtonInSuccessPage; + + @FindBy(xpath = "//h1[@class='text-center text-2xl font-semibold']") + WebElement signUpFailure; + + @FindBy(xpath = "//p[@class='text-center text-gray-500']") + WebElement massageOnSignUpFailedPage; + + @FindBy(id = "signup-failed-okay-button") + WebElement okButtonDisplay; + public boolean isRedirectedToMobileNumberRegistrationPage() { return redirectToRegistration.isDisplayed(); } @@ -110,7 +161,7 @@ public boolean isEnterMobileNumberTextFieldDisplayed() { return enterMobileNumberTextField.isDisplayed(); } - public boolean isContinueButtonDisplayed() { + public boolean isContinueButtonDisplayedInRegistationPage() { return continueButtonDisplayed.isDisplayed(); } @@ -144,7 +195,7 @@ public void enterMobileNumber(String number) { } public void userTabsOut() { - enterMobileNumberTextField.sendKeys(Keys.TAB); + enterMobileNumberTextField.sendKeys(Keys.TAB); } public void enterLessThanEightDigitMobileNumber(String number) { @@ -171,57 +222,65 @@ public boolean isContinueButtonDisabled() { public boolean isContinueButtonEnabled() { return isButtonEnabled(continueButtonDisplayed); } - + public void clickOnBackButton() { - backButtonDisplayed.click(); + backButtonDisplayed.click(); } - + public boolean isPreviousScreenVisible() { - return isElementVisible(loginPageHeaders); + return isElementVisible(loginPageHeaders); } - + public void clickContinueButton() { - continueButtonDisplayed.click(); + continueButtonDisplayed.click(); } - + public boolean isOtpPageVisible() { - return otpPageDisplayed.isDisplayed(); + return otpPageDisplayed.isDisplayed(); } - + public boolean isEnterOtpPageDisplayed() { return isElementVisible(otpPageDescriptionDisplay); } - + public boolean isOtpInputFieldVisible() { - return otpInputFields.isDisplayed(); + return otpInputFields.isDisplayed(); } - + public boolean isVerifyOtpButtonVisible() { - return verifyOtpButtonDisplay.isDisplayed(); + return verifyOtpButtonDisplay.isDisplayed(); + } + + public boolean checkSuccessfulMessageVisible() { + return successfulScreenDisplay.isDisplayed(); } - + public boolean isOtpCountDownTimerVisible() { - return otpCountDownTimerDisplayed.isDisplayed(); + return otpCountDownTimerDisplayed.isDisplayed(); + } + + public boolean isVerifyOtpButtonEnabled() { + return verifyOtpButtonDisplay.isEnabled(); } - + public boolean isResendOtpButtonVisible() { - return resendOtpButtonDisplay.isDisplayed(); + return resendOtpButtonDisplay.isDisplayed(); } - + public boolean isBackToEditMobileNumberOptionVisible() { - return isElementVisible(backButtonInReg); + return isElementVisible(backButtonInReg); } - + public void clickBackButtonOnOtpScreen() { - backButtonInReg.click(); + backButtonInReg.click(); } - + public void waitUntilOtpExpires() { - int otpExpiry = Integer.parseInt(EsignetConfigManager.getProperty("otp.expiry.seconds", "")); - WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(otpExpiry)); - wait.until(ExpectedConditions.textToBePresentInElement(otpCountDownTimerDisplayed, "00:00")); + int otpExpiry = Integer.parseInt(EsignetConfigManager.getProperty("otp.expiry.seconds", "")); + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(otpExpiry)); + wait.until(ExpectedConditions.textToBePresentInElement(otpCountDownTimerDisplayed, "00:00")); } - + public void enterOtp(String otp) { for (WebElement field : otpInputFieldsVisible) { field.click(); @@ -234,49 +293,158 @@ public void enterOtp(String otp) { field.sendKeys(String.valueOf(otp.charAt(i))); } } - + public void clickOnVerifyOtpButton() { - verifyOtpButtonDisplay.click(); - } - + verifyOtpButtonDisplay.click(); + } + public boolean isOtpExpiredMessageDisplayed() { return isElementVisible(otpExpiredErrorDisplay); } - + public void clickOnErrorCloseIcon() { clickOnElement(errorCloseIconDisplay); } - + public void verifyErrorMessageIsNotDisplayed() { - WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(2)); - wait.until(ExpectedConditions.invisibilityOf(otpExpiredErrorDisplay)); - } - + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(2)); + wait.until(ExpectedConditions.invisibilityOf(otpExpiredErrorDisplay)); + } + public void clickOnResendOtpButton() { clickOnElement(resendOtpButtonDisplay); } - + public void checkAttemptLeftInOtpScreen() { - attemptLeftOptionDisplay.isDisplayed(); + attemptLeftOptionDisplay.isDisplayed(); } - + public void userIsOnOtpScreen() { - otpPageDisplayed.isDisplayed(); - } - - - - - - - - - - - - - + otpPageDisplayed.isDisplayed(); + } + + public boolean isOtpFieldEmptyOrUnchanged() { + String value = getElementValue(otpInputFields); + return value == null || value.isEmpty(); + } + public boolean isOtpFieldEmptyfterAlphabetEntry() { + String value = getElementValue(otpInputFields); + return value == null || value.isEmpty(); + } + public boolean isOtpFieldsNumericOnly() { + for (WebElement field : otpInputFieldsVisible) { + String value = getElementValue(field); + if (value != null && !value.matches("\\d*")) { + return false; + } + } + return true; + } + + public boolean isContinueButtonOnSuccessScreenDisplayed() { + return continueButtonOnSuccessScreenPage.isDisplayed(); + } + + public boolean isMobileNumberVerifiedMessageDisplayed() { + return massageOnSuccessScreen.isDisplayed(); + } + + public boolean isContinueButtonDispOnSuccessPage() { + return continueButtonDisplayed.isDisplayed(); + } + + public void clickContinueButtonOnSuccessScreen() { + continueButtonOnSuccessScreenPage.click(); + } + + public boolean isSetUpAccountHeaderDisplayed() { + return setUpAccountHeaderDisplay.isDisplayed(); + } + + public boolean isAccountHeaderMassageDisplay() { + return accountHeaderMassageDisplay.isDisplayed(); + } + + public boolean isUserNameVisible() { + return userNameVisible.isDisplayed(); + } + + public boolean isFullNameInKhmerVisible() { + return fullNameInKhmerVisible.isDisplayed(); + } + + public boolean isPasswordFieldVisible() { + return passwordFieldVisible.isDisplayed(); + } + + public boolean isConfirmPasswordVisible() { + return passwordFieldVisible.isDisplayed(); + } + + public boolean isTermsAndConditionCheckBoxVisible() { + return termsAndConditionCheckBoxVisible.isDisplayed(); + } + + public boolean isContinueButtonInSetUpAccountPageVisible() { + return continueButtonInSetUpAccountPage.isDisplayed(); + } + + public void enterFullNameInKhmer(String fullNameInKhmer) { + fullNameInKhmerVisible.clear(); + enterTextJS(fullNameInKhmerVisible, fullNameInKhmer); + } + + public void enterPassword(String validPassword) { + passwordFieldVisible.clear(); + passwordFieldVisible.sendKeys(validPassword); + } + + public void enterPasswordDisplay(String confirmPassword) { + confirmPasswordField.clear(); + confirmPasswordField.sendKeys(confirmPassword); + } + + public void clickOnTermsAndConditionCheckBox() { + termsAndConditionCheckBoxVisible.click(); + } + + public boolean continueButtonRemainsEnabled() { + return continueButtonInSetUpAccountPage.isEnabled(); + } + + public void clickOnContinueButtonInSetupAccountPage() { + continueButtonInSetUpAccountPage.click(); + } + + public boolean isCongratulationScreenDisplayed() { + return congratulationScreenDisplay.isDisplayed(); + } + + public void clickOnLoginButtonInSuccessPage() { + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(15)); + try { + + WebElement loginButton = wait.until(ExpectedConditions.elementToBeClickable(loginButtonInSuccessPage)); + loginButton.click(); + } catch (Exception e) { + + JavascriptExecutor js = (JavascriptExecutor) driver; + js.executeScript("arguments[0].click();", loginButtonInSuccessPage); + } + } + + public boolean isSignUpFailedHeaderDisplayed() { + return signUpFailure.isDisplayed() && signUpFailure.getText().equals("Sign-Up Failed!"); + } + + public boolean isSignUpFailedMessageDisplayed() { + return massageOnSignUpFailedPage.isDisplayed(); + } + + public boolean isOkButtonDisplayed() { + return okButtonDisplay.isDisplayed(); + } } diff --git a/ui-test/src/main/java/pages/s1pages.java b/ui-test/src/main/java/pages/s1pages.java index 6966f38b5..a51535bf5 100644 --- a/ui-test/src/main/java/pages/s1pages.java +++ b/ui-test/src/main/java/pages/s1pages.java @@ -13,33 +13,30 @@ public s1pages(WebDriver driver) { super(driver); PageFactory.initElements(driver, this); } - + @FindBy(xpath = "//span[@class='title-font text-3xl text-gray-900 font-medium']") WebElement userIsOnRelyingPortal; - + @FindBy(xpath = "//span[@class='SignInWithEsignet-module_textbox__k2CkO']") WebElement signInEsignetButton; - + @FindBy(id = "signup-url-button") - WebElement signUpWithUnifiedLoginButton; - + WebElement signUpWithUnifiedLoginButton; + public boolean isUserOnRelyingPortal() { - return userIsOnRelyingPortal.isDisplayed(); + return userIsOnRelyingPortal.isDisplayed(); } - + public void clickOnSignInEsignetButton() { - signInEsignetButton.click(); + signInEsignetButton.click(); } - + public boolean isSignUpWithUnifiedLoginButtonDisplayed() { - return signUpWithUnifiedLoginButton.isDisplayed(); - } - + return signUpWithUnifiedLoginButton.isDisplayed(); + } + public void clickOnSignUpWithUnifiedLoginButton() { - signUpWithUnifiedLoginButton.click(); - } - - - - + signUpWithUnifiedLoginButton.click(); + } + } diff --git a/ui-test/src/main/java/stepdefinitions/s1stepdefinition.java b/ui-test/src/main/java/stepdefinitions/s1stepdefinition.java index 7e5aa9d80..6c9182003 100644 --- a/ui-test/src/main/java/stepdefinitions/s1stepdefinition.java +++ b/ui-test/src/main/java/stepdefinitions/s1stepdefinition.java @@ -11,6 +11,7 @@ import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; +import io.cucumber.java.en.And; import io.mosip.testrig.apirig.testrunner.OTPListener; import pages.s1pages; import pages.r1pages; @@ -44,7 +45,7 @@ public void userClicksOnLoginButtonInRelyingPortalPage() { s1pages.clickOnSignInEsignetButton(); } - @Then("user verify that Sign-Up with unified login button should display") + @Then("user redirect and verify that Sign-Up with unified login button should display") public void userVerifyThatSignUpWithUnifiedLoginButtonShouldDisplay() { Assert.assertTrue(s1pages.isSignUpWithUnifiedLoginButtonDisplayed()); } @@ -72,7 +73,7 @@ public void userVerifyEnterEightNineDigitNumberIsVisible() { @Then("user verify continue button is visible") public void userVerifyContinueButtonIsVisible() { - Assert.assertTrue(r1pages.isContinueButtonDisplayed()); + Assert.assertTrue(r1pages.isContinueButtonDisplayedInRegistationPage()); } @Then("user will check previous navigate arrow is visible") @@ -112,7 +113,7 @@ public void validateEnterValidUsernameErrorIsDisplayed() { @Then("user tabs out on mobile field") public void userTabsOut() { - r1pages.userTabsOut(); + r1pages.userTabsOut(); } @Then("continue button remains disabled") @@ -125,117 +126,249 @@ public void validateThatNumberCannotStartWithZeroErrorMessageShouldDisplay() { Assert.assertTrue(r1pages.isNumberCannotStartWithZeroErrorDisplayed(), "Number cannot start with zero error message was not displayed!"); } - + @When("user clicks on navigate back button") public void userClicksOnNavigateBackButton() { - r1pages.clickOnBackButton(); + r1pages.clickOnBackButton(); } - + @Then("user will redirected to previous screen") public void userWillRedirectedToPreviousScreen() { - Assert.assertTrue(r1pages.isPreviousScreenVisible()); + Assert.assertTrue(r1pages.isPreviousScreenVisible()); } - + @When("user clicks on browser back button") public void userClicksTheBrowserBackButton() { basePage.browserBackButton(); } - + @Then("user clicks on continue button") public void userClicksOnContinueButton() { - r1pages.clickContinueButton(); + r1pages.clickContinueButton(); } - + @Given("user is on OTP screen") public void userIsOnOtpScreen() { assertTrue(r1pages.isEnterOtpPageDisplayed()); } - + @Then("user navigated to enter OTP header screen") public void userNavigatedToEnterOtpScreen() { - Assert.assertTrue(r1pages.isOtpPageVisible()); + Assert.assertTrue(r1pages.isOtpPageVisible()); } - + + @Then("user enters {string} in the OTP field") + public void userEntersInTheOtpFieldScreen(String otp) { + r1pages.enterOtp(otp); + } + @Then("user verifies the OTP screen description should contain a masked mobile number verify it") public void verifyOtpDescriptionMasked() { assertTrue(r1pages.isEnterOtpPageDisplayed()); } - + @Then("user verify OTP input field is visible") public void userVerifyOtpInputFieldIsVisible() { - Assert.assertTrue(r1pages.isOtpInputFieldVisible()); + Assert.assertTrue(r1pages.isOtpInputFieldVisible()); } - + @Then("user verifies the verify OTP field is visible") public void userVerifiesTheVerifyOtpFieldIsVisible() { - Assert.assertTrue(r1pages.isVerifyOtpButtonVisible()); + Assert.assertTrue(r1pages.isVerifyOtpButtonVisible()); } - + @Then("user verify the time count down for 3 minutes") public void userVerifyTheTimeCountDownForThreeMinutes() { - Assert.assertTrue(r1pages.isOtpCountDownTimerVisible()); + Assert.assertTrue(r1pages.isOtpCountDownTimerVisible()); } - + @Then("user verifies for Resend OTP is visible") public void userVerifiesForResendOtpIsVisible() { - Assert.assertTrue(r1pages.isResendOtpButtonVisible()); + Assert.assertTrue(r1pages.isResendOtpButtonVisible()); } - + @Then("user go back and update the mobile number") public void verifyBackOptionVisible() { - Assert.assertTrue(r1pages.isBackToEditMobileNumberOptionVisible()); - + Assert.assertTrue(r1pages.isBackToEditMobileNumberOptionVisible()); + } - + @When("user clicks on back button on OTP screen") public void userClicksOnBackButtonOnOtpScreen() { r1pages.clickBackButtonOnOtpScreen(); } - + @Then("user waits for OTP time expire") public void userWaitsForOtpTimeExpire() { r1pages.waitUntilOtpExpires(); } - - @When("user enters {string} in the OTP field screen") + + @Then("user enters {string} in the OTP field screen") public void userEntersOtp(String otp) { r1pages.enterOtp(otp); } - - @Then("user clicks on verify OTP button") - public void userClicksOnVerifyOtpButton() { + + @Then("user check that verify button comes to enable state") + public void userEnableVerifyOtp() { + r1pages.isVerifyOtpButtonEnabled(); + } + + @Then("user clicks on verify OTP button quickly") + public void userClicksOnVerifyOtpButton() { r1pages.clickOnVerifyOtpButton(); - } - - @Then("verify an error message OTP expired. Please request a new one and try again. is displayed at the top check it") + } + + @Then("verify an error massage OTP expired. Please request a new one and try again") public void verifyOtpExpiredErrorMessages() { assertTrue(r1pages.isOtpExpiredMessageDisplayed()); } - + @When("user click on the close icon of the error message") public void userClicksOnErrorCloseIcon() { r1pages.clickOnErrorCloseIcon(); } - + @Then("verify the error message is not display") public void verifyTheErrorMessageIsNotDisplay() { r1pages.verifyErrorMessageIsNotDisplayed(); - } - - @Then("user clicks on Resend OTP button") - public void userClicksOnResendButton() { - r1pages.clickOnResendOtpButton(); - } - - - - - - - - - - + } + + @Then("user verify that OTP field rejecting specialCharacter") + public void otpFieldRemainsEmptyAfterEntreingSpecialCharacters() { + assertTrue(r1pages.isOtpFieldEmptyOrUnchanged()); + } + + @Then("user verify that OTP field rejecting alphabet") + public void otpFieldRemainsEmptyAfterEntreingAlphabets() { + assertTrue(r1pages.isOtpFieldEmptyfterAlphabetEntry()); + } + + @Then("user verify that OTP field rejecting alphaNumericCharacter") + public void otpFieldRemainsEmptyAfterEntreingAlphaNumeric() { + assertTrue(r1pages.isOtpFieldsNumericOnly()); + } + + @And("user verify that Successful! is display") + public void userVerifyThatSuccessfulMessageVisible() { + Assert.assertTrue(r1pages.checkSuccessfulMessageVisible()); + + } + + @Then("user verify that Your mobile number has been verified successfully massage will showing") + public void userVerifyThatYourMobileNumberHasBeenVerifiedSuccessfullyMassageWillShowing() { + Assert.assertTrue(r1pages.isMobileNumberVerifiedMessageDisplayed()); + } + + @Then("user verify that continue button display in success screen") + public void userVerifyThatContinueButtonDisplayInSuccessScreen() { + Assert.assertTrue(r1pages.isContinueButtonOnSuccessScreenDisplayed()); + + } + + @And("user will redirected to successful screen") + public void userWillRedirectedToSuccessfulScreen() { + Assert.assertTrue(r1pages.checkSuccessfulMessageVisible()); + } + + @And("user clicks on continue button in successful screen") + public void userClicksOnContinueButtonInSuccessfulScreen() { + r1pages.clickContinueButtonOnSuccessScreen(); + } + + @Then("user verify in header Setup Account display") + public void userVerifyInHeaderSetupAccountDisplay() { + Assert.assertTrue(r1pages.isSetUpAccountHeaderDisplayed()); + } + + @Then("user verify Please enter the requested details to complete your registration display") + public void userVerifyPleaseEnterTheRequestedDetailsToCompleteYourRegistrationDisplay() { + Assert.assertTrue(r1pages.isAccountHeaderMassageDisplay()); + } + + @Then("user verify that Username field will display") + public void userVerifyThatUsernameFieldWillDisplay() { + Assert.assertTrue(r1pages.isUserNameVisible()); + } + + @And("user verify that enter fullname in Khmer display") + public void userVerifyThatEnterFullnameInKhmerDisplay() { + Assert.assertTrue(r1pages.isFullNameInKhmerVisible()); + } + + @And("user verify setup Password will display") + public void userVerifySetupPasswordWillDisplay() { + Assert.assertTrue(r1pages.isPasswordFieldVisible()); + } + + @Then("user verify option to confirm password display") + public void userVerifyOptionToConfirmPasswordDisplay() { + Assert.assertTrue(r1pages.isConfirmPasswordVisible()); + } + + @Then("user verify checks to terms and condition privacy policy") + public void userVerifyChecksToTermsAndConditionPrivacyPolicy() { + Assert.assertTrue(r1pages.isTermsAndConditionCheckBoxVisible()); + } + + @Then("user verify continue button in setupAccount page") + public void userVerifyContinueButtonInSetupAccountPage() { + Assert.assertTrue(r1pages.isContinueButtonInSetUpAccountPageVisible()); + } + + @Then("user enters {string} in the setupAccount page") + public void userEntersValidFullNameInKhmerInSetupAccountPage(String fullNameInKhmer) { + r1pages.enterFullNameInKhmer(fullNameInKhmer); + } + + @Then("user enters {string} in the same page") + public void userEntersValidPasswordInSetupAccountPage(String validPassword) { + r1pages.enterPassword(validPassword); + } + + @Then("user enters {string} in account screen") + public void userEntersConfirmPasswordInSetupAccountPage(String confirmPassword) { + r1pages.enterPasswordDisplay(confirmPassword); + } + + @Then("user clicks on CheckBox of terms and condition and privacy policy in setupAccount") + public void userClicksOnCheckBoxOfTermsAndConditionAndPrivacyPolicyInSetupAccountPage() { + r1pages.clickOnTermsAndConditionCheckBox(); + } + + @Then("continue button remains enabled in setup page") + public void continueButtonRemainsEnabledInSetupAccountPage() { + r1pages.continueButtonRemainsEnabled(); + } + + @Then("user clicks on continue button in same screen") + public void userClicksOnContinueButtonInSetupAccountPage() { + r1pages.clickOnContinueButtonInSetupAccountPage(); + } + + @Then("it will redirected to congratulations page") + public void itWillRedirectedToCongratulationsPage() { + Assert.assertTrue(r1pages.isCongratulationScreenDisplayed()); + } + + @Then("user clicks on login button in congratulations page") + public void userClicksOnLoginButtonInCongratulationsPage() { + r1pages.clickOnLoginButtonInSuccessPage(); + } + + @Then("it will display in header Sign-Up Failed!") + public void verifySignUpFailureHeader() { + Assert.assertTrue(r1pages.isSignUpFailedHeaderDisplayed()); + } + + @Then("provided mobile number is already registered Please use the Login option to proceed will show") + public void providedMobileNumberAlreadyRegisteredMessageShouldBeDisplayed() { + Assert.assertTrue(r1pages.isSignUpFailedMessageDisplayed()); + } + + @Then("ok button will display on same page") + public void loginButtonWillDisplayOnSamePage() { + Assert.assertTrue(r1pages.isOkButtonDisplayed()); + } } \ No newline at end of file diff --git a/ui-test/src/main/resources/featurefiles/SignUpFeatures.feature b/ui-test/src/main/resources/featurefiles/SignUpFeatures.feature index 99bb7464d..2e864b21d 100644 --- a/ui-test/src/main/resources/featurefiles/SignUpFeatures.feature +++ b/ui-test/src/main/resources/featurefiles/SignUpFeatures.feature @@ -5,8 +5,8 @@ Feature: Esignet SignUpFeatures page @smoke @signupfeatures Scenario Outline: Verify SignUpFeatures feature Given user is on relying party portal - Then user clicks on login button in relying portal page - Then user verify that Sign-Up with unified login button should display + Given user clicks on login button in relying portal page + Then user redirect and verify that Sign-Up with unified login button should display Then user clicks on Sign-Up with unified login button hyperlink Then user will redirected to mobile number registration page Then user verify Header text in same page @@ -41,26 +41,25 @@ Feature: Esignet SignUpFeatures page And validate that Number cannot start with zero. Enter a valid mobile number. massage will display When user enters "" in the mobile text field - When user enters "" in the mobile text field When user clicks on navigate back button Then user will redirected to previous screen Then user clicks on Sign-Up with unified login button hyperlink When user clicks on browser back button Then user will redirected to previous screen - - + Examples: - | 8 digit number | 9 digit number | 8 digit number start with 0 | 9 digit number start with 0 | 9 zero | special character | alpha numeric character | less than 8 digit | + | 8 digit number | 9 digit number | 8 digit number start with 0 | 9 digit number start with 0 | 9 zero | special character | alpha numeric character | less than 8 digit | | 98345678 | 907345789 | 01245678 | 0123456789 | 000000000 | !@$$@* | abc123 | 98567 | + @smoke @OtpPage - Scenario Outline: OTP input acceptance and verify button state + Scenario Outline: OTP input acceptance and verify the state Given user clicks on login button in relying portal page Then user clicks on Sign-Up with unified login button hyperlink - Then user enters "" in the mobile text field + Then user enters "" in the mobile text field Then user clicks on continue button Then user navigated to enter OTP header screen - + Given user is on OTP screen Then user navigated to enter OTP header screen Then user verifies the OTP screen description should contain a masked mobile number verify it @@ -69,32 +68,90 @@ Feature: Esignet SignUpFeatures page Then user verify the time count down for 3 minutes Then user verifies for Resend OTP is visible Then user go back and update the mobile number + When user clicks on back button on OTP screen Then user will redirected to mobile number registration page Then user enters "" in the mobile text field Then user clicks on continue button Then user navigated to enter OTP header screen - + Then user waits for OTP time expire Then user enters "" in the OTP field screen - And user clicks on verify OTP button - Then verify an error message OTP expired. Please request a new one and try again. is displayed at the top check it + And user check that verify button comes to enable state + And user clicks on verify OTP button quickly When user click on the close icon of the error message Then verify the error message is not display - - Then user clicks on Resend OTP button - - - - - - - - - - - - - Examples: - |already registered number| expired OTP | - | 98545678 | 111111 | \ No newline at end of file + + Then user waits for OTP time expire + When user enters "" in the OTP field screen + And user clicks on verify OTP button quickly + And verify an error massage OTP expired. Please request a new one and try again + + When user enters "" in the OTP field screen + Then user verify that OTP field rejecting specialCharacter + + When user enters "" in the OTP field screen + Then user verify that OTP field rejecting alphabet + + When user enters "" in the OTP field screen + Then user verify that OTP field rejecting alphaNumericCharacter + + When user enters "" in the OTP field screen + When user clicks on back button on OTP screen + Then user will redirected to mobile number registration page + Then user enters "" in the mobile text field + Then user clicks on continue button + Then user navigated to enter OTP header screen + Then user enters "" in the OTP field + And user clicks on verify OTP button quickly + And user verify that Successful! is display + And user verify that Your mobile number has been verified successfully massage will showing + Then user verify that continue button display in success screen + + Examples: + | already registered number | expired OTP | invalid OTP | specialCharacter | alphabet | incompleteOTP | valid mobile number | alphaNumericCharacter | complete 6 digit OTP | + | 98545678 | 111111 | 000000 | @#!$%^ | asdfg | 123 | 983454566 | abc123 | 111111 | + + @smoke @accountSetupPage + Scenario Outline: Complete Registration Process + Given user clicks on login button in relying portal page + Then user redirect and verify that Sign-Up with unified login button should display + Then user clicks on Sign-Up with unified login button hyperlink + Then user enters "" in the mobile text field + Then user clicks on continue button + Then user navigated to enter OTP header screen + Then user enters "" in the OTP field + And user clicks on verify OTP button quickly + And user will redirected to successful screen + And user clicks on continue button in successful screen + Then user verify in header Setup Account display + Then user verify Please enter the requested details to complete your registration display + Then user verify that Username field will display + And user verify that enter fullname in Khmer display + And user verify setup Password will display + And user verify option to confirm password display + Then user verify checks to terms and condition privacy policy + Then user verify continue button in setupAccount page + Then user enters "" in the setupAccount page + Then user enters "" in the same page + Then user enters "" in account screen + Then user clicks on CheckBox of terms and condition and privacy policy in setupAccount + Then continue button remains enabled in setup page + Then user clicks on continue button in same screen + Then it will redirected to congratulations page + Then user clicks on login button in congratulations page + Then user redirect and verify that Sign-Up with unified login button should display + Then user clicks on Sign-Up with unified login button hyperlink + Then user will redirected to mobile number registration page + Then user enters "" in the mobile text field + Then user clicks on continue button + Then user navigated to enter OTP header screen + Then user enters "" in the OTP field screen + And user clicks on verify OTP button quickly + Then it will display in header Sign-Up Failed! + Then provided mobile number is already registered Please use the Login option to proceed will show + Then ok button will display on same page + + Examples: + | ValidFullNameInKhmer | ValidPassword | ConfirmPassword | already_registered_number | expired_OTP | new number | + | អរគុណ | Pass@2004 | Pass@2004 | 34180006 | 111111 | 34180006 |