Skip to content

Commit

Permalink
MOSIP-30082 MOSIP-30054 (mosip#983)
Browse files Browse the repository at this point in the history
* MOSIP-29934

Signed-off-by: Anup Nehe <[email protected]>

* MOSIP-29934

Signed-off-by: Anup Nehe <[email protected]>

* MOSIP-29937

Signed-off-by: Anup Nehe <[email protected]>

* MOSIP-29937

Signed-off-by: Anup Nehe <[email protected]>

* MOSIP-29937

Signed-off-by: Anup Nehe <[email protected]>

* MOSIP-29937

Signed-off-by: Anup Nehe <[email protected]>

* MOSIP-29937

Signed-off-by: Anup Nehe <[email protected]>

* resolve

Signed-off-by: Anup Nehe <[email protected]>

* MOSIP-30054

Signed-off-by: Anup Nehe <[email protected]>

* MOSIP-30082

Signed-off-by: Anup Nehe <[email protected]>

* added testng.xml

Signed-off-by: Anup Nehe <[email protected]>

* MOSIP-30125 MOSIP-30054

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflict

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflict

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflict

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflict

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflict

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflict

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflict

Signed-off-by: Anup Nehe <[email protected]>

* resolve conflict

Signed-off-by: Anup Nehe <[email protected]>

---------

Signed-off-by: Anup Nehe <[email protected]>
  • Loading branch information
anup-nehe authored and srikanth716 committed Nov 23, 2023
1 parent 538da2b commit cd178b9
Show file tree
Hide file tree
Showing 17 changed files with 470 additions and 14 deletions.
12 changes: 12 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
Expand Up @@ -59,6 +59,18 @@ private void waitForElementToBeVisible(WebElement element) {
WebDriverWait wait = new WebDriverWait(driver, ofSeconds(30));
wait.until(ExpectedConditions.visibilityOf(element));
}

protected boolean isElementEnabled(WebElement element) {
try {
waitForElementToBeVisible(element);
element.isEnabled();
ExtentLogger.pass(element + " is displayed");
return true;
} catch (Exception e) {
//ExtentLogger.fail(elementName + " is not displayed");
return false;
}
}

protected void sendKeysToTextBox(WebElement element, String text, String elementName) {
this.waitForElementToBeVisible(element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@ public class ConfirmPasscode extends BasePage {
@iOSXCUITFindBy(accessibility = "Confirm passcode")
@AndroidFindBy(xpath = "//*[contains(@text,'Confirm passcode')]")
private WebElement confirmPasscode;


@AndroidFindBy(xpath = "//*[contains(@text,'Passcode did not match.')]")
private WebElement invalidPasscode;

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

public boolean isPasscodeInvalidMessageDisplayed() {
return this.isElementDisplayed(invalidPasscode, "Passcode did not match.");
}

public boolean isConfirmPassCodePageLoaded() {
return this.isElementDisplayed(confirmPasscode, "Confirm passcode page");
Expand Down
12 changes: 10 additions & 2 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 @@ -3,6 +3,7 @@
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.iOSXCUITFindBy;

import org.openqa.selenium.WebElement;

public class HelpPage extends BasePage {
Expand All @@ -14,7 +15,10 @@ public class HelpPage extends BasePage {
@AndroidFindBy(xpath = "//*[@resource-id=\"iconIcon\"]")
@iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeOther[`label == \"\uE5CD\"`][2]")
private WebElement crossIcon;


@AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector()).scrollIntoView(text(\"How to view activity logs?\"));")
public WebElement howToViewActivity;

public HelpPage(AppiumDriver driver) {
super(driver);
}
Expand All @@ -26,5 +30,9 @@ public boolean isHelpPageLoaded() {
public void exitHelpPage() {
this.clickOnElement(crossIcon);
}


public void ScrollToViewActivityLog() {
howToViewActivity.click();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.iOSXCUITFindBy;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

Expand All @@ -27,11 +30,30 @@ private boolean verifyHistoryIos(String vcNumber) {
By locator = By.xpath("//*[contains(@name,'" + vcNumber + " downloaded')]");
return this.isElementDisplayed(locator, "Downloaded VC in ios");
}



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

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

private int verifyNumberOfRecordsInHistoryAndroid(String vcNumber) throws InterruptedException {
By locator = By.xpath("//*[contains(@text,'" + vcNumber + " downloaded')]");
List<WebElement> elements = driver.findElements(locator);
return elements.size();
}

private int verifyNumberOfRecordsInHistoryIos(String vcNumber) {
By locator = By.xpath("//*[contains(@name,'\" + vcNumber + \" downloaded')]");
List<WebElement> elements = driver.findElements(locator);
return elements.size();
}

public boolean verifyHistory(String vcNumber, Target os) {
switch (os) {
Expand All @@ -42,8 +64,27 @@ public boolean verifyHistory(String vcNumber, Target os) {
}
return false;
}


public int getNumberOfRecordsInHistory(String vcNumber, Target os, String string) throws InterruptedException {
switch (os) {
case ANDROID:
return verifyNumberOfRecordsInHistoryAndroid(vcNumber);
case IOS:
return verifyNumberOfRecordsInHistoryIos(vcNumber);
}
return 0;
}

public boolean noHistoryAvailable() {
return this.isElementDisplayed(noHistoryAvailable, "No history available yet");
}

public boolean verifyDeleteHistory(String vcNumber, Target os) {
switch (os) {
case ANDROID:
return verifyDeleteHistoryAndroid(vcNumber);

}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ public boolean isNameDisplayed(String name) {
By fullName = By.xpath("//*[contains(@name,'" + name + "') or contains(@text,'" + name + "')]");
return this.isElementDisplayed(fullName, 60, "Name on downloaded card");
}

public boolean isSecondNameDisplayed(String name) {
By fullName = By.xpath("(//*[contains(@text,'" + name + "')])[2]");
return this.isElementDisplayed(fullName, 60, "Name on downloaded card");

}

public DetailedVcViewPage openDetailedVcView(String name) {
By fullName = By.xpath("//*[contains(@name,'" + name + "') or contains(@text,'" + name + "')]");
Expand Down Expand Up @@ -110,7 +116,8 @@ public MoreOptionsPage clickOnMoreOptionsButton() throws InterruptedException {
public boolean isPinIconDisplayed() {
return this.isElementDisplayed(pinIcon, "pin icon");
}



public boolean isNoVCDownloaded() {
return this.isElementDisplayed(bringYourDigitalIdentity, "Bring your digital identity");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class MoreOptionsPage extends BasePage {
@AndroidFindBy(accessibility = "profileAuthenticated")
@iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeOther[`label == \"\uE8E8 Activated for online login!\"`][4]")
private WebElement activatedForOnlineLoginButton;

@AndroidFindBy(xpath = "//*[@resource-id=\"iconIcon\"]")
private WebElement CloseButton;

public MoreOptionsPage(AppiumDriver driver) {
super(driver);
Expand All @@ -51,4 +54,9 @@ public PleaseConfirmPopupPage clickOnActivationPending() {
public boolean isVcActivatedForOnlineLogin() {
return this.isElementDisplayed(activatedForOnlineLoginButton, "Activated for online login text");
}

public HomePage ClickOnCloseButton() {
clickOnElement(CloseButton);
return new HomePage(driver);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ public class PleaseConfirmPopupPage extends BasePage {
@AndroidFindBy(accessibility = "yesConfirm")
@iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeButton[`label == \"Yes, I confirm\"`]")
private WebElement yesButton;

@AndroidFindBy(accessibility = "no")
private WebElement noButton;

public PleaseConfirmPopupPage(AppiumDriver driver) {
super(driver);
Expand All @@ -22,5 +25,10 @@ public OtpVerificationPage clickOnConfirmButton() {
clickOnElement(yesButton);
return new OtpVerificationPage(driver);
}

public OtpVerificationPage clickOnNoButton() {
clickOnElement(noButton);
return new OtpVerificationPage(driver);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public class RetrieveIdPage extends BasePage {
@AndroidFindBy(xpath = "//*[contains(@text,'Get it now')]")
@iOSXCUITFindBy(accessibility = "Get it now")
private WebElement getItNowText;

@AndroidFindBy(xpath = "//*[contains(@text,'UIN invalid')]")
private WebElement invalidUin;



@AndroidFindBy(xpath = "//*[contains(@text,'The input format is incorrect')]")
private WebElement inputFormatErrorMessage;
Expand Down Expand Up @@ -59,6 +64,10 @@ public GenerateUinOrVidPage clickOnGetItNowText() {
this.clickOnElement(getItNowText);
return new GenerateUinOrVidPage(driver);
}

public boolean isInvalidUinMassageLoaded() {
return this.isElementDisplayed(invalidUin, "UIN invalid");
}


public RetrieveIdPage clickOnVid(Target os) {
Expand Down
15 changes: 15 additions & 0 deletions injitest/src/main/java/io/mosip/test/mob/inji/pages/ScanPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ public class ScanPage extends BasePage{

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Allow\")")
private WebElement allowButton;

@AndroidFindBy(className = "android.widget.ImageView")
private WebElement flipCamera;

@AndroidFindBy(xpath = "//*[contains(@text,'Hold the phone steady and scan the QR code')]")
private WebElement holdCameraSteady;

public ScanPage(AppiumDriver driver) {
super(driver);
Expand All @@ -32,4 +38,13 @@ public ScanPage acceptPermissionPopup(){
public boolean isCameraOpen(){
return isElementDisplayed(camera, "camera");
}

public boolean isCameraPageLoaded() {
return this.isElementEnabled(holdCameraSteady);
}

public boolean isFlipCameraClickable() {
return this.isElementEnabled(flipCamera);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.mosip.test.mob.inji.pages.*;
import io.mosip.test.mob.inji.utils.TestDataReader;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

Expand Down Expand Up @@ -57,4 +58,120 @@ public void deleteVcAndVerifyInHistory() throws InterruptedException {
historyPage.verifyHistory(BaseTestCase.uin + " Removed from wallet", target);

}
}

@Test
public void cancelDeleteVc() throws InterruptedException {
ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver);

assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed");
WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference();

assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded");
AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton();

assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed");
SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode();

assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed");
ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target);

assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed");
HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target);

assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed");
AddNewCardPage addNewCardPage = homePage.downloadCard();

assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed");
RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin();

assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed");
OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(BaseTestCase.uin).clickOnGenerateCardButton();

assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed");
otpVerification.enterOtp(GetOtp(), target);

assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed");

MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton();
assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed");

PleaseConfirmPopupPage pleaseConfirmPopupPage = moreOptionsPage.clickOnRemoveFromWallet();
assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed");

pleaseConfirmPopupPage.clickOnNoButton();
assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed");

moreOptionsPage.ClickOnCloseButton();
assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed");
}

@Test
public void DownloadingDeletedVc() throws InterruptedException {
ChooseLanguagePage chooseLanguagePage = new ChooseLanguagePage(driver);

assertTrue(chooseLanguagePage.isChooseLanguagePageLoaded(), "Verify if choose language page is displayed");
WelcomePage welcomePage = chooseLanguagePage.clickOnSavePreference();

assertTrue(welcomePage.isWelcomePageLoaded(), "Verify if welcome page is loaded");
AppUnlockMethodPage appUnlockMethodPage = welcomePage.clickOnSkipButton();

assertTrue(appUnlockMethodPage.isAppUnlockMethodPageLoaded(), "Verify if app unlocked page is displayed");
SetPasscode setPasscode = appUnlockMethodPage.clickOnUsePasscode();

assertTrue(setPasscode.isSetPassCodePageLoaded(), "Verify if set passcode page is displayed");
ConfirmPasscode confirmPasscode = setPasscode.enterPasscode(TestDataReader.readData("passcode"), target);

assertTrue(confirmPasscode.isConfirmPassCodePageLoaded(), "Verify if confirm passcode page is displayed");
HomePage homePage = confirmPasscode.confirmPasscode(TestDataReader.readData("passcode"), target);

assertTrue(homePage.isHomePageLoaded(), "Verify if home page is displayed");
AddNewCardPage addNewCardPage = homePage.downloadCard();

assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed");
RetrieveIdPage retrieveIdPage = addNewCardPage.clickOnDownloadViaUin();

assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed");
OtpVerificationPage otpVerification = retrieveIdPage.setEnterIdTextBox(BaseTestCase.uin).clickOnGenerateCardButton();

assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed");
otpVerification.enterOtp(GetOtp(), target);

assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed");

MoreOptionsPage moreOptionsPage = homePage.clickOnMoreOptionsButton();
assertTrue(moreOptionsPage.isMoreOptionsPageLoaded(), "Verify if more options page is displayed");

PleaseConfirmPopupPage pleaseConfirmPopupPage = moreOptionsPage.clickOnRemoveFromWallet();
assertTrue(pleaseConfirmPopupPage.isPleaseConfirmPopupPageLoaded(), "Verify if pop up page is displayed");

pleaseConfirmPopupPage.clickOnConfirmButton();
assertFalse(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if VC is removed");

homePage.downloadCard();

assertTrue(addNewCardPage.isAddNewCardPageLoaded(), "Verify if add new card page is displayed");
addNewCardPage.clickOnDownloadViaUin();

assertTrue(retrieveIdPage.isRetrieveIdPageLoaded(), "Verify if retrieve id page is displayed");
retrieveIdPage.setEnterIdTextBox(BaseTestCase.uin).clickOnGenerateCardButton();

assertTrue(otpVerification.isOtpVerificationPageLoaded(), "Verify if otp verification page is displayed");
otpVerification.enterOtp(GetOtp(), target);

assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed");

HistoryPage historyPage = homePage.clickOnHistoryButton();
assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed");

assertTrue(historyPage.verifyHistory(BaseTestCase.uin, target));

historyPage.getNumberOfRecordsInHistory(BaseTestCase.uin, target,"Verify two download records in history page");
assertEquals(historyPage.getNumberOfRecordsInHistory(BaseTestCase.uin, target,"Asserting two records"),2);


assertTrue(historyPage.verifyDeleteHistory(BaseTestCase.uin, target), "Verify if deleted history is displayed");


}

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public void generateUinOrVidUsingAid() {

assertTrue(homePage.isNameDisplayed(TestDataReader.readData("fullName")), "Verify if full name is displayed");


}
}

}
Loading

0 comments on commit cd178b9

Please sign in to comment.