Skip to content

Commit

Permalink
MOSIP-34116 - Added register testcases for Device provider (#996)
Browse files Browse the repository at this point in the history
Signed-off-by: Mohanachandran S <[email protected]>
  • Loading branch information
mohanachandran-s authored Dec 6, 2024
1 parent b5c6324 commit 307f3e3
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 5 deletions.
6 changes: 3 additions & 3 deletions uitest-pmprevamp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@
<json.simple.version>1.1.1</json.simple.version>
<commons.collections4.version>4.4</commons.collections4.version>
<commons.lang.version>2.6</commons.lang.version>
<httpclient5.version>5.1.3</httpclient5.version>
<httpcore5.version>5.1.3</httpcore5.version>
<httpclient5.version>5.2.1</httpclient5.version>
<httpcore5.version>5.2.1</httpcore5.version>
<testng.version>7.10.1</testng.version>
<javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
<commons.beanutils.version>1.9.2</commons.beanutils.version>
<resteasy-jaxrs.version>3.15.0.Final</resteasy-jaxrs.version>
<aws-java-sdk-s3.version>1.12.470</aws-java-sdk-s3.version>
<ngwebdriver.version>1.1.5</ngwebdriver.version>
<extentreports.version>5.0.9</extentreports.version>
<webdrivermanager.version>5.1.0</webdrivermanager.version>
<webdrivermanager.version>5.5.3</webdrivermanager.version>
<keycloak-admin-client.version>17.0.1</keycloak-admin-client.version>
<fileName>pmprevampui-1.2.1-SNAPSHOT-jar-with-dependencies</fileName>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public static void createUsers() {
moduleSpecificUser = needsToBeCreatedUser;
} else if (needsToBeCreatedUser.equals("nocert")) {
moduleSpecificUser = needsToBeCreatedUser;
} else if (needsToBeCreatedUser.equals("device")) {
moduleSpecificUser = needsToBeCreatedUser;
}

else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public class PartnerCertificatePage extends BasePage {

@FindBy(xpath = "//*[text()='Partner certificate for Authentication Partner is uploaded successfully.']")
private WebElement sucessMessage;

@FindBy(xpath = "//*[text()='Partner certificate for Device Provider is uploaded successfully.']")
private WebElement deviceProviderSuccessMessage;

@FindBy(id = "fileInput")
private WebElement uploadFile;
Expand Down Expand Up @@ -85,6 +88,9 @@ public class PartnerCertificatePage extends BasePage {
@FindBy(id = "partnerDomain_selector_dropdown_option3")
private WebElement partnerDomainSelectorDropdownOptionAuth;

@FindBy(id = "partnerDomain_selector_dropdown_option2")
private WebElement deviceInPartnerDomainSelectorDropdown;

@FindBy(id = "upload_admin_certificate_btn")
private WebElement SubmitButtonForAdmin;

Expand Down Expand Up @@ -124,6 +130,10 @@ public void clickOnSubmitButton() {
public boolean isSucessMessageDisplayed() {
return isElementDisplayed(sucessMessage);
}

public boolean isDeviceProviderSuccessMessage() {
return isElementDisplayed(deviceProviderSuccessMessage);
}

public void clickOnCloseButton() {
clickOnElement(closeButton);
Expand Down Expand Up @@ -206,6 +216,9 @@ public void clickOnpartnerpartnerDomainSelectorDropdownOptionAuth() {
clickOnElement(partnerDomainSelectorDropdownOptionAuth);
}

public void ClickOnDeviceInPartnerDomainSelectorDropdown() {
clickOnElement(deviceInPartnerDomainSelectorDropdown);
}
public void ClickonSubmitButtonForAdmin() {
clickOnElement(SubmitButtonForAdmin);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public boolean isPartnerTypeDropdownDisplayed() {
public void selectPartnerTypeDropdown() {
dropdownByIndex(partnerTypeDropdown, 2);
}

public void selectDeviceProviderInPartnerTypeDropdown() {
dropdownByIndex(partnerTypeDropdown, 0);
}

public boolean isAddressTextBoxDisplayed() {
return isElementDisplayed(addressTextbox);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
package io.mosip.testrig.pmprevampui.testcase;

import static org.testng.Assert.assertTrue;

import org.testng.annotations.Test;

import io.mosip.testrig.pmprevampui.pages.DashboardPage;
import io.mosip.testrig.pmprevampui.pages.LoginPage;
import io.mosip.testrig.pmprevampui.pages.PartnerCertificatePage;
import io.mosip.testrig.pmprevampui.pages.RegisterPage;
import io.mosip.testrig.pmprevampui.utility.BaseClass;
import io.mosip.testrig.pmprevampui.utility.GlobalConstants;

public class DevicePartnerTest extends BaseClass {

@Test(priority = 1,description = "This is a test case register new device user")
public void registerNewUser() throws InterruptedException {
DashboardPage dashboardpage = new DashboardPage(driver);
PartnerCertificatePage partnerCertificatePage = new PartnerCertificatePage(driver);
RegisterPage registerPage = new RegisterPage(driver);

assertTrue(dashboardpage.isTermsAndConditionsPopUppDisplayed(), GlobalConstants.isTermsAndConditionsPopUppDisplayed);
dashboardpage.clickOnCheckbox();

assertTrue(dashboardpage.isProceedButtonDisplayed(), GlobalConstants.isProceedButtonDisplayed);
dashboardpage.clickOnProceedButton();

dashboardpage.clickOnRootOFTrustCertText();
dashboardpage.clickOnRootCertificateUploadButton();
partnerCertificatePage.clickOnpartnerDomainSelectorDropdown();
partnerCertificatePage.ClickOnDeviceInPartnerDomainSelectorDropdown();
partnerCertificatePage.uploadCertificateRootCa();
partnerCertificatePage.ClickonSubmitButtonForAdmin();
partnerCertificatePage.ClickOnGoBackButton();
dashboardpage.clickOnRootCertificateUploadButton();
partnerCertificatePage.clickOnpartnerDomainSelectorDropdown();
partnerCertificatePage.ClickOnDeviceInPartnerDomainSelectorDropdown();
partnerCertificatePage.uploadCertificateSubCa();
partnerCertificatePage.ClickonSubmitButtonForAdmin();
partnerCertificatePage.ClickOnGoBackButton();
dashboardpage.clickOnProfileDropdown();
assertTrue(dashboardpage.isLogoutButtonDisplayed(), GlobalConstants.isLogoutButtonDisplayed);

LoginPage loginpage = dashboardpage.clickOnLogoutButton();
assertTrue(loginpage.isLoginPageDisplayed(), GlobalConstants.isLoginPageDisplayed);

loginpage.clickRegisterButton();

registerPage.enterFirstName("pmpui-device");
assertTrue(registerPage.isLastNameTextBoxDisplayed(), GlobalConstants.isLastNameTextBoxDisplayed);
registerPage.enterLastName("pmpui-device");

assertTrue(registerPage.isOrganizationNameDisplayed(), GlobalConstants.isOrganizationNameDisplayed);
registerPage.enterOrganizationName("AABBCC");

assertTrue(registerPage.isPartnerTypeDropdownDisplayed(), GlobalConstants.isPartnerTypeDropdownDisplayed);
registerPage.selectDeviceProviderInPartnerTypeDropdown();

assertTrue(registerPage.isAddressTextBoxDisplayed(), GlobalConstants.isAddressTextBoxDisplayed);
registerPage.enterAddress("0"+ data + "device");

assertTrue(registerPage.isEmailTextBoxDisplayed(), GlobalConstants.isEmailTextBoxDisplayed);
registerPage.enterEmail("0"+ data + "device" + "@gmail.com");

assertTrue(registerPage.isPhoneNumberTextboxDisplayed(), GlobalConstants.isPhoneNumberTextboxDisplayed);
registerPage.enterPhone("9876543010");

assertTrue(registerPage.isNotificationLanguageDropdownDisplayed(), GlobalConstants.isNotificationLanguageDropdownDisplayed);
registerPage.selectNotificationLanguageDropdown();

assertTrue(registerPage.isUsernameTextBoxDisplayed(), GlobalConstants.isUsernameTextBoxDisplayed);
registerPage.enterUsername("pmpui-device");

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.isTermsAndConditionsPopUppDisplayed(), GlobalConstants.isTermsAndConditionsPopUppDisplayed);
dashboardpage.clickOnCheckbox();

assertTrue(dashboardpage.isProceedButtonDisplayed(), GlobalConstants.isProceedButtonDisplayed);
dashboardpage.clickOnProceedButton();

Thread.sleep(3000);
assertTrue(dashboardpage.isPartnerCertificateTitleDisplayed(), GlobalConstants.isPartnerCertificateTitleDisplayed);

dashboardpage.clickOnPartnerCertificateTitle();

assertTrue(partnerCertificatePage.isPartnerCertificatePageDisplayed(), GlobalConstants.isPartnerCertificatePageDisplayed);
partnerCertificatePage.clickOnUploadButton();

assertTrue(partnerCertificatePage.isUploadPartnerCertificatePopUpDisplayed(), GlobalConstants.isUploadPartnerCertificatePopUpDisplayed);
partnerCertificatePage.uploadCertificate();
partnerCertificatePage.clickOnSubmitButton();

assertTrue(partnerCertificatePage.isDeviceProviderSuccessMessage(), GlobalConstants.isDeviceProviderSucessMessageDisplayed);
partnerCertificatePage.clickOnCloseButton();
dashboardpage = partnerCertificatePage.clickOnHomeButton();

dashboardpage.clickOnPartnerCertificateTitle();
partnerCertificatePage.clickOnPartnerCertificateReuploadButton();

assertTrue(partnerCertificatePage.isReUploadPartnerCertificateTextDisplayed(), GlobalConstants.iReUploadPartnerCertificateTextDisplayed);
// assertTrue(partnerCertificatePage.isReUploadPartnerCertificateSubTextDisplayed(), GlobalConstants.isReUploadPartnerCertificateSubTextDisplayed);

assertTrue(partnerCertificatePage.isPartnerDomainTypeDisplayed(), GlobalConstants.iReUploadPartnerCertificateTextDisplayed);
assertTrue(partnerCertificatePage.isPartnerCertOvelayDisplayed(), GlobalConstants.iReUploadPartnerCertificateTextDisplayed);

partnerCertificatePage.uploadCertificate();
partnerCertificatePage.clickOnSubmitButton();
assertTrue(partnerCertificatePage.isDeviceProviderSuccessMessage(), GlobalConstants.isDeviceProviderSucessMessageDisplayed);
partnerCertificatePage.clickOnRemoveCertificateButton();

partnerCertificatePage.uploadCertificateInvalidCert();
assertTrue(partnerCertificatePage.isInvalidFormatErrorPopupDisplayed(), GlobalConstants.isInvalidCertFormatePopupDisplayed);

partnerCertificatePage.clickOnCertificateUploadCancelButton();

partnerCertificatePage.clickOnDownloadButton();
partnerCertificatePage.clickOnOriginalCertificateDownloadButton();
assertTrue(partnerCertificatePage.isOriginalSignedCertDownloadedPopupDisplayed(), GlobalConstants.isOriginalCertificateDownloadPopupDisplayed);

partnerCertificatePage.clickOnMosipSignedCertificateDownloadButton();
assertTrue(partnerCertificatePage.isMosipSignedCertPopupDisplayed(), GlobalConstants.isMosipCertificateDownloadPopupDisplayed);

// assertTrue(partnerCertificatePage.isSucessMessageDisplayed(), GlobalConstants.isSucessMessageDisplayed);
partnerCertificatePage.ClickOnsuccessMsgCloseButton();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class GlobalConstants {
public static final String isPartnerCertificatePageDisplayed = "Verify if partner certificate page is displayed";
public static final String isUploadPartnerCertificatePopUpDisplayed = "Verify if upload partner certificate pop up is displayed";
public static final String isSucessMessageDisplayed = "Verify if Partner certificate for Authentication Partner is uploaded successfully.";
public static final String isDeviceProviderSucessMessageDisplayed = "Verify if Partner certificate for device provider is uploaded successfully.";
public static final String isPoliciesTitleDisplayed = "Verify if policies title is displayed";
public static final String isPoliciesPageDisplayed = "Verify if policies page is displayed after click on policies title";
public static final String isPartnerIdDropdownDisplayed = "Verify if partner id dropdown is displayed.";
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ delete from pms.partner_policy_request where cr_by='pmpui-auth';
delete from pms.policy_group where cr_by='pmpui-revamp';
delete from pms.partner where cr_by='pmpui-auth';
delete from pms.partner where user_id='pmpui-nocert';
delete from pms.partner where user_id='pmpui-device';
delete from pms.partner where cr_by='pmpui-revamp';
delete from pms.partner_h where cr_by='pmpui-auth';
delete from pms.partner_h where cr_by='pmpui-revamp';
delete FROM pms.user_details where user_id='pmpui-revamp';
delete FROM pms.user_details where user_id='pmpui-auth';
delete FROM pms.user_details where user_id='pmpui-nocert';
delete FROM pms.user_details where user_id='pmpui-device';
delete from pms.oidc_client where cr_by='pmpui-revamp';
delete from pms.auth_policy where cr_by='pmpui-revamp';
delete from pms.policy_group where cr_by='pmpui-revamp';
Expand Down
5 changes: 3 additions & 2 deletions uitest-pmprevamp/src/main/resources/testngFile/testng.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

<classes>
<class name="io.mosip.testrig.pmprevampui.testcase.AuthPartnerTest" />
<!-- <class name="io.mosip.testrig.pmprevampui.testcase.NewUserPolicy" />
<class name="io.mosip.testrig.pmprevampui.testcase.NewUserPolicy" />
<class name="io.mosip.testrig.pmprevampui.testcase.CreateOidecClient" />
<class name="io.mosip.testrig.pmprevampui.testcase.CreateApiKey" />-->
<class name="io.mosip.testrig.pmprevampui.testcase.CreateApiKey" />
<class name="io.mosip.testrig.pmprevampui.testcase.DevicePartnerTest" />
</classes>

</test>
Expand Down

0 comments on commit 307f3e3

Please sign in to comment.