From 293820bda8b54505b0c07ff138bd074680bb1bbe Mon Sep 17 00:00:00 2001 From: anup-nehe <117707464+anup-nehe@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:44:44 +0530 Subject: [PATCH] MOSIP-33299 added testcases for revamp ui (#842) * MOSIP-33299 Signed-off-by: Anup Nehe * resolve conflicts Signed-off-by: Anup Nehe * resolve conflicts Signed-off-by: Anup Nehe * MOSIP-36006 Signed-off-by: Anup Nehe * MOSIP-33299 Signed-off-by: Anup Nehe * resolve conflicts Signed-off-by: Anup Nehe * resolve conflicts Signed-off-by: Anup Nehe * resolve conflicts Signed-off-by: Anup Nehe --------- Signed-off-by: Anup Nehe --- .../testrig/pmprevampui/pages/BasePage.java | 44 +++ .../pmprevampui/pages/DashboardPage.java | 56 ++- .../testrig/pmprevampui/pages/LoginPage.java | 21 ++ .../testrig/pmprevampui/pages/OldPmpPage.java | 192 ++++++++++ .../pages/PartnerCertificatePage.java | 23 +- .../pmprevampui/pages/PoliciesPage.java | 295 +++++++++++++++ .../pmprevampui/pages/RegisterPage.java | 44 +++ .../pmprevampui/testcase/CreateApiKey.java | 4 - .../testcase/CreateOidecClient.java | 1 - .../pmprevampui/testcase/NewUserPolicy.java | 335 ++++++++++++++++-- .../pmprevampui/testcase/RegisterNewUser.java | 115 ++++-- .../pmprevampui/utility/GlobalConstants.java | 18 +- .../pmprevampui/utility/TestRunner.java | 2 + .../src/main/resources/testngFile/testng.xml | 3 +- 14 files changed, 1092 insertions(+), 61 deletions(-) create mode 100644 uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/OldPmpPage.java diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/BasePage.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/BasePage.java index 520e4fe21..c1dd51b0f 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/BasePage.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/BasePage.java @@ -58,7 +58,9 @@ public static void clickOnElement(WebElement element) { } public static void enter(WebElement element,String value) { + try { + Thread.sleep(3000); element.clear(); element.sendKeys(value); }catch (Exception e) { @@ -108,7 +110,39 @@ public static void dropdownByIndex(WebElement element, int index) { executor.executeScript("arguments[0].click();", element); } } + + public static void dropdown(WebElement element,String value) throws IOException + { + try { + Thread.sleep(50); + clickOnElement(element); + Thread.sleep(50); + String val="'"+value +"'"; + click(By.xpath("//*[contains(text(),"+val+")]")); + try { + Thread.sleep(50); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }catch (Exception e) { + JavascriptExecutor executor = (JavascriptExecutor) driver; + executor.executeScript("arguments[0].click();", element); + + } + } + + + protected static void click(By by) { + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + driver.findElement(by).click(); + } public static String generateRandomAlphabetString() { String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -190,4 +224,14 @@ public static int getSplitdigit() } return Integer.parseInt(splitdigit); } + + protected String getTextFromLocator(WebElement element) { + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + this.waitForElementToBeVisible(element); + return element.getText(); + } } diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/DashboardPage.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/DashboardPage.java index ebfda8681..f2331c40d 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/DashboardPage.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/DashboardPage.java @@ -1,5 +1,6 @@ package io.mosip.testrig.pmprevampui.pages; +import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -16,8 +17,15 @@ public class DashboardPage extends BasePage{ private WebElement selectPolicyGroupPopUp; @FindBy(xpath = "//div[@class='relative w-full']/button") +// select_policy_group_dropdown private WebElement selectPolicyGroupDropdown; + @FindBy(xpath = "//*[text()='No Data Available.']") + private WebElement noDataAvailableText; + + @FindBy(id = "select_policy_group_dropdown_search_input") + private WebElement SearchBox; + @FindBy(xpath = "//*[text()='Submit']") private WebElement submitButton; @@ -42,6 +50,18 @@ public class DashboardPage extends BasePage{ @FindBy(id = "dashboard_authentication_clients_list_card") private WebElement AuthenticationServices; + @FindBy(id = "select_policy_group_view_text") + private WebElement selectPolicyGroupViewMoreAndLess; + + @FindBy(id = "select_policy_group_logout") + private WebElement selectPolicyGroupLogout; + + @FindBy(id = "select_policy_group_submit") + private WebElement selectPolicyGroupSubmit; + + @FindBy(id = "select_policy_group_dropdown_option1") + private WebElement selectPolicyGrouDropdownOption1; + public DashboardPage(WebDriver driver) { super(driver); } @@ -67,9 +87,19 @@ public boolean isSubmitButtonSelectPolicyGroupPopUpDisplayed() { return isElementDisplayed(submitButton); } - public void selectSelectPolicyGroupDropdown() { + public void selectSelectPolicyGroupDropdown(String value) { clickOnElement(selectPolicyGroupDropdown); - clickOnElement(value); + enter(SearchBox,value); + String val="'"+value +"'"; +// click(By.xpath("//*[contains(text(),"+val+")]")); + clickOnElement(selectPolicyGrouDropdownOption1); + } + + public void selectSelectPolicyGroupDropdownForInvalid(String value) { + clickOnElement(selectPolicyGroupDropdown); + enter(SearchBox,value); + String val="'"+value +"'"; +// clickOnElement(value); } public void clickOnSubmitButton() { @@ -119,4 +149,26 @@ public OidcClientPage clickOnAuthenticationServicesTitle() { return new OidcClientPage(driver); } + public boolean isSelectPolicyGroupViewMoreAndLess() { + return isElementDisplayed(selectPolicyGroupViewMoreAndLess); + } + + public boolean isNoDataAvailableTextDisplayed() { + return isElementDisplayed(noDataAvailableText); + } + + public boolean isSelectPolicyGroupSubmitEnabled() { + return isElementEnabled(selectPolicyGroupSubmit); + } + + public void clickOnSelectPolicyGroupSubmit() { + clickOnElement(selectPolicyGroupSubmit); + } + + public void clickOnSelectPolicyGroupLogout() { + clickOnElement(selectPolicyGroupLogout); + } + + + } diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/LoginPage.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/LoginPage.java index 71d29af3c..274afc4b8 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/LoginPage.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/LoginPage.java @@ -12,6 +12,15 @@ public class LoginPage extends BasePage{ @FindBy(xpath = "//*[contains(text(), 'Register')]") private WebElement registerButton; + @FindBy(id = "username") + private WebElement usernameTextBox; + + @FindBy(id = "password") + private WebElement passwordTextBox; + + @FindBy(xpath = "//input[@name=\'login\']") + private WebElement LoginButton; + public LoginPage(WebDriver driver) { super(driver); } @@ -25,4 +34,16 @@ public boolean isLoginPageDisplayed() { return isElementDisplayed(loginPageTitle); } + public void enterUserName(String value) { + enter(usernameTextBox,value); + } + + public void enterPassword(String value) { + enter(passwordTextBox,value); + } + + public void ClickOnLoginButton() { + clickOnElement(LoginButton); + } + } diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/OldPmpPage.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/OldPmpPage.java new file mode 100644 index 000000000..57b650016 --- /dev/null +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/OldPmpPage.java @@ -0,0 +1,192 @@ +package io.mosip.testrig.pmprevampui.pages; + +import java.io.IOException; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +public class OldPmpPage extends BasePage{ + + @FindBy(xpath = "//*[@class='menu-button mat-menu-trigger']") + private WebElement UserProfile; + + @FindBy(xpath = "//*[contains(text(), 'Logout')]") + private WebElement LogoutButton; + + @FindBy(id = "username") + private WebElement usenameTextBox; + + @FindBy(id = "password") + private WebElement PasswordTextBox; + + @FindBy(xpath = "//input[@name='login']") + private WebElement LoginButton; + + @FindBy(id = "policymenugroup") + private WebElement PolicyMenuGroup; + + @FindBy(xpath = "//a[@href='#/pmp/resources/policygroup/view']") + private WebElement PolicyMenuGroupTab; + + @FindBy(xpath = "//button[@id='Create Policy Group']") + private WebElement CreatePolicyGroup; + + @FindBy(id = "name") + private WebElement nameFormPolicyGroup; + + @FindBy(id = "desc") + private WebElement descFormPolicyGroup; + + @FindBy(xpath = "//button[@id='createButton']") + private WebElement CreatButton; + + @FindBy(xpath = "//button[@id='confirmmessagepopup']") + private WebElement ConfirmMessagePopup; + + @FindBy(xpath = "//*[contains(text(), 'Policy')]") + private WebElement PolicyTab; + + @FindBy(xpath = "//*[contains(text(), 'Auth Policy')]") + private WebElement AuthPolicyTab; + + @FindBy(xpath = "//*[contains(text(), 'Create Policy')]") + private WebElement CreatePolicyTab; + + @FindBy(xpath = "//*[@placeholder='Name']") + private WebElement NameTextBox; + + @FindBy(xpath = "//*[@placeholder='Description']") + private WebElement DescriptionTextBox; + + @FindBy(xpath = "//*[@id='policyGroupName']") + private WebElement policyGroupNameDropDown; + + @FindBy(id = "policies") + private WebElement policiesTextBox; + + @FindBy(xpath = "//*[contains(text(), 'Filter')]") + private WebElement filterButton; + + @FindBy(id = "applyTxt") + private WebElement ApplyTextButton; + + @FindBy(xpath = "(//span[@class='mat-button-wrapper']/mat-icon)[2]") + private WebElement PolicyGroupElipsis; + + @FindBy(xpath = "//*[contains(text(), 'Activate')]") + private WebElement ActivateButton; + + @FindBy(xpath = "//*[contains(text(), ' Yes ')]") + private WebElement YesButton; + + public OldPmpPage(WebDriver driver) { + super(driver); + } + + public void clickOnUserProfile() { + clickOnElement(UserProfile); + } + + public void clickOnLogOut() { + clickOnElement(LogoutButton); + } + + public void EnterUserName(String value) { + enter(usenameTextBox,value); + } + + public void EntePasswordTextBox(String value) { + enter(PasswordTextBox,value); + } + + public void clickOnLoginButton() { + clickOnElement(LoginButton); + } + + public void clickOnPolicyMenuGroup() { + clickOnElement(PolicyMenuGroup); + } + + public void clickOnPolicyMenuGroupTab() { + clickOnElement(PolicyMenuGroupTab); + } + + public void clickOnCreatePolicyGroup() { + clickOnElement(CreatePolicyGroup); + } + + public void EnterName() { + enter(nameFormPolicyGroup,""); + } + + public void EnterDescription() { + enter(descFormPolicyGroup,""); + } + + public void clickOnCreateButton() { + clickOnElement(CreatButton); + } + + public void clickOnConfirmMessagePopup() { + clickOnElement(ConfirmMessagePopup); + } + + public void clickOnPolicyTab() { + clickOnElement(PolicyTab); + } + + public void clickOnAuthPolicyTab() { + clickOnElement(AuthPolicyTab); + } + + public void clickOnCreatePolicyTab() { + clickOnElement(CreatePolicyTab); + } + + public void EnterNameTextBox(String value) { + enter(NameTextBox,value); + } + + public void EnterDescriptionTextBox(String value) { + enter(DescriptionTextBox,value); + } + + public void policyGroupNameDropDown(String value) { + try { + dropdown(policyGroupNameDropDown, value); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void EnterPoliciesTextBox(String value) { + enter(policiesTextBox,value); + } + + public void clickOnfilterButton() { + clickOnElement(filterButton); + } + + public void clickOnApplyTextButton() { + clickOnElement(ApplyTextButton); + } + + public void clickOnPolicyGroupElipsis() { + clickOnElement(PolicyGroupElipsis); + } + + public void clickOnActivateButton() { + clickOnElement(ActivateButton); + } + + public void clickOnYesButton() { + clickOnElement(YesButton); + } + + public void refreshPage() { + driver.navigate().refresh(); + } +} diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/PartnerCertificatePage.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/PartnerCertificatePage.java index 5cac32393..60329c664 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/PartnerCertificatePage.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/PartnerCertificatePage.java @@ -8,7 +8,7 @@ public class PartnerCertificatePage extends BasePage{ - @FindBy(id = "dashboard_partner_certificated_list_card") + @FindBy(id = "title_back_icon") private WebElement partnerCertificateTitle; @FindBy(xpath = "//*[text()='Upload']") @@ -32,6 +32,18 @@ public class PartnerCertificatePage extends BasePage{ @FindBy(id = "sub_title_home_btn") private WebElement homeButton; + @FindBy(id = "download_btn1") + private WebElement downloadButton; + + @FindBy(id = "original_certificate_download_btn1") + private WebElement originalCertificateDownloadButton; + + @FindBy(id = "mosip_signed_certificate_download_btn1") + private WebElement mosipSignedCertificateDownloadButton; + + @FindBy(id = "partner_certificate_re_upload_btn1") + private WebElement partnerCertificateReuploadButton; + public PartnerCertificatePage(WebDriver driver) { super(driver); } @@ -68,4 +80,13 @@ public DashboardPage clickOnHomeButton() { clickOnElement(homeButton); return new DashboardPage(driver); } + + public boolean isDownloadButtonDisplayed() { + return isElementDisplayed(downloadButton); + } + + public void clickOnPartnerCertificateReuploadButton() { + clickOnElement(partnerCertificateReuploadButton); + } + } diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/PoliciesPage.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/PoliciesPage.java index 3895f6aad..bdd25f574 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/PoliciesPage.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/PoliciesPage.java @@ -1,5 +1,7 @@ package io.mosip.testrig.pmprevampui.pages; +import java.io.IOException; + import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -16,6 +18,9 @@ public class PoliciesPage extends BasePage{ @FindBy(id = "policies_request_policy_btn") private WebElement requestPolicyButton; + @FindBy(id = "policies_request_btn") + private WebElement policies_request_btn; + @FindBy(id = "request_policy_partner_id") private WebElement partnerIdDropdown; @@ -37,6 +42,124 @@ public class PoliciesPage extends BasePage{ @FindBy(xpath = "//*[text()='No Data Available.']") private WebElement noDataAvailableText; + @FindBy(id = "request_policies_policy_name_option1") + private WebElement requestPolicyNameOption; + + @FindBy(id = "sub_title_home_btn") + private WebElement HomeButton; + + @FindBy(id = "sub_title_btn") + private WebElement PolicyButton; + + @FindBy(xpath = "//*[text()='List of Policy Requests (1)']") + private WebElement ListOfPolicyRequested; + + @FindBy(xpath = "//*[text()='Pending For Approval']") + private WebElement PendingForApproval; + + @FindBy(id = "policy_list_view1") + private WebElement ElipcisButton; + + @FindBy(id = "policy_list_view_card") + private WebElement CardViewButton; + + @FindBy(id = "view_policy_back_btn") + private WebElement BackButton; + + @FindBy(id = "policy_partner_id_filter") + private WebElement policyPartnerIdFilter; + + @FindBy(id = "policy_partner_type_filter") + private WebElement policyPartnerTypeFilter; + + @FindBy(id = "policy_partner_type_filter_option1") + private WebElement policyPartnerTypeFilterOption1; + + @FindBy(id = "policy_status_filter_option1") + private WebElement policy_status_filter_option1; + + + + @FindBy(id = "policy_group_filter") + private WebElement policyGroupFilter; + + @FindBy(id = "policy_name_filter") + private WebElement policyNameFilter; + + @FindBy(id = "policy_status_filter") + private WebElement policyStatusFilter; + + @FindBy(id = "filter_reset_btn") + private WebElement filterResetButton; + + @FindBy(id = "policy_partner_id_filter_option1") + private WebElement policyPartnerIdFilterOption1; + + @FindBy(id = "filter_btn") + private WebElement filterButton; + + @FindBy(xpath = "//*[@aria-label='Next page']") + private WebElement nextPage; + + @FindBy(xpath = "//*[@aria-label='Previous page']") + private WebElement previousPage; + + @FindBy(xpath = "//*[text()='Partner ID']") + private WebElement PartnerIdText; + + + + @FindBy(id = "policy_list_item1") + private WebElement policyListItem1; + + @FindBy(id = "sub_title_home_btn") + private WebElement subTitleHomeButton; + + @FindBy(id = "sub_title_btn") + private WebElement subTitleButton; + + @FindBy(id = "title_back_icon") + private WebElement titleBackIcon; + + @FindBy(xpath = "//*[text()='View Policy Details']") + private WebElement ViewPolicyDetailsText; + + @FindBy(id = "partnerId_desc_icon") + private WebElement partnerId_desc_icon; + + @FindBy(id = "partnerId_asc_icon") + private WebElement partnerId_asc_icon; + + @FindBy(id = "partnerType_desc_icon") + private WebElement partnerType_desc_icon; + + @FindBy(id = "partnerType_asc_icon") + private WebElement partnerType_asc_icon; + + @FindBy(id = "policyGroupName_desc_icon") + private WebElement policyGroupName_desc_icon; + + @FindBy(id = "policyGroupName_asc_icon") + private WebElement policyGroupName_asc_icon; + + @FindBy(id = "policyName_desc_icon") + private WebElement policyName_desc_icon; + + @FindBy(id = "policyName_asc_icon") + private WebElement policyName_asc_icon; + + @FindBy(id = "createdDateTime_desc_icon") + private WebElement createdDateTime_desc_icon; + + @FindBy(id = "createdDateTime_asc_icon") + private WebElement createdDateTime_asc_icon; + + @FindBy(id = "status_desc_icon") + private WebElement status_desc_icon; + + @FindBy(id = "status_asc_icon") + private WebElement status_asc_icon; + public PoliciesPage(WebDriver driver) { super(driver); } @@ -46,9 +169,25 @@ public boolean isPoliciesPageDisplayed() { } public void clickOnRequestPolicyButton() { + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } clickOnElement(requestPolicyButton); } + public void clickOnRequestPolicyButtonWithFilter() { + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + clickOnElement(policies_request_btn); + } + public void selectPartnerIdDropdown(String value) { clickOnElement(partnerIdDropdown); clickOnElement(driver.findElement(By.xpath("(//*[contains(text(),'"+value+"')])[2]"))); @@ -56,6 +195,13 @@ public void selectPartnerIdDropdown(String value) { public void selectPolicyNameDropdown(String value) { clickOnElement(policyNameDropdown); +// enter(SearchBox,value); + clickOnElement(requestPolicyNameOption); + } + + public void selectInvalidPolicyNameDropdown(String value) { + clickOnElement(policyNameDropdown); + enter(searchBoxForPolicyName,value); } public void enterComments(String comments) { @@ -99,4 +245,153 @@ public boolean isPoliciesEmptyTableEnabled() { return isElementEnabled(requestPolicyButton); } + public void clickOnHomeButton() { + clickOnElement(HomeButton); + } + + public void clickOnPartnerIdDropdown() { + clickOnElement(partnerIdDropdown); + } + + public boolean isListOfPolicyRequestedDisplayed() { + return isElementDisplayed(ListOfPolicyRequested); + } + + public boolean isPendingForApprovalTextDisplayed() { + return isElementDisplayed(PendingForApproval); + } + + public void clickOnElipcisButton() { + clickOnElement(ElipcisButton); + } + + public boolean isCardViewButtonDisplayed() { + return isElementDisplayed(CardViewButton); + } + + public void clickOnCardViewButton() { + clickOnElement(CardViewButton); + } + + public void clickOnBackButton() { + clickOnElement(BackButton); + } + + public void clickOnPolicyPartnerIdFilter(String value) { + clickOnElement(policyPartnerIdFilter); + clickOnElement(driver.findElement(By.xpath("(//*[contains(text(),'"+value+"')])[2]"))); + } + + public void clickOnPolicyPartnerTypeFilter() { + clickOnElement(policyPartnerTypeFilter); + clickOnElement(policyPartnerTypeFilterOption1); + } + + public void clickOnPolicyGroupFilter(String value) { + clickOnElement(policyGroupFilter); + clickOnElement(driver.findElement(By.xpath("(//*[contains(text(),'"+value+"')])[3]"))); + } + + public void clickOnPolicyNameFilter(String value) { + clickOnElement(policyNameFilter); + clickOnElement(driver.findElement(By.xpath("(//*[contains(text(),'"+value+"')])[3]"))); + } + + public void clickOnPolicyStatusFilter() { + clickOnElement(policyStatusFilter); + clickOnElement(policy_status_filter_option1); + } + + public void clickOnFilterResetButton() { + clickOnElement(filterResetButton); + } + + public void clickOnFilterButton() { + clickOnElement(filterButton); + } + + public boolean isNextPageDisplayed() { + return isElementDisplayed(nextPage); + } + + public boolean isPreviousPageDisplayed() { + return isElementDisplayed(previousPage); + } + + public boolean isPartnerIdTextDisplayed() { + return isElementDisplayed(PartnerIdText); + } + + public boolean isPartnerIdDescIconDisplayed() { + return isElementDisplayed(partnerId_desc_icon); + } + + public boolean isPartnerIdAscIconDisplayed() { + return isElementDisplayed(partnerId_asc_icon); + } + + public boolean isPartnerTypeDescIconDisplayed() { + return isElementDisplayed(partnerType_desc_icon); + } + + public boolean isPartnerTypeAscIconDisplayed() { + return isElementDisplayed(partnerType_asc_icon); + } + + public boolean isPolicyGroupNameDescIconDisplayed() { + return isElementDisplayed(policyGroupName_desc_icon); + } + + public boolean isPolicyGroupNameAscIconDisplayed() { + return isElementDisplayed(policyGroupName_asc_icon); + } + + public boolean isPolicyNameDescIconDisplayed() { + return isElementDisplayed(policyName_desc_icon); + } + + public boolean isPolicyNameAscIconDisplayed() { + return isElementDisplayed(policyName_asc_icon); + } + + public boolean isCreatedDateTimeDescISconDisplayed() { + return isElementDisplayed(createdDateTime_desc_icon); + } + + public boolean isCreatedDateTimeAscIconDisplayed() { + return isElementDisplayed(createdDateTime_asc_icon); + } + + public boolean isStatusDescIconDisplayed() { + return isElementDisplayed(status_desc_icon); + } + + public boolean isStatusAscIconDisplayed() { + return isElementDisplayed(status_asc_icon); + } + + public boolean isFilterButtonButtonEnabled() { + return isElementEnabled(filterButton); + } + + public boolean isSubTitleHomeButtonDisplayed() { + return isElementDisplayed(subTitleHomeButton); + } + + public boolean isSubTitleButtonDisplayed() { + return isElementDisplayed(subTitleButton); + } + + public boolean isTitleBackIconDisplayed() { + return isElementDisplayed(titleBackIcon); + } + + public boolean isViewPolicyDetailsTextDisplayed() { + return isElementDisplayed(ViewPolicyDetailsText); + } + + public void clickOnPolicyListItem1() { + clickOnElement(policyListItem1); + } + } diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/RegisterPage.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/RegisterPage.java index 4a0386a77..d348003e3 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/RegisterPage.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/pages/RegisterPage.java @@ -1,5 +1,8 @@ package io.mosip.testrig.pmprevampui.pages; +import java.util.Set; + +import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -149,4 +152,45 @@ public DashboardPage clickSubmitButton() { clickOnElement(submitButton); return new DashboardPage(driver); } + + public void openNewTab() { +((JavascriptExecutor) driver).executeScript("window.open('https://pmp.dev1.mosip.net/ ')"); + Set allWindowHandles =driver.getWindowHandles(); + System.out.println(allWindowHandles); + if (allWindowHandles.size() >= 2) { + String secondWindowHandle = allWindowHandles.toArray(new String[0])[1]; + String firstWindowHandle = allWindowHandles.toArray(new String[0])[0]; + // Switch to the second window + driver.switchTo().window(secondWindowHandle); + } +} + + public void openPreviousTab() { + Set allWindowHandles =driver.getWindowHandles(); + System.out.println(allWindowHandles); + + String firstWindowHandle = allWindowHandles.toArray(new String[0])[0]; + // Switch to the second window + driver.switchTo().window(firstWindowHandle); + } + + public void openRevampInNewTab() { +((JavascriptExecutor) driver).executeScript("window.open('https://pmp-new.dev1.mosip.net/ ')"); + Set allWindowHandles =driver.getWindowHandles(); + System.out.println(allWindowHandles); + if (allWindowHandles.size() >= 2) { + String secondWindowHandle = allWindowHandles.toArray(new String[0])[1]; + String firstWindowHandle = allWindowHandles.toArray(new String[0])[0]; + // Switch to the second window + driver.switchTo().window(secondWindowHandle); + } +} + + public void refreshThePage() { + driver.navigate().refresh(); + } + + public void CloseTheTab() { + driver.close(); + } } diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/CreateApiKey.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/CreateApiKey.java index 1c7ed6e18..a4871cd61 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/CreateApiKey.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/CreateApiKey.java @@ -29,7 +29,6 @@ public void CreateApiKey() { assertTrue(oidcClientPage.isCreateOidcClientDisplayed(), GlobalConstants.isCreateOIDCClientDisplayed); assertTrue(apiKeyPage.isPolicyGroupHeaderTextDisplayed(), GlobalConstants.isPolicyGroupHeaderTextDisplayed); assertTrue(apiKeyPage.isPolicyNameHeaderTextDisplayed(), GlobalConstants.isPolicyNameHeaderTextDisplayed); -// assertTrue(apiKeyPage.isApiKeyHeaderTextDisplayed(), GlobalConstants.isApiKeyHeaderTextDisplayed); assertTrue(apiKeyPage.isCreatedDateHeaderTextDisplayed(), GlobalConstants.isCreatedDateHeaderTextDisplayed); assertTrue(apiKeyPage.isStatusHeaderTextDisplayed(), GlobalConstants.isStatusHeaderTextDisplayed); assertTrue(apiKeyPage.isActionHeaderTextDisplayed(), GlobalConstants.isActionHeaderTextDisplayed); @@ -41,13 +40,10 @@ public void CreateApiKey() { apiKeyPage.selectPartnerIdDropdown("automationuiiii"); assertTrue(apiKeyPage.isPolicyNameDropdownDisplayed(), GlobalConstants.isPolicyNameDropdownDisplayed); -// apiKeyPage.selectPolicyNameDropdown(data+"ad"); apiKeyPage.enterNameOfApiKeyTextBox(data+"ad"); apiKeyPage.ClickOnSubmitButton(); assertTrue(oidcClientPage.isAuthorizationCodeTextDisplayed(), GlobalConstants.isAutherisationCodeTextDisplayed); } - - } diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/CreateOidecClient.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/CreateOidecClient.java index dfe0feb3f..60acd572f 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/CreateOidecClient.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/CreateOidecClient.java @@ -48,7 +48,6 @@ public void CreateOidecClient() { oidcClientPage.enterLogoUrTextBox(ConfigManager.getLogouri()); oidcClientPage.enterRedirectUriTextBox(ConfigManager.getRedirectUri()); oidcClientPage.clickOnSubmitButton(); - assertTrue(oidcClientPage.isAuthorizationCodeTextDisplayed(), GlobalConstants.isAutherisationCodeTextDisplayed); } diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/NewUserPolicy.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/NewUserPolicy.java index fe24ad1b8..6b60a806d 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/NewUserPolicy.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/NewUserPolicy.java @@ -1,11 +1,15 @@ package io.mosip.testrig.pmprevampui.testcase; +import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import org.testng.annotations.Test; +import io.mosip.testrig.pmprevampui.kernel.util.ConfigManager; import io.mosip.testrig.pmprevampui.pages.DashboardPage; import io.mosip.testrig.pmprevampui.pages.LoginPage; +import io.mosip.testrig.pmprevampui.pages.OidcClientPage; +import io.mosip.testrig.pmprevampui.pages.OldPmpPage; import io.mosip.testrig.pmprevampui.pages.PartnerCertificatePage; import io.mosip.testrig.pmprevampui.pages.PoliciesPage; import io.mosip.testrig.pmprevampui.pages.RegisterPage; @@ -13,7 +17,198 @@ import io.mosip.testrig.pmprevampui.utility.GlobalConstants; public class NewUserPolicy extends BaseClass { + + + @Test + public void VerifyingPolicyCreationAndFilter() { + + DashboardPage dashboardpage = new DashboardPage(driver); + + dashboardpage.clickOnProfileDropdown(); + assertTrue(dashboardpage.isLogoutButtonDisplayed(), GlobalConstants.isLogoutButtonDisplayed); + + LoginPage loginpage = dashboardpage.clickOnLogoutButton(); + assertTrue(loginpage.isLoginPageDisplayed(), GlobalConstants.isLoginPageDisplayed); + + LoginPage loginPage = new LoginPage(driver); + loginPage.enterUserName("0"+data); + loginPage.enterPassword(password); + loginPage.ClickOnLoginButton(); + + assertTrue(dashboardpage.isPartnerCertificateTitleDisplayed(), GlobalConstants.isPartnerCertificateTitleDisplayed); + PartnerCertificatePage partnerCertificatePage=dashboardpage.clickOnPartnerCertificateTitle(); + + assertTrue(partnerCertificatePage.isPartnerCertificatePageDisplayed(), GlobalConstants.isPartnerCertificatePageDisplayed); + partnerCertificatePage.clickOnPartnerCertificateReuploadButton(); + + partnerCertificatePage.uploadCertificate(); + partnerCertificatePage.clickOnSubmitButton(); + + assertTrue(partnerCertificatePage.isSucessMessageDisplayed(), GlobalConstants.isSucessMessageDisplayed); + partnerCertificatePage.clickOnCloseButton(); + dashboardpage = partnerCertificatePage.clickOnHomeButton(); + + assertTrue(dashboardpage.isPoliciesTitleDisplayed(), GlobalConstants.isPoliciesTitleDisplayed); + PoliciesPage policiesPage=dashboardpage.clickOnPoliciesTitle(); + policiesPage.clickOnRequestPolicyButton(); + + assertTrue(policiesPage.isPartnerIdDropdownDisplayed(), GlobalConstants.isPartnerIdDropdownDisplayed); + policiesPage.selectPartnerIdDropdown("0"+ data); + + assertTrue(policiesPage.isPolicyNameDropdownDisplayed(), GlobalConstants.isPolicyNameDropdownDisplayed); + policiesPage.selectPolicyNameDropdown("0"+ data); + policiesPage.enterComments("0"+ data); + + assertTrue(policiesPage.isSubmitButtonDisplayed(), GlobalConstants.isSubmitButtonDisplayed); + policiesPage.clickSubmitButton(); + + assertTrue(policiesPage.isPolicySubmittedSuccessfullyDisplayed(), GlobalConstants.isSubmitButtonDisplayed); + + policiesPage.clickOnHomeButton(); + dashboardpage.clickOnPoliciesTitle(); + + assertTrue(policiesPage.isListOfPolicyRequestedDisplayed(), GlobalConstants.isListOfPolicyRequestedTextDisplayed); + assertTrue(policiesPage.isNextPageDisplayed(), GlobalConstants.isNextPageDisplayed); + assertTrue(policiesPage.isPreviousPageDisplayed(), GlobalConstants.isPreviousPageDisplayed); + assertTrue(policiesPage.isPendingForApprovalTextDisplayed(), GlobalConstants.isPendingForApprovalDisplayed); + + policiesPage.clickOnElipcisButton(); + policiesPage.clickOnCardViewButton(); + assertTrue(policiesPage.isPartnerIdTextDisplayed(), GlobalConstants.isPartnerIdTextDisplayed); + policiesPage.clickOnBackButton(); + assertTrue(policiesPage.isPartnerIdDescIconDisplayed(), GlobalConstants.isPartnerIdDescAscIcon); + assertTrue(policiesPage.isPartnerIdAscIconDisplayed(), GlobalConstants.isPartnerIdDescAscIcon); + assertTrue(policiesPage.isPartnerTypeDescIconDisplayed(), GlobalConstants.isPartnerTypeDescAscIcon); + assertTrue(policiesPage.isPartnerTypeAscIconDisplayed(), GlobalConstants.isPartnerTypeDescAscIcon); + assertTrue(policiesPage.isPolicyGroupNameDescIconDisplayed(), GlobalConstants.isPolicyGroupNameDescAscIcon); + assertTrue(policiesPage.isPolicyGroupNameAscIconDisplayed(), GlobalConstants.isPolicyGroupNameDescAscIcon); + assertTrue(policiesPage.isPolicyNameDescIconDisplayed(), GlobalConstants.isPolicyNameDescAscIcon); + assertTrue(policiesPage.isPolicyNameAscIconDisplayed(), GlobalConstants.isPolicyNameDescAscIcon); + assertTrue(policiesPage.isCreatedDateTimeDescISconDisplayed(), GlobalConstants.isCreatedDateTimeDescAscIcon); + assertTrue(policiesPage.isCreatedDateTimeAscIconDisplayed(), GlobalConstants.isCreatedDateTimeDescAscIcon); + policiesPage.clickOnFilterButton(); + + policiesPage.clickOnPolicyPartnerIdFilter("0"+ data); + policiesPage.clickOnPolicyPartnerTypeFilter(); + policiesPage.clickOnPolicyGroupFilter("0"+ data); + policiesPage.clickOnPolicyNameFilter("0"+ data); + policiesPage.clickOnPolicyStatusFilter(); + policiesPage.clickOnFilterResetButton(); + policiesPage.isFilterButtonButtonEnabled(); + + policiesPage.clickOnPolicyListItem1(); + assertTrue(policiesPage.isSubTitleHomeButtonDisplayed(), GlobalConstants.isSubTitleHomeDisplayed); + assertTrue(policiesPage.isSubTitleButtonDisplayed(), GlobalConstants.isSubTitleDisplayed); + assertTrue(policiesPage.isTitleBackIconDisplayed(), GlobalConstants.isBackArrow); + assertTrue(policiesPage.isViewPolicyDetailsTextDisplayed(), GlobalConstants.isViewPolicyTitle); + } + + + @Test + public void VerifyingSelectingInvalidPolicyGroup() { + + DashboardPage dashboardpage = new DashboardPage(driver); + + dashboardpage.clickOnProfileDropdown(); + assertTrue(dashboardpage.isLogoutButtonDisplayed(), GlobalConstants.isLogoutButtonDisplayed); + + LoginPage loginpage = dashboardpage.clickOnLogoutButton(); + assertTrue(loginpage.isLoginPageDisplayed(), GlobalConstants.isLoginPageDisplayed); + + RegisterPage registerPage = loginpage.clickRegisterButton(); + assertTrue(registerPage.isRegisterPageTitleDisplayed(), GlobalConstants.isRegisterPageTitleDisplayed); + assertTrue(registerPage.isFirstNameTextBoxDisplayed(), GlobalConstants.isFirstNameTextBoxDisplayed); + + registerPage.openNewTab(); + OldPmpPage oldPmpPage = new OldPmpPage(driver); + + oldPmpPage.refreshPage(); + oldPmpPage.EnterUserName(userid); + oldPmpPage.EntePasswordTextBox(password); + oldPmpPage.clickOnLoginButton(); + + oldPmpPage.clickOnPolicyMenuGroup(); + oldPmpPage.clickOnPolicyMenuGroupTab(); + + oldPmpPage.clickOnCreatePolicyGroup(); + + oldPmpPage.EnterNameTextBox("0"+data+"0"); + oldPmpPage.EnterDescriptionTextBox("0"+data+"0"); + + oldPmpPage.clickOnCreateButton(); + oldPmpPage.clickOnConfirmMessagePopup(); + + oldPmpPage.clickOnAuthPolicyTab(); + oldPmpPage.clickOnCreatePolicyTab(); + oldPmpPage.EnterNameTextBox("0"+data+"0"); + oldPmpPage.EnterDescriptionTextBox("0"+data+"0"); + oldPmpPage.policyGroupNameDropDown("0"+data+"0"); + oldPmpPage.EnterPoliciesTextBox(ConfigManager.getpolicyData()); + oldPmpPage.clickOnCreateButton(); + oldPmpPage.clickOnConfirmMessagePopup(); + + oldPmpPage.clickOnfilterButton(); + oldPmpPage.EnterNameTextBox("0"+data+"0"); + oldPmpPage.clickOnApplyTextButton(); + + oldPmpPage.clickOnPolicyGroupElipsis(); + oldPmpPage.clickOnActivateButton(); + oldPmpPage.clickOnYesButton(); + oldPmpPage.clickOnConfirmMessagePopup(); + + oldPmpPage.clickOnUserProfile(); + oldPmpPage.clickOnLogOut(); + + registerPage.CloseTheTab(); + registerPage.openPreviousTab(); + registerPage.refreshThePage(); + registerPage.openRevampInNewTab(); + loginpage.clickRegisterButton(); + + registerPage.enterFirstName("0"+data+"0"); + assertTrue(registerPage.isLastNameTextBoxDisplayed(), GlobalConstants.isLastNameTextBoxDisplayed); + registerPage.enterLastName("0"+ data+"0"); + + assertTrue(registerPage.isOrganizationNameDisplayed(), GlobalConstants.isOrganizationNameDisplayed); + registerPage.enterOrganizationName("xyz"); + + assertTrue(registerPage.isPartnerTypeDropdownDisplayed(), GlobalConstants.isPartnerTypeDropdownDisplayed); + registerPage.selectPartnerTypeDropdown(); + + assertTrue(registerPage.isAddressTextBoxDisplayed(), GlobalConstants.isAddressTextBoxDisplayed); + registerPage.enterAddress("0"+ data+"0"); + assertTrue(registerPage.isEmailTextBoxDisplayed(), GlobalConstants.isEmailTextBoxDisplayed); + registerPage.enterEmail("0"+ data+"0"+ "@gmail.com"); + + assertTrue(registerPage.isPhoneNumberTextboxDisplayed(), GlobalConstants.isPhoneNumberTextboxDisplayed); + registerPage.enterPhone("9876543212"); + + assertTrue(registerPage.isNotificationLanguageDropdownDisplayed(), GlobalConstants.isNotificationLanguageDropdownDisplayed); + registerPage.selectNotificationLanguageDropdown(); + + assertTrue(registerPage.isUsernameTextBoxDisplayed(), GlobalConstants.isUsernameTextBoxDisplayed); + registerPage.enterUsername("0"+ data+"0"); + + assertTrue(registerPage.isPasswordTextBoxDisplayed(), GlobalConstants.isPasswordTextBoxDisplayed); + registerPage.enterPassword("mosip123"); + + assertTrue(registerPage.isPasswordConfirmTextBoxDisplayed(), GlobalConstants.isPasswordConfirmTextBoxDisplayed); + registerPage.enterPasswordConfirm("mosip123"); + + assertTrue(registerPage.isSubmitButtonDisplayed(), GlobalConstants.isSubmitButtonDisplayed); + dashboardpage = registerPage.clickSubmitButton(); + + assertTrue(dashboardpage.isSelectPolicyGroupPopUpDisplayed(), GlobalConstants.isSelectPolicyGroupPopUpDisplayed); + assertTrue(dashboardpage.isSelectPolicyGroupViewMoreAndLess(), GlobalConstants.isSelectPolicyGroupViewMoreAndLess); + assertTrue(dashboardpage.isSelectPolicyGroupSubmitEnabled(), GlobalConstants.isSelectPolicyGroupSubmitDisabled); + dashboardpage.clickOnSelectPolicyGroupSubmit(); + dashboardpage.selectSelectPolicyGroupDropdownForInvalid("abc"+ data); + assertTrue(dashboardpage.isNoDataAvailableTextDisplayed(), GlobalConstants.isPolicyNameDropdownDisplayed); + + dashboardpage.clickOnSelectPolicyGroupLogout(); + } + @Test public void searchWithInvalidPolicyName() { @@ -31,30 +226,128 @@ public void searchWithInvalidPolicyName() { policiesPage.selectPartnerIdDropdown("automationuiiii"); assertTrue(policiesPage.isPolicyNameDropdownDisplayed(), GlobalConstants.isPolicyNameDropdownDisplayed); - policiesPage.selectPolicyNameDropdown(data); + policiesPage.selectInvalidPolicyNameDropdown(data+"123"); policiesPage.searchInPolicyName(data +"123"); assertTrue(policiesPage.isNoDataAvailableTextDisplayed(), GlobalConstants.isPolicyNameDropdownDisplayed); } -// @Test -// public void searchWithInvalidPolicyName() { -// -// DashboardPage dashboardpage = new DashboardPage(driver); -// -// assertTrue(dashboardpage.isPoliciesTitleDisplayed(), GlobalConstants.isPoliciesTitleDisplayed); -// PoliciesPage policiesPage=dashboardpage.clickOnPoliciesTitle(); -// -// assertTrue(policiesPage.isPoliciesPageDisplayed(), GlobalConstants.isPoliciesPageDisplayed); -// policiesPage.clickOnRequestPolicyButton(); -// -// assertTrue(policiesPage.isPartnerIdDropdownDisplayed(), GlobalConstants.isPartnerIdDropdownDisplayed); -// policiesPage.selectPartnerIdDropdown("automationuiiii"); -// -// assertTrue(policiesPage.isPolicyNameDropdownDisplayed(), GlobalConstants.isPolicyNameDropdownDisplayed); -// policiesPage.selectPolicyNameDropdown(data); -// policiesPage.searchInPolicyName(data +"123"); -// assertTrue(policiesPage.isNoDataAvailableTextDisplayed(), GlobalConstants.isPolicyNameDropdownDisplayed); -// -// } + @Test + public void RequestNewPolicyWithouUploadingCertificates() { + + DashboardPage dashboardpage = new DashboardPage(driver); + + dashboardpage.clickOnProfileDropdown(); + assertTrue(dashboardpage.isLogoutButtonDisplayed(), GlobalConstants.isLogoutButtonDisplayed); + + LoginPage loginpage = dashboardpage.clickOnLogoutButton(); + assertTrue(loginpage.isLoginPageDisplayed(), GlobalConstants.isLoginPageDisplayed); + + RegisterPage registerPage = loginpage.clickRegisterButton(); + assertTrue(registerPage.isRegisterPageTitleDisplayed(), GlobalConstants.isRegisterPageTitleDisplayed); + assertTrue(registerPage.isFirstNameTextBoxDisplayed(), GlobalConstants.isFirstNameTextBoxDisplayed); + // old pmp + registerPage.openNewTab(); + OldPmpPage oldPmpPage = new OldPmpPage(driver); + + oldPmpPage.refreshPage(); + oldPmpPage.EnterUserName(userid); + oldPmpPage.EntePasswordTextBox(password); + oldPmpPage.clickOnLoginButton(); + + oldPmpPage.clickOnPolicyMenuGroup(); + oldPmpPage.clickOnPolicyMenuGroupTab(); + + oldPmpPage.clickOnCreatePolicyGroup(); + + oldPmpPage.EnterNameTextBox("0"+data+"n"); + oldPmpPage.EnterDescriptionTextBox("0"+data+"n"); + + oldPmpPage.clickOnCreateButton(); + oldPmpPage.clickOnConfirmMessagePopup(); + + oldPmpPage.clickOnAuthPolicyTab(); + oldPmpPage.clickOnCreatePolicyTab(); + oldPmpPage.EnterNameTextBox("0"+data+"n"); + oldPmpPage.EnterDescriptionTextBox("0"+data+"n"); + oldPmpPage.policyGroupNameDropDown("0"+data+"n"); + oldPmpPage.EnterPoliciesTextBox(ConfigManager.getpolicyData()); + oldPmpPage.clickOnCreateButton(); + oldPmpPage.clickOnConfirmMessagePopup(); + + oldPmpPage.clickOnfilterButton(); + oldPmpPage.EnterNameTextBox("0"+data+"n"); + oldPmpPage.clickOnApplyTextButton(); + + oldPmpPage.clickOnPolicyGroupElipsis(); + oldPmpPage.clickOnActivateButton(); + oldPmpPage.clickOnYesButton(); + oldPmpPage.clickOnConfirmMessagePopup(); + + oldPmpPage.clickOnUserProfile(); + oldPmpPage.clickOnLogOut(); + + registerPage.CloseTheTab(); + registerPage.openPreviousTab(); + registerPage.refreshThePage(); + registerPage.openRevampInNewTab(); + loginpage.clickRegisterButton(); + + registerPage.enterFirstName("0"+data+"n"); + + assertTrue(registerPage.isLastNameTextBoxDisplayed(), GlobalConstants.isLastNameTextBoxDisplayed); + registerPage.enterLastName("0"+ data+"n"); + + assertTrue(registerPage.isOrganizationNameDisplayed(), GlobalConstants.isOrganizationNameDisplayed); + registerPage.enterOrganizationName("xyz"); + + assertTrue(registerPage.isPartnerTypeDropdownDisplayed(), GlobalConstants.isPartnerTypeDropdownDisplayed); + registerPage.selectPartnerTypeDropdown(); + + assertTrue(registerPage.isAddressTextBoxDisplayed(), GlobalConstants.isAddressTextBoxDisplayed); + registerPage.enterAddress("0"+ data+"n"); + + assertTrue(registerPage.isEmailTextBoxDisplayed(), GlobalConstants.isEmailTextBoxDisplayed); + registerPage.enterEmail("0"+data+"n"+"@gmail.com"); + + assertTrue(registerPage.isPhoneNumberTextboxDisplayed(), GlobalConstants.isPhoneNumberTextboxDisplayed); + registerPage.enterPhone("9876543211"); + + assertTrue(registerPage.isNotificationLanguageDropdownDisplayed(), GlobalConstants.isNotificationLanguageDropdownDisplayed); + registerPage.selectNotificationLanguageDropdown(); + + assertTrue(registerPage.isUsernameTextBoxDisplayed(), GlobalConstants.isUsernameTextBoxDisplayed); + registerPage.enterUsername("0"+ data+"n"); + + assertTrue(registerPage.isPasswordTextBoxDisplayed(), GlobalConstants.isPasswordTextBoxDisplayed); + registerPage.enterPassword("mosip123"); + + assertTrue(registerPage.isPasswordConfirmTextBoxDisplayed(), GlobalConstants.isPasswordConfirmTextBoxDisplayed); + registerPage.enterPasswordConfirm("mosip123"); + + assertTrue(registerPage.isSubmitButtonDisplayed(), GlobalConstants.isSubmitButtonDisplayed); + dashboardpage = registerPage.clickSubmitButton(); + + assertTrue(dashboardpage.isSelectPolicyGroupPopUpDisplayed(), GlobalConstants.isSelectPolicyGroupPopUpDisplayed); + dashboardpage.selectSelectPolicyGroupDropdown("0"+ data+"n"); + + assertTrue(dashboardpage.isSubmitButtonSelectPolicyGroupPopUpDisplayed(), GlobalConstants.isSubmitButtonDisplayed); + dashboardpage.clickOnSubmitButton(); + + assertTrue(dashboardpage.isTermsAndConditionsPopUppDisplayed(), GlobalConstants.isTermsAndConditionsPopUppDisplayed); + dashboardpage.clickOnCheckbox(); + + assertTrue(dashboardpage.isProceedButtonDisplayed(), GlobalConstants.isProceedButtonDisplayed); + dashboardpage.clickOnProceedButton(); + + assertTrue(dashboardpage.isPoliciesTitleDisplayed(), GlobalConstants.isPoliciesTitleDisplayed); + PoliciesPage policiesPage=dashboardpage.clickOnPoliciesTitle(); + + assertTrue(policiesPage.isPoliciesPageDisplayed(), GlobalConstants.isPoliciesPageDisplayed); + policiesPage.clickOnRequestPolicyButton(); + + assertTrue(policiesPage.isPartnerIdDropdownDisplayed(), GlobalConstants.isPartnerIdDropdownDisplayed); + policiesPage.clickOnPartnerIdDropdown(); + assertTrue(policiesPage.isNoDataAvailableTextDisplayed(), GlobalConstants.isNoDataTextDisplaed); + } } diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/RegisterNewUser.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/RegisterNewUser.java index 151d3d729..5fcf93404 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/RegisterNewUser.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/testcase/RegisterNewUser.java @@ -4,8 +4,11 @@ import org.testng.annotations.Test; +import io.mosip.testrig.pmprevampui.kernel.util.ConfigManager; import io.mosip.testrig.pmprevampui.pages.DashboardPage; import io.mosip.testrig.pmprevampui.pages.LoginPage; +import io.mosip.testrig.pmprevampui.pages.OidcClientPage; +import io.mosip.testrig.pmprevampui.pages.OldPmpPage; import io.mosip.testrig.pmprevampui.pages.PartnerCertificatePage; import io.mosip.testrig.pmprevampui.pages.PoliciesPage; import io.mosip.testrig.pmprevampui.pages.RegisterPage; @@ -14,9 +17,8 @@ public class RegisterNewUser extends BaseClass { - @Test + @Test(priority = 1) public void registerNewUser() { - DashboardPage dashboardpage = new DashboardPage(driver); dashboardpage.clickOnProfileDropdown(); @@ -28,11 +30,59 @@ public void registerNewUser() { RegisterPage registerPage = loginpage.clickRegisterButton(); assertTrue(registerPage.isRegisterPageTitleDisplayed(), GlobalConstants.isRegisterPageTitleDisplayed); assertTrue(registerPage.isFirstNameTextBoxDisplayed(), GlobalConstants.isFirstNameTextBoxDisplayed); + + registerPage.openNewTab(); + OldPmpPage oldPmpPage = new OldPmpPage(driver); + + oldPmpPage.refreshPage(); + oldPmpPage.EnterUserName(userid); + oldPmpPage.EntePasswordTextBox(password); + oldPmpPage.clickOnLoginButton(); + + oldPmpPage.clickOnPolicyMenuGroup(); + oldPmpPage.clickOnPolicyMenuGroupTab(); + + oldPmpPage.clickOnCreatePolicyGroup(); + + + oldPmpPage.EnterNameTextBox("0"+data); + oldPmpPage.EnterDescriptionTextBox("0"+data); - registerPage.enterFirstName("ad" + data); + oldPmpPage.clickOnCreateButton(); + oldPmpPage.clickOnConfirmMessagePopup(); + +// oldPmpPage.clickOnPolicyTab(); + oldPmpPage.clickOnAuthPolicyTab(); + oldPmpPage.clickOnCreatePolicyTab(); + oldPmpPage.EnterNameTextBox("0"+data); + oldPmpPage.EnterDescriptionTextBox("0"+data); + oldPmpPage.policyGroupNameDropDown("0"+data); + oldPmpPage.EnterPoliciesTextBox(ConfigManager.getpolicyData()); + oldPmpPage.clickOnCreateButton(); + oldPmpPage.clickOnConfirmMessagePopup(); + + oldPmpPage.clickOnfilterButton(); + oldPmpPage.EnterNameTextBox("0"+data); + oldPmpPage.clickOnApplyTextButton(); + + oldPmpPage.clickOnPolicyGroupElipsis(); + oldPmpPage.clickOnActivateButton(); + oldPmpPage.clickOnYesButton(); + oldPmpPage.clickOnConfirmMessagePopup(); + + oldPmpPage.clickOnUserProfile(); + oldPmpPage.clickOnLogOut(); + + registerPage.CloseTheTab(); + registerPage.openPreviousTab(); + registerPage.refreshThePage(); + registerPage.openRevampInNewTab(); + loginpage.clickRegisterButton(); + + registerPage.enterFirstName("0"+data); assertTrue(registerPage.isLastNameTextBoxDisplayed(), GlobalConstants.isLastNameTextBoxDisplayed); - registerPage.enterLastName("ad" + data); + registerPage.enterLastName("0"+ data); assertTrue(registerPage.isOrganizationNameDisplayed(), GlobalConstants.isOrganizationNameDisplayed); registerPage.enterOrganizationName("xyz"); @@ -41,10 +91,10 @@ public void registerNewUser() { registerPage.selectPartnerTypeDropdown(); assertTrue(registerPage.isAddressTextBoxDisplayed(), GlobalConstants.isAddressTextBoxDisplayed); - registerPage.enterAddress("ad" + data); + registerPage.enterAddress("0"+ data); assertTrue(registerPage.isEmailTextBoxDisplayed(), GlobalConstants.isEmailTextBoxDisplayed); - registerPage.enterEmail("ad" + data + "@gmail.com"); + registerPage.enterEmail("0"+ data + "@gmail.com"); assertTrue(registerPage.isPhoneNumberTextboxDisplayed(), GlobalConstants.isPhoneNumberTextboxDisplayed); registerPage.enterPhone("9876543210"); @@ -53,7 +103,7 @@ public void registerNewUser() { registerPage.selectNotificationLanguageDropdown(); assertTrue(registerPage.isUsernameTextBoxDisplayed(), GlobalConstants.isUsernameTextBoxDisplayed); - registerPage.enterUsername("automationuiiii"); + registerPage.enterUsername("0"+ data); assertTrue(registerPage.isPasswordTextBoxDisplayed(), GlobalConstants.isPasswordTextBoxDisplayed); registerPage.enterPassword("mosip123"); @@ -65,7 +115,7 @@ public void registerNewUser() { dashboardpage = registerPage.clickSubmitButton(); assertTrue(dashboardpage.isSelectPolicyGroupPopUpDisplayed(), GlobalConstants.isSelectPolicyGroupPopUpDisplayed); - dashboardpage.selectSelectPolicyGroupDropdown(); + dashboardpage.selectSelectPolicyGroupDropdown("0"+ data); assertTrue(dashboardpage.isSubmitButtonSelectPolicyGroupPopUpDisplayed(), GlobalConstants.isSubmitButtonDisplayed); dashboardpage.clickOnSubmitButton(); @@ -76,10 +126,31 @@ public void registerNewUser() { assertTrue(dashboardpage.isProceedButtonDisplayed(), GlobalConstants.isProceedButtonDisplayed); dashboardpage.clickOnProceedButton(); + assertTrue(dashboardpage.isPartnerCertificateTitleDisplayed(), GlobalConstants.isPartnerCertificateTitleDisplayed); + } + + + @Test(priority = 2, dependsOnMethods = {"registerNewUser"}) + public void ReuploadTheCertificates() { + + DashboardPage dashboardpage = new DashboardPage(driver); + + dashboardpage.clickOnProfileDropdown(); + assertTrue(dashboardpage.isLogoutButtonDisplayed(), GlobalConstants.isLogoutButtonDisplayed); + + LoginPage loginpage = dashboardpage.clickOnLogoutButton(); + assertTrue(loginpage.isLoginPageDisplayed(), GlobalConstants.isLoginPageDisplayed); + + RegisterPage registerPage = new RegisterPage(driver); + LoginPage loginPage = new LoginPage(driver); + loginPage.enterUserName("0"+data); + loginPage.enterPassword(password); + loginPage.ClickOnLoginButton(); + assertTrue(dashboardpage.isPartnerCertificateTitleDisplayed(), GlobalConstants.isPartnerCertificateTitleDisplayed); PartnerCertificatePage partnerCertificatePage=dashboardpage.clickOnPartnerCertificateTitle(); - assertTrue(partnerCertificatePage.isPartnerCertificatePageDisplayed(), GlobalConstants.isPartnerCertificatePageDisplayed); + assertTrue(partnerCertificatePage.isPartnerCertificatePageDisplayed(), GlobalConstants.isPartnerCertificatePageDisplayed); partnerCertificatePage.clickOnUploadButton(); assertTrue(partnerCertificatePage.isUploadPartnerCertificatePopUpDisplayed(), GlobalConstants.isUploadPartnerCertificatePopUpDisplayed); @@ -90,25 +161,11 @@ public void registerNewUser() { partnerCertificatePage.clickOnCloseButton(); dashboardpage = partnerCertificatePage.clickOnHomeButton(); - assertTrue(dashboardpage.isPoliciesTitleDisplayed(), GlobalConstants.isPoliciesTitleDisplayed); - PoliciesPage policiesPage=dashboardpage.clickOnPoliciesTitle(); - - assertTrue(policiesPage.isPoliciesPageDisplayed(), GlobalConstants.isPoliciesPageDisplayed); - policiesPage.clickOnRequestPolicyButton(); - - assertTrue(policiesPage.isPartnerIdDropdownDisplayed(), GlobalConstants.isPartnerIdDropdownDisplayed); - policiesPage.selectPartnerIdDropdown("ad" + data); - - assertTrue(policiesPage.isPolicyNameDropdownDisplayed(), GlobalConstants.isPolicyNameDropdownDisplayed); - policiesPage.selectPolicyNameDropdown("ad" + data); - policiesPage.enterComments(data); - - assertTrue(policiesPage.isSubmitButtonDisplayed(), GlobalConstants.isSubmitButtonDisplayed); - policiesPage.clickSubmitButton(); - - assertTrue(policiesPage.isPolicySubmittedSuccessfullyDisplayed(), GlobalConstants.isSubmitButtonDisplayed); - + dashboardpage.clickOnPartnerCertificateTitle(); - - } + partnerCertificatePage.clickOnPartnerCertificateReuploadButton(); + partnerCertificatePage.uploadCertificate(); + partnerCertificatePage.clickOnSubmitButton(); + assertTrue(partnerCertificatePage.isSucessMessageDisplayed(), GlobalConstants.isSucessMessageDisplayed); + } } diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/utility/GlobalConstants.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/utility/GlobalConstants.java index c7fec8c18..54795ec22 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/utility/GlobalConstants.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/utility/GlobalConstants.java @@ -37,7 +37,6 @@ public class GlobalConstants { public static final String isEnterValidLogoUriTextDisplayed = "Verify if enter valid logo uri text displayed"; public static final String isEnterRedirectUriTextDisplayed = "Verify if enter valid redirect uri text displayed"; public static final String isAutherisationCodeTextDisplayed = "Verify if Authrisation code is selected by default displayed"; - public static final String isPolicyGroupHeaderTextDisplayed = "Verify if policy group header text displayed"; public static final String isPolicyNameHeaderTextDisplayed = "Verify if policy name header text displayed"; public static final String isOIDCClientNameHeaderTextDisplayed = "Verify if oidc client name header text displayed"; @@ -48,4 +47,21 @@ public class GlobalConstants { public static final String isRequestPolicyEnabled = "Verify if request policy button enabled"; public static final String isGenerateAPIKeyDisplayed = "Verify if generate api key text displayed."; public static final String isApiKeyHeaderTextDisplayed = "Verify if api key header Text displayed"; + public static final String isListOfPolicyRequestedTextDisplayed = "Verify if list of policy requested text displayed"; + public static final String isNextPageDisplayed = "Verify if next page for policy requested displayed"; + public static final String isPreviousPageDisplayed = "Verify if Previous page for policy requested displayed"; + public static final String isPendingForApprovalDisplayed = "Verify if pending for approval text displayed"; + public static final String isPartnerIdTextDisplayed = "Verify if partner id text displayed"; + public static final String isPartnerIdDescAscIcon = "Verify if partner Asending decending icon displayed"; + public static final String isPartnerTypeDescAscIcon = "Verify if partner type Asending decending icon displayed"; + public static final String isPolicyGroupNameDescAscIcon = "Verify if policy group name type Asending decending icon displayed"; + public static final String isPolicyNameDescAscIcon = "Verify if policy name Asending decending icon displayed"; + public static final String isCreatedDateTimeDescAscIcon = "Verify if created date time Asending decending icon displayed"; + public static final String isSubTitleHomeDisplayed = "Verify if subtitle home displayed"; + public static final String isSubTitleDisplayed = "Verify if subtitle displayed"; + public static final String isBackArrow = "Verify if back arrow icon displayed"; + public static final String isViewPolicyTitle = "Verify if view policy title displayed"; + public static final String isSelectPolicyGroupViewMoreAndLess = "Verify if select policy group view more and less is displayed"; + public static final String isSelectPolicyGroupSubmitDisabled = "Verify if select policy group submit disabled"; + } diff --git a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/utility/TestRunner.java b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/utility/TestRunner.java index 12943ee1b..5c3da9c17 100644 --- a/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/utility/TestRunner.java +++ b/uitest-pmprevamp/src/main/java/io/mosip/testrig/pmprevampui/utility/TestRunner.java @@ -53,6 +53,8 @@ public static void startTestRunner() throws Exception { if(test.equals("RegisterNewUser")) { classes.add(RegisterNewUser); + classes.add(NewUserPolicy); + } if(test.equals("NewUserPolicy")) { classes.add(NewUserPolicy); diff --git a/uitest-pmprevamp/src/main/resources/testngFile/testng.xml b/uitest-pmprevamp/src/main/resources/testngFile/testng.xml index e8dab54c2..aa54e52f3 100644 --- a/uitest-pmprevamp/src/main/resources/testngFile/testng.xml +++ b/uitest-pmprevamp/src/main/resources/testngFile/testng.xml @@ -9,12 +9,11 @@ + - -