Skip to content

Commit

Permalink
Credential Registry testcases, help page new test cases added , MOSIP…
Browse files Browse the repository at this point in the history
…-30054 MOSIP-30230 MOSIP-30282 (mosip#1024)

* MOSIP-30054 MOSIP-30230 MOSIP-30282

Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in>

* resolve conflicts

Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in>

* resolve conflict

Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in>

* resolve conflict

Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in>

* resolve conflict

Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in>

* resolve conflict

Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in>

* resolve conflict

Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in>

---------

Signed-off-by: Anup Nehe <anup.nehe@technoforte.co.in>
Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>
anup-nehe authored and vharsh committed Dec 1, 2023
1 parent 3380635 commit c0fd5bc
Showing 35 changed files with 1,272 additions and 78 deletions.
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
import org.json.simple.JSONObject;

import io.mosip.test.mob.inji.driver.TestRunner;
import io.mosip.test.mob.inji.utils.TestDataReader;

//import org.apache.log4j.Logger;

@@ -25,6 +26,7 @@ public class BaseTestCase {
public static String ApplnURI;
public static String ApplnURIForKeyCloak;
public static String testLevel;
protected static MockSMTPListener mockSMTPListener = null;
public static Properties props = getproperty(
TestRunner.getResourcePath() + "/config/application.properties");
public static Properties propsKernel = getproperty(
@@ -63,6 +65,9 @@ public static void intiateUINGenration() {
perpetualVid = AdminTestUtil.generateVID(uin, "perpetual");
onetimeuseVid = AdminTestUtil.generateVID(uin, "onetimeuse");
temporaryVid= AdminTestUtil.generateVID(uin, "temporary");

mockSMTPListener = new MockSMTPListener();
mockSMTPListener.run();
}
}

@@ -175,6 +180,13 @@ private static Properties getLoggerPropertyConfig() {
logProp.setProperty("log4j.appender.Appender2.layout.ConversionPattern", "%-7p %d [%t] %c %x - %m%n");
return logProp;
}

public static String getOtp() {
String otp="";
String externalemail = TestDataReader.readData("externalemail");
otp = MockSMTPListener.getOtp(externalemail);
return otp;
}

public static JSONObject getRequestJson(String filepath) {
return kernelCmnLib.readJsonData(filepath, true);
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ public class DriverManager {

private static AppiumDriver getAndroidDriver() throws MalformedURLException {
UiAutomator2Options options = new UiAutomator2Options();
options.setAvd(TestDataReader.readData("androidDevice"));
options.setUdid(TestDataReader.readData("androidDevice"));
options.setApp(TestDataReader.readData("androidAppPath"));
options.setAutoGrantPermissions(true);
appiumDriver.set(new AndroidDriver(new URL("http://127.0.0.1:4723"), (Capabilities)options));
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.mosip.test.mob.inji.pages;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.pagefactory.AndroidFindBy;
import org.openqa.selenium.WebElement;

public class AboutInjiPage extends BasePage{
@AndroidFindBy(accessibility = "aboutInji")
private WebElement aboutInjiHeader;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Copy\")")
private WebElement copy;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Copied\")")
private WebElement copied;

@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"iconIcon\")")
private WebElement backButton;

public AboutInjiPage(AppiumDriver driver) {
super(driver);
}

public boolean isaboutInjiHeaderDisplayed() {
return this.isElementDisplayed(aboutInjiHeader, "ABOUT INJI");
}

public boolean isAppidIsCopied() {
return this.isElementDisplayed(copied, "Copied");
}

public boolean isCopyTextDisplayed() {
return this.isElementDisplayed(copy, "Copy");
}

public AboutInjiPage clickOnCopy(){
clickOnElement(copy);
return this;
}

public AboutInjiPage clickOnBack(){
clickOnElement(copy);
return this;
}
}
Original file line number Diff line number Diff line change
@@ -14,6 +14,10 @@ public class AddNewCardPage extends BasePage{
@AndroidFindBy(accessibility = "issuerHeading-Mosip")
@iOSXCUITFindBy(accessibility = "issuerHeading-Mosip")
private WebElement downloadViaUin;

@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"iconIcon\")")
private WebElement backButton;

public AddNewCardPage(AppiumDriver driver) {
super(driver);
}
@@ -26,5 +30,9 @@ public RetrieveIdPage clickOnDownloadViaUin(){
clickOnElement(downloadViaUin);
return new RetrieveIdPage(driver);
}


public AddNewCardPage clickOnBack() {
clickOnElement(backButton);
return this;
}
}
23 changes: 23 additions & 0 deletions injitest/src/main/java/io/mosip/test/mob/inji/pages/BasePage.java
Original file line number Diff line number Diff line change
@@ -45,6 +45,17 @@ protected boolean isElementDisplayed(WebElement element, String elementName) {
return false;
}
}

protected boolean isElementInvisibleYet(WebElement element, String elementName) {
try {
waitForElementToBeInvisible(element);
ExtentLogger.pass(elementName + " is displayed");
return false;
} catch (Exception e) {
//ExtentLogger.fail(elementName + " is not displayed");
return true;
}
}

protected void clickOnElement(WebElement element) {
waitForElementToBeVisible(element);
@@ -60,6 +71,11 @@ private void waitForElementToBeVisible(WebElement element) {
wait.until(ExpectedConditions.visibilityOf(element));
}

private void waitForElementToBeInvisible(WebElement element) {
WebDriverWait wait = new WebDriverWait(driver, ofSeconds(30));
wait.until(ExpectedConditions.invisibilityOf(element));
}

protected boolean isElementEnabled(WebElement element) {
try {
waitForElementToBeVisible(element);
@@ -72,6 +88,13 @@ protected boolean isElementEnabled(WebElement element) {
}
}

protected void clearTextBoxAndSendKeys(WebElement element, String text, String elementName) {
this.waitForElementToBeVisible(element);
element.clear();
element.sendKeys(text);
ExtentLogger.pass(text + " entered in " + elementName);
}

protected void sendKeysToTextBox(WebElement element, String text, String elementName) {
this.waitForElementToBeVisible(element);
element.sendKeys(text);
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package io.mosip.test.mob.inji.pages;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.pagefactory.AndroidFindBy;
import org.openqa.selenium.WebElement;

public class CredentialRegistryPage extends BasePage {

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Edit Credential Registry\")")
public WebElement credentialRegistryTextBoxHeader;

@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"RNE__Input__text-input\")")
public WebElement credentialRegistryTextBox;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Save\")")
public WebElement saveButton;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Cancel\")")
public WebElement cancelButton;

@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"iconIcon\")")
public WebElement backArrow;

public CredentialRegistryPage(AppiumDriver driver) {
super(driver);
}

public boolean isCredentialRegistryTextBoxHeaderDisplayed() {
return this.isElementDisplayed(credentialRegistryTextBoxHeader, "Credential Registry Text heder is visible");
}

public CredentialRegistryPage setEnterIdTextBox(String env) {
clearTextBoxAndSendKeys(credentialRegistryTextBox, env, "Credential Registry env");
return this;
}

public CredentialRegistryPage clickOnSaveButton() {
clickOnElement(saveButton);
return this;
}

public CredentialRegistryPage clickOnCancelButton() {
clickOnElement(cancelButton);
return this;
}

public CredentialRegistryPage clickOnBackArrow() {
clickOnElement(backArrow);
return this;
}

public String checkEnvNotChanged() {
return credentialRegistryTextBox.getText();
}
}
Original file line number Diff line number Diff line change
@@ -58,6 +58,16 @@ public class DetailedVcViewPage extends BasePage{
@AndroidFindBy(accessibility = "close")
@iOSXCUITFindBy(accessibility = "close")
private WebElement crossIcon;

@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"iconIcon\")")
@iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeOther[`label == \"\uE5CD\"`][2]")
private WebElement qrCloseIcon;

@AndroidFindBy(xpath = "//android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup/android.view.ViewGroup")
private WebElement detailedVcViewPageQr;

@AndroidFindBy(accessibility = "qrCodeHeader")
private WebElement qrCodeHeader;

public DetailedVcViewPage(AppiumDriver driver) {
super(driver);
@@ -120,4 +130,18 @@ public HomePage clickOnCrossIcon(){
clickOnElement(crossIcon);
return new HomePage(driver);
}
}

public HomePage clickOnQrCrossIcon(){
clickOnElement(qrCloseIcon);
return new HomePage(driver);
}

public PleaseConfirmPopupPage clickOnQrCodeButton(){
clickOnElement(detailedVcViewPageQr);
return new PleaseConfirmPopupPage(driver);
}

public boolean isQrCodeDisplayed() {
return qrCodeHeader.isDisplayed();
}
}
Original file line number Diff line number Diff line change
@@ -14,6 +14,9 @@ public class HassleFreeAuthenticationPage extends BasePage {
@AndroidFindBy(xpath = "(//*[@class='android.widget.TextView'])[3]")
@iOSXCUITFindBy(xpath = "//*[contains(@value,'Authenticate yourself')]")
private WebElement hassleFreeAuthenticationDescription;

@AndroidFindBy(xpath = "//*[contains(@text,'Go Back')]")
public WebElement goBackButton;

public HassleFreeAuthenticationPage(AppiumDriver driver) {
super(driver);
@@ -26,4 +29,9 @@ public boolean isHassleFreeAuthenticationPageLoaded() {
public String getHassleFreeAuthenticationDescription() {
return this.getTextFromLocator(hassleFreeAuthenticationDescription);
}

public HassleFreeAuthenticationPage clickOnGoBack() {
clickOnElement(goBackButton);
return this;
}
}
17 changes: 12 additions & 5 deletions injitest/src/main/java/io/mosip/test/mob/inji/pages/HelpPage.java
Original file line number Diff line number Diff line change
@@ -12,12 +12,15 @@ public class HelpPage extends BasePage {
@iOSXCUITFindBy(accessibility = "helpScreen")
private WebElement helpText;

@AndroidFindBy(xpath = "//*[@resource-id=\"iconIcon\"]")
@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"iconIcon\")")
@iOSXCUITFindBy(accessibility = "close")
private WebElement crossIcon;

@AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector()).scrollIntoView(text(\"How to view activity logs?\"));")
public WebElement howToViewActivity;
@AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector()).scrollIntoView(text(\"What happens when Android keystore biometric is changed?\"));")
public WebElement biometricIsChangeTextdHeader;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"How to add a card?\")")
public WebElement helpPageContent;

public HelpPage(AppiumDriver driver) {
super(driver);
@@ -31,8 +34,12 @@ public void exitHelpPage() {
this.clickOnElement(crossIcon);
}

public void ScrollToViewActivityLog() {
howToViewActivity.click();
public void scrollPerformInHelpPage() {
biometricIsChangeTextdHeader.isDisplayed();
}

public boolean ishelpPageContentEmpty() {
return helpPageContent.getText().isBlank();
}

}
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ private boolean verifyHistoryAndroid(String vcNumber) {

private boolean verifyDeleteHistoryAndroid(String vcNumber) {
By locator = By.xpath("//*[contains(@text,'" + vcNumber + " Removed from wallet')]");
return this.isElementDisplayed(locator, "Downloaded VC in android");
return this.isElementDisplayed(locator, "Delete VC in android");
}

private boolean verifyDeletedHistoryIos(String vcNumber) {
19 changes: 17 additions & 2 deletions injitest/src/main/java/io/mosip/test/mob/inji/pages/HomePage.java
Original file line number Diff line number Diff line change
@@ -61,6 +61,9 @@ public class HomePage extends BasePage {
@AndroidFindBy(accessibility = "nationalCard")
@iOSXCUITFindBy(accessibility = "nationalCard")
private WebElement idTypeValue;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Try again\")")
private WebElement tryAgainButton;


public HomePage(AppiumDriver driver) {
@@ -71,9 +74,9 @@ public boolean isHomePageLoaded() {
/*if (isElementDisplayed(secureKeyStoragePopup, "secure key storage popup")) {
clickOnElement(riskItButton);
}*/
/*if (isElementDisplayed(securityFeatureUnavailablePopup, "security features will be unavailable popup")) {
if (isElementDisplayed(securityFeatureUnavailablePopup, "security features will be unavailable popup")) {
clickOnElement(okButton);
}*/
}
return this.isElementDisplayed(homeButton, "Home page");
}

@@ -140,5 +143,17 @@ public ScanPage clickOnScanButton(){
public boolean isIdTypeDisplayed() {
return this.isElementDisplayed(idTypeValue, "Name on downloaded card");
}

public boolean isTryAgainButtonDisplayed() {
return this.isElementDisplayed(tryAgainButton, "Try again");
}

public boolean isTryAgainButtonNotDisplayed() {
return this.isElementInvisibleYet(tryAgainButton, "Try again");
}

public HomePage clickOnTryAgainButton() {
clickOnElement(tryAgainButton);
return this;
}
}
Original file line number Diff line number Diff line change
@@ -27,9 +27,12 @@ public class MoreOptionsPage extends BasePage {
@iOSXCUITFindBy(accessibility = "profileAuthenticated")
private WebElement activatedForOnlineLoginButton;

@AndroidFindBy(xpath = "//*[@resource-id=\"iconIcon\"]")
@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"iconIcon\")")
@iOSXCUITFindBy(iOSClassChain ="**/XCUIElementTypeOther[`label == \"\uE5CD\"`][1]")
private WebElement CloseButton;
private WebElement closeButton;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Something is wrong. Please try again later!\")")
public WebElement somthingIsWrongPopup;

public MoreOptionsPage(AppiumDriver driver) {
super(driver);
@@ -57,8 +60,12 @@ public boolean isVcActivatedForOnlineLogin() {
return this.isElementDisplayed(activatedForOnlineLoginButton, "Activated for online login text");
}

public HomePage ClickOnCloseButton() {
clickOnElement(CloseButton);
public HomePage clickOnCloseButton() {
clickOnElement(closeButton);
return new HomePage(driver);
}

public boolean isSomthingIsWrongPopupVisible() {
return this.isElementDisplayed(somthingIsWrongPopup, "Something is wrong. Please try again later!");
}
}
Loading

0 comments on commit c0fd5bc

Please sign in to comment.