Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credential Registry testcases, help page new test cases added , MOSIP-30054 MOSIP-30230 MOSIP-30282 #1024

Merged
merged 7 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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(
Expand Down Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
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
Expand Up @@ -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);
}
Expand All @@ -26,5 +30,9 @@ public RetrieveIdPage clickOnDownloadViaUin(){
clickOnElement(downloadViaUin);
return new RetrieveIdPage(driver);
}


public AddNewCardPage clickOnBack() {
clickOnElement(backButton);
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,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);
Expand Down
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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camel casing

return CredentialRegistryTextBox.getText();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camel casing

return qrCodeHeader.isDisplayed();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camel casing


public HassleFreeAuthenticationPage(AppiumDriver driver) {
super(driver);
Expand All @@ -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
Expand Up @@ -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);
Expand All @@ -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
Expand Up @@ -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) {
Expand Down
15 changes: 13 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
Expand Up @@ -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) {
Expand All @@ -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");
}

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

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

public HomePage clickOnTryAgainbutton() {
clickOnElement(tryAgainButton);
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camel casing


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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camel casing


public MoreOptionsPage(AppiumDriver driver) {
super(driver);
}
Expand Down Expand Up @@ -61,4 +64,8 @@ public HomePage ClickOnCloseButton() {
clickOnElement(CloseButton);
return new HomePage(driver);
}

public boolean isSomthingIsWrongPopupVisible() {
return this.isElementDisplayed(SomthingIsWrongPopup, "Something is wrong. Please try again later!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class OtpVerificationPage extends BasePage {
@AndroidFindBy(accessibility = "close")
@iOSXCUITFindBy(accessibility = "close")
private WebElement crossIcon;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"VID not available in database\")")
private WebElement vidNotAvailableMessage;

public OtpVerificationPage(AppiumDriver driver) {
super(driver);
Expand Down Expand Up @@ -61,4 +64,8 @@ public MoreOptionsPage clickOnCancelButton(){
public void clickOnCrossIcon(){
clickOnElement(crossIcon);
}

public boolean vidNotAvailableDisplayed() {
return this.isElementDisplayed(vidNotAvailableMessage, "VID not available in database");
}
}
Loading