INJIMOB-3616 fixed the search issue for mock and MDL (#2122)

* [MOSIP-42741] [UI Testrig] Inji Mobile - Do the cleanup for duplicated assertions done in all the testcases

Signed-off-by: Aswin <aswingopal30@gmail.com>

* [MOSIP-42741] [UI Testrig] Inji Mobile - Do the cleanup for duplicated assertions done in all the testcases

Signed-off-by: Aswin <aswingopal30@gmail.com>

* Update DeletingVcTest.java

Updated as per the river comments 

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* Update VcDownloadAndVerifyUsingEsignetTest.java

updated the changes 

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* Update VcDownloadAndVerifyUsingEsignetTest.java

updated the changes 

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* Update keyManagement.java

updated the changes 

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* Update VerifyHistoryTest.java

updated the changes 

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* [MOSIP-42741] [UI Testrig] Inji Mobile - Do the cleanup for duplicated assertions done in all the testcases

Signed-off-by: Aswin <aswingopal30@gmail.com>

* Update KeyManagmentTest.java

47-line uncommented 

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* Update NoNetworkIosTest.java

removed the commented into uncommented line 448 and 449 

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* Update UnlockWithPasscodeTest.java

uncommented 

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* Update VcDownloadAndVerifyUsingMdl.java

uncommented line 105 106 106

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* Update VcDownloadAndVerifyUsingMdl.java

line 154 and 155 uncommented 

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* Update VerifyHistoryTest.java

line 168 uncommented 

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* Update KeyManagmentTest.java

uncommented the line number 181 assertTrue(sunbirdLoginPage.isSunbirdCardActive(), "Verify if download sunbird displayed active");

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* INJIMOB-3616 fixed the search issue for mock and MDL

Signed-off-by: Aswin <aswingopal30@gmail.com>

* INJIMOB-3616 fixed the search issue for mock and MDL

Signed-off-by: Aswin <aswingopal30@gmail.com>

* INJIMOB-3616 fixed the search issue for mock and MDL

Signed-off-by: Aswin <aswingopal30@gmail.com>

* INJIMOB-3616 fixed the search issue for mock and MDL

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

* INJIMOB-3616 fixed the search issue for mock and MDL

Removed the thread .sleep

Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>

---------

Signed-off-by: Aswin <aswingopal30@gmail.com>
Signed-off-by: gopalaswin <167510433+gopalaswin@users.noreply.github.com>
This commit is contained in:
gopalaswin
2025-11-17 11:29:38 +05:30
committed by GitHub
parent 6137fa8f51
commit 9898c2abfc
7 changed files with 90 additions and 23 deletions

View File

@@ -6,6 +6,7 @@ import inji.utils.InjiWalletConfigManager;
import io.appium.java_client.AppiumBy;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import org.apache.log4j.Logger;
import org.openqa.selenium.*;
import org.openqa.selenium.interactions.PointerInput;
import org.openqa.selenium.interactions.Sequence;
@@ -20,6 +21,7 @@ import java.util.List;
public class BasePage {
protected AppiumDriver driver;
protected WebDriverWait wait;
protected static final Logger logger = Logger.getLogger(BasePage.class);
private static final int DEFAULT_WAIT = Integer.parseInt(InjiWalletConfigManager.getproperty("element_wait_time"));
private static final int maxPageScrolls = Integer.parseInt(InjiWalletConfigManager.getproperty("max_pageScroll"));

View File

@@ -124,6 +124,10 @@ public class ESignetLoginPage extends BasePage {
//click(esignetLoginButton, "Click on Esignet login button");
}
public void clickOnLoginWithOtpButton() {
click(esignetLoginButton, "Click on Esignet login button");
}
public OtpVerificationPage setEnterIdTextBox(String uinOrVid) {
if ("iOS".equalsIgnoreCase(driver.getCapabilities().getCapability("platformName").toString())) {
click(enterIdTextBox, "Click on Enter ID textbox to enter UIN or VID"); // Needed for iOS before typing

View File

@@ -30,7 +30,7 @@ public class MockCertifyLoginPage extends BasePage {
private WebElement enterYourVidTextHeader;
@AndroidFindBy(uiAutomator = "UiSelector().className(\"android.widget.EditText\").instance(0)")
@iOSXCUITFindBy(className = "XCUIElementTypeTextField")
@iOSXCUITFindBy(xpath = "//XCUIElementTypeTextField[@value=\"Enter UIN/VID\"]")
private WebElement enterIdTextBox;
@AndroidFindBy(xpath = "//android.widget.Button[@text=\"Get OTP\"]")
@@ -62,6 +62,7 @@ public class MockCertifyLoginPage extends BasePage {
private WebElement settingUpTextOrDownloadingCredentials;
@AndroidFindBy(xpath = "//android.widget.TextView[@resource-id=\"error-banner-message\"]")
@iOSXCUITFindBy(accessibility = "OTP authentication failed. Please try again.")
private WebElement invalidOtpText;
@AndroidFindBy(uiAutomator = "UiSelector().className(\"android.widget.TextView\").instance(1)")
@@ -96,6 +97,14 @@ public class MockCertifyLoginPage extends BasePage {
@iOSXCUITFindBy(xpath = "//*[contains(@text,'CONTINUE')]")
private WebElement continuePopupButton;
@AndroidFindBy(accessibility = "tryAgain")
@iOSXCUITFindBy(accessibility = "tryAgain")
private WebElement retryButton;
@AndroidFindBy(xpath = "//*[@text=\"Network request failed\"]")
@iOSXCUITFindBy(accessibility = "getIdButton")
private WebElement networkErrorMesseage;
public MockCertifyLoginPage(AppiumDriver driver) {
super(driver);
@@ -127,6 +136,9 @@ public class MockCertifyLoginPage extends BasePage {
}
public OtpVerificationPage setEnterIdTextBox(String uinOrVid) {
if ("iOS".equalsIgnoreCase(driver.getCapabilities().getCapability("platformName").toString())) {
click(enterIdTextBox, "Click on Enter ID textbox to enter UIN or VID"); // Needed for iOS before typing
}
enterText(enterIdTextBox, uinOrVid, "Entering UIN or VID in the input textbox: " + uinOrVid);
return new OtpVerificationPage(driver);
}
@@ -140,12 +152,20 @@ public class MockCertifyLoginPage extends BasePage {
}
public void clickOnGetOtpButton() {
((HidesKeyboard) driver).hideKeyboard();
try {
((HidesKeyboard) driver).hideKeyboard();
} catch (Exception e) {
logger.info("Keyboard not hidden automatically, ignoring: " + e.getMessage());
}
click(getOtpButton, "Clicking on Get OTP button");
}
public void clickOnVerifyButton() {
((HidesKeyboard) driver).hideKeyboard();
try {
((HidesKeyboard) driver).hideKeyboard();
} catch (Exception e) {
logger.info("Keyboard not hidden automatically, ignoring: " + e.getMessage());
}
click(verifyButton, "Clicking on Verify button after hiding keyboard");
}
@@ -156,7 +176,6 @@ public class MockCertifyLoginPage extends BasePage {
public String getInvalidOtpMessage() {
return getText(invalidOtpText, "Fetching the error message for 'Invalid OTP'");
}
private static final Map<String, Map<String, String>> LANGUAGE_TEXT_MAP = new HashMap<>();
static {
@@ -213,4 +232,19 @@ public class MockCertifyLoginPage extends BasePage {
public String getInvalidIndividualIdMessage() {
return getText(invalidIndividualIdText, "Getting the error message for 'Invalid Individual ID'");
}
public boolean isNoInternetErrorDisplayed() {
return isElementVisible(networkErrorMesseage, "Checking if 'Network Request Failed' message is displayed");
}
public boolean isRetryButtonDisplayed() {
if (isElementVisible(retryButton, "Check if Retry button is displayed")) {
click(retryButton, "Click on Retry button");
return true;
}
return false;
}
public boolean isInvalidOtpErrorTextDisplay() {
return isElementVisible(invalidOtpText, "Checking if invalid otp error message is displayed");
}
}

View File

@@ -209,8 +209,8 @@ public abstract class BaseTest {
int failed = ExtentReportManager.getFailedCount();
int skipped = ExtentReportManager.getSkippedCount();
String newFileName = String.format("InjiMobileUi-%s-%s-T-%d_P-%d_S-%d_F-%d.html",
envName, timestamp, total, passed, skipped, failed);
String newFileName = String.format("InjiMobileUi-%s-%s-%s-T-%d_P-%d_S-%d_F-%d.html",
InjiWalletConfigManager.getproperty("browserstack_platformName"), envName, timestamp, total, passed, skipped, failed);
File originalReport = new File("test-output/ExtentReport.html");
File renamedReport = new File("test-output/" + newFileName);

View File

@@ -114,7 +114,8 @@ public class KeyManagmentTest extends IosBaseTest {
MockCertifyLoginPage mockCertifyLoginPage = addNewCardPage.clickOnDownloadViaMockCertify();
addNewCardPage.clickOnContinueButtonInSigninPopupIos();
// ESignetLoginPage esignetLoginPage = new ESignetLoginPage(getDriver());
ESignetLoginPage esignetLoginPage = new ESignetLoginPage(getDriver());
esignetLoginPage.clickOnLoginWithOtpButton();
// esignetLoginPage.clickOnEsignetLoginWithOtpButton();
OtpVerificationPage otpVerification = mockCertifyLoginPage.setEnterIdTextBox(getMockUIN());

View File

@@ -49,9 +49,10 @@ public class VcDownloadAndVerifyUsingMdl extends IosBaseTest {
addNewCardPage.clickOnContinueButtonInSigninPopupIos();
ESignetLoginPage esignetLoginPage = new ESignetLoginPage(getDriver());
esignetLoginPage.clickOnEsignetLoginWithOtpButton();
esignetLoginPage.clickOnLoginWithOtpButton();
// esignetLoginPage.clickOnEsignetLoginWithOtpButton();
Thread.sleep(9000);
OtpVerificationPage otpVerification = mockCertifyLoginPage.setEnterIdTextBox(getMockUIN());
mockCertifyLoginPage.clickOnGetOtpButton();
@@ -59,6 +60,8 @@ public class VcDownloadAndVerifyUsingMdl extends IosBaseTest {
otpVerification.enterOtpForeSignet(InjiWalletUtil.getOtp(), PlatformType.IOS);
mockCertifyLoginPage.clickOnVerifyButtonIos();
addNewCardPage.clickOnDoneButton();
assertTrue(homePage.isCredentialTypeValueDisplayed(), "Verify if credential type value is displayed");
DetailedVcViewPage detailedVcViewPage = homePage.openDetailedVcView();
@@ -113,7 +116,8 @@ public class VcDownloadAndVerifyUsingMdl extends IosBaseTest {
addNewCardPage.clickOnContinueButtonInSigninPopupIos();
ESignetLoginPage esignetLoginPage = new ESignetLoginPage(getDriver());
esignetLoginPage.clickOnEsignetLoginWithOtpButton();
esignetLoginPage.clickOnLoginWithOtpButton();
// esignetLoginPage.clickOnEsignetLoginWithOtpButton();
OtpVerificationPage otpVerification = mockCertifyLoginPage.setEnterIdTextBox("2185461749");
@@ -158,7 +162,8 @@ public class VcDownloadAndVerifyUsingMdl extends IosBaseTest {
addNewCardPage.clickOnContinueButtonInSigninPopupIos();
ESignetLoginPage esignetLoginPage = new ESignetLoginPage(getDriver());
esignetLoginPage.clickOnEsignetLoginWithOtpButton();
esignetLoginPage.clickOnLoginWithOtpButton();
// esignetLoginPage.clickOnEsignetLoginWithOtpButton();
OtpVerificationPage otpVerification = mockCertifyLoginPage.setEnterIdTextBox(getMockUIN());
@@ -167,7 +172,6 @@ public class VcDownloadAndVerifyUsingMdl extends IosBaseTest {
otpVerification.enterOtpForeSignet(TestDataReader.readData("invalidOtp"), PlatformType.IOS);
mockCertifyLoginPage.clickOnVerifyButtonIos();
assertEquals(ResourceBundleLoader.get(InjiWalletConstants.auth_failed), mockCertifyLoginPage.getInvalidOtpMessage());
}
@@ -206,9 +210,10 @@ public class VcDownloadAndVerifyUsingMdl extends IosBaseTest {
addNewCardPage.clickOnContinueButtonInSigninPopupIos();
ESignetLoginPage esignetLoginPage = new ESignetLoginPage(getDriver());
esignetLoginPage.clickOnEsignetLoginWithOtpButton();
esignetLoginPage.clickOnLoginWithOtpButton();
// esignetLoginPage.clickOnEsignetLoginWithOtpButton();
Thread.sleep(9000);
OtpVerificationPage otpVerification = mockCertifyLoginPage.setEnterIdTextBox(getMockUIN());
mockCertifyLoginPage.clickOnGetOtpButton();
@@ -216,6 +221,7 @@ public class VcDownloadAndVerifyUsingMdl extends IosBaseTest {
otpVerification.enterOtpForeSignet(InjiWalletUtil.getOtp(), PlatformType.IOS);
mockCertifyLoginPage.clickOnVerifyButtonIos();
addNewCardPage.clickOnDoneButton();
assertTrue(homePage.isCredentialTypeValueDisplayed(), "Verify if credential type value is displayed");
// assertTrue(homePage.isCredentialTypeValueDisplayed(), "Verify if credential type value is displayed");
@@ -266,9 +272,10 @@ public class VcDownloadAndVerifyUsingMdl extends IosBaseTest {
addNewCardPage.clickOnContinueButtonInSigninPopupIos();
ESignetLoginPage esignetLoginPage = new ESignetLoginPage(getDriver());
esignetLoginPage.clickOnEsignetLoginWithOtpButton();
esignetLoginPage.clickOnLoginWithOtpButton();
// esignetLoginPage.clickOnEsignetLoginWithOtpButton();
Thread.sleep(9000);
OtpVerificationPage otpVerification = mockCertifyLoginPage.setEnterIdTextBox(getMockUIN());
mockCertifyLoginPage.clickOnGetOtpButton();
@@ -276,14 +283,14 @@ public class VcDownloadAndVerifyUsingMdl extends IosBaseTest {
otpVerification.enterOtpForeSignet(InjiWalletUtil.getOtp(), PlatformType.IOS);
mockCertifyLoginPage.clickOnVerifyButtonIos();
addNewCardPage.clickOnDoneButton();
assertTrue(homePage.isCredentialTypeValueDisplayed(), "Verify if credential type value is displayed");
homePage.downloadCard();
addNewCardPage.clickOnDownloadViaMockCertify();
addNewCardPage.clickOnContinueButtonInSigninPopupIos();
esignetLoginPage.clickOnEsignetLoginWithOtpButton();
Thread.sleep(9000);
mockCertifyLoginPage.setEnterIdTextBox(getMockUIN());
mockCertifyLoginPage.clickOnGetOtpButton();

View File

@@ -509,7 +509,7 @@ public class VerifyHistoryTest extends IosBaseTest {
addNewCardPage.clickOnContinueButtonInSigninPopupIos();
ESignetLoginPage esignetLoginPage = new ESignetLoginPage(getDriver());
// esignetLoginPage.clickOnEsignetLoginWithOtpButton();
esignetLoginPage.clickOnLoginWithOtpButton();
OtpVerificationPage otpVerification = mockCertifyLoginPage.setEnterIdTextBox(getMockUIN());
@@ -518,9 +518,19 @@ public class VerifyHistoryTest extends IosBaseTest {
otpVerification.enterOtpForeSignet(InjiWalletUtil.getOtp(), PlatformType.IOS);
mockCertifyLoginPage.clickOnVerifyButtonIos();
addNewCardPage.clickOnDoneButton();
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();
assertEquals(homePage.verifyLanguageForNoVCDownloadedPageLoaded(), "Bring your digital identity");
HistoryPage historyPage = homePage.clickOnHistoryButton();
assertTrue(homePage.isCredentialTypeValueDisplayed(), "Verify if credential type value is displayed");
HistoryPage historyPage = homePage.clickOnHistoryButton();
assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed");
assertTrue(historyPage.verifyHistory(PlatformType.IOS));
@@ -564,8 +574,7 @@ public class VerifyHistoryTest extends IosBaseTest {
addNewCardPage.clickOnContinueButtonInSigninPopupIos();
ESignetLoginPage esignetLoginPage = new ESignetLoginPage(getDriver());
// esignetLoginPage.clickOnEsignetLoginWithOtpButton();
esignetLoginPage.clickOnLoginWithOtpButton();
OtpVerificationPage otpVerification = mockCertifyLoginPage.setEnterIdTextBox(getMockUIN());
mockCertifyLoginPage.clickOnGetOtpButton();
@@ -573,9 +582,19 @@ public class VerifyHistoryTest extends IosBaseTest {
otpVerification.enterOtpForeSignet(InjiWalletUtil.getOtp(), PlatformType.IOS);
mockCertifyLoginPage.clickOnVerifyButtonIos();
addNewCardPage.clickOnDoneButton();
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();
assertEquals(homePage.verifyLanguageForNoVCDownloadedPageLoaded(), "Bring your digital identity");
HistoryPage historyPage = homePage.clickOnHistoryButton();
assertTrue(homePage.isCredentialTypeValueDisplayed(), "Verify if credential type value is displayed");
HistoryPage historyPage = homePage.clickOnHistoryButton();
assertTrue(historyPage.isHistoryPageLoaded(), "Verify if history page is displayed");
assertTrue(historyPage.verifyHistoryForMock(PlatformType.IOS));