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

MOSIP-32267 updating automation script according to ui changes And adding testcases #1364

Merged
merged 25 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions injitest/src/main/java/inji/pages/BackupAndRestorePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ public class BackupAndRestorePage extends BasePage {
@AndroidFindBy(accessibility = "help")
private WebElement helpButton;

@AndroidFindBy(xpath = "//*[@resource-id=\"com.google.android.gms:id/account_display_name\"]")
private WebElement selectAccount;


public BackupAndRestorePage(AppiumDriver driver) {
super(driver);
Expand Down Expand Up @@ -302,6 +305,10 @@ public void clickOnHelpButton() {
clickOnElement(helpButton);
}

public void clickOnEmailHeader() {
clickOnElement(selectAccount);
}

public boolean isBackupFQADisplayed() throws InterruptedException {
Thread.sleep(5000);
String context= driver.getPageSource();
Expand Down
32 changes: 16 additions & 16 deletions injitest/src/main/java/inji/pages/DetailedVcViewPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,43 @@ public class DetailedVcViewPage extends BasePage{
@iOSXCUITFindBy(accessibility = "idDetailsHeader")
private WebElement detailedVcViewPageTitle;

@AndroidFindBy(accessibility = "fullNameValue")
@iOSXCUITFindBy(accessibility = "fullNameValue")
@AndroidFindBy(accessibility = "Full NameValue")
@iOSXCUITFindBy(accessibility = "Full NameValue")
private WebElement fullNameValue;

@AndroidFindBy(accessibility = "genderValue")
@iOSXCUITFindBy(accessibility = "genderValue")
@AndroidFindBy(accessibility = "GenderValue")
@iOSXCUITFindBy(accessibility = "GenderValue")
private WebElement genderValue;

@AndroidFindBy(accessibility = "dateOfBirthValue")
@iOSXCUITFindBy(accessibility = "dateOfBirthValue")
@AndroidFindBy(accessibility = "Date of BirthValue")
@iOSXCUITFindBy(accessibility = "Date of BirthValue")
private WebElement dateOfBirthValue;

@AndroidFindBy(accessibility = "nationalCard")
@iOSXCUITFindBy(accessibility = "nationalCard")
@AndroidFindBy(accessibility = "ID TypeValue")
@iOSXCUITFindBy(accessibility = "ID TypeValue")
private WebElement idTypeValue;

@AndroidFindBy(accessibility = "valid")
@iOSXCUITFindBy(accessibility = "valid")
private WebElement statusValue;

@AndroidFindBy(accessibility = "uinNumber")
@iOSXCUITFindBy(accessibility = "uinNumber")
@AndroidFindBy(accessibility = "UINValue")
@iOSXCUITFindBy(accessibility = "UINValue")
private WebElement uinNumberValue;

@AndroidFindBy(accessibility = "generatedOnValue")
@iOSXCUITFindBy(accessibility = "generatedOnValue")
private WebElement generatedOnValue;

@AndroidFindBy(accessibility = "phoneNumberValue")
@iOSXCUITFindBy(accessibility = "phoneNumberValue")
@AndroidFindBy(accessibility = "phoneValue")
@iOSXCUITFindBy(accessibility = "phoneValue")
private WebElement phoneNumberValue;

@AndroidFindBy(accessibility = "emailIdValue")
@iOSXCUITFindBy(accessibility = "emailIdValue")
@AndroidFindBy(accessibility = "EmailValue")
@iOSXCUITFindBy(accessibility = "EmailValue")
private WebElement emailIdValue;

@AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().description(\"enableVerification\"));")
@AndroidFindBy(accessibility = "enableVerification")
@iOSXCUITFindBy(accessibility = "enableVerification")
private WebElement activateButton;

Expand Down Expand Up @@ -145,7 +145,7 @@ public PleaseConfirmPopupPage clickOnActivateButtonAndroid(){
return new PleaseConfirmPopupPage(driver);
}

public PleaseConfirmPopupPage clickOnActivateButtonIos(){ //Scroll for ios need to be done
public PleaseConfirmPopupPage clickOnActivateButtonIos(){
IosUtil.scrollToElement(driver,58,712,160,129);
clickOnElement(activeButtonIos);
return new PleaseConfirmPopupPage(driver);
Expand Down
14 changes: 14 additions & 0 deletions injitest/src/main/java/inji/pages/GenerateUinOrVidPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public class GenerateUinOrVidPage extends BasePage {
@iOSXCUITFindBy(accessibility = "getIdButton")
private WebElement getUinOrVidButton;

@AndroidFindBy(xpath = "//*[@text=\"Network request failed\"]")
@iOSXCUITFindBy(accessibility = "getIdButton")
private WebElement networkErrorMesseage;



public GenerateUinOrVidPage(AppiumDriver driver) {
super(driver);
}
Expand All @@ -37,4 +43,12 @@ public OtpVerificationPage clickOnGetUinOrVidButton() {
return new OtpVerificationPage(driver);
}

public String getGenerateUinOrVidPageTextloaded() {
return this.getTextFromLocator(retrieveUinVidText);
}

public boolean isNetworkRequesFailedDisplayed() {
return this.isElementDisplayed(networkErrorMesseage);
}

}
14 changes: 8 additions & 6 deletions injitest/src/main/java/inji/pages/HistoryPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private boolean verifyHistoryIos(String vcNumber) {
}

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

Expand All @@ -50,17 +50,17 @@ private boolean verifyActivityHeaderAndroid(String vcNumber) {
}

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

private boolean verifyDeletedHistoryIos(String vcNumber) {
By locator = By.xpath("//*[contains(@name,'" + vcNumber + " Removed from wallet')]");
By locator = By.xpath("//*[contains(@name,'" + vcNumber + " is removed from wallet.')]");
return this.isElementDisplayed(locator);
}

private int verifyNumberOfRecordsInHistoryAndroid(String vcNumber) throws InterruptedException {
By locator = By.xpath("//*[contains(@text,'" + vcNumber + " downloaded')]");
By locator = By.xpath("//*[contains(@text,'" + vcNumber + " is downloaded.')]");
List<WebElement> elements = driver.findElements(locator);
return elements.size();
}
Expand Down Expand Up @@ -145,12 +145,14 @@ public boolean verifyActivationSuccessfulRecordInHistory(String vcNumber, Target
}

private boolean verifyActivationSuccessfulRecordIos(String vcNumber) {
By locator = By.xpath("//*[contains(@name,'" + vcNumber + " Activation successful')]");
By locator = By.xpath("//*[contains(@name,'Activation of National Card " + vcNumber + " is successful.')]");
return this.isElementDisplayed(locator);
}



private boolean verifyActivationSuccessfulRecordAndroid(String vcNumber) {
By locator = By.xpath("//*[contains(@text,'" + vcNumber + " Activation successful')]");
By locator = By.xpath("//*[contains(@text,'Activation of National Card " + vcNumber + " is successful.')]");
return this.isElementDisplayed(locator);
}
}
12 changes: 8 additions & 4 deletions injitest/src/main/java/inji/pages/HomePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public class HomePage extends BasePage {
@AndroidFindBy(accessibility = "share")
@iOSXCUITFindBy(accessibility = "share")
private WebElement shareButton;
@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.TextView\").instance(6);")// fix with accecibility

@AndroidFindBy(uiAutomator = "new UiSelector().className(\"android.widget.TextView\").instance(5)")// fix with accecibility
@iOSXCUITFindBy(accessibility = "share")
private WebElement shareButtonByForText;

Expand Down Expand Up @@ -105,8 +105,8 @@ public class HomePage extends BasePage {
@iOSXCUITFindBy(accessibility = "activatedVcPopupText")
private WebElement activatedVcPopupText;

@AndroidFindBy(accessibility = "fullNameTitle")
@iOSXCUITFindBy(accessibility = "fullNameTitle")
@AndroidFindBy(accessibility = "fullNameValue")
@iOSXCUITFindBy(accessibility = "fullNameValue")
private WebElement fullNameTitle;


Expand Down Expand Up @@ -280,4 +280,8 @@ public void clickPopupCloseButtonButton() {
clickOnElement(popupCloseButton);
}

public void clickOnHomeButton() {
clickOnElement(homeButton);
}

}
23 changes: 13 additions & 10 deletions injitest/src/main/java/inji/pages/MoreOptionsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,31 @@

public class MoreOptionsPage extends BasePage {

@AndroidFindBy(accessibility = "removeFromWallet")
@iOSXCUITFindBy(accessibility = "removeFromWallet")
// @AndroidFindBy(accessibility = "outlined-delete-icon")
// @iOSXCUITFindBy(accessibility = "removeFromWallet")
// private WebElement removeFromWalletButton;

@AndroidFindBy(uiAutomator = "new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().description(\"outlined-delete-icon\"))")
private WebElement removeFromWalletButton;

@AndroidFindBy(accessibility = "kebabTitle")
@iOSXCUITFindBy(accessibility = "kebabTitle")
private WebElement moreOptionsText;

@AndroidFindBy(accessibility = "viewActivityLog")
@iOSXCUITFindBy(accessibility = "viewActivityLog")
@AndroidFindBy(accessibility = "outlined-schedule-icon")
@iOSXCUITFindBy(accessibility = "outlined-schedule-icon")
private WebElement viewActivityLogButton;

@AndroidFindBy(accessibility = "pinOrUnPinCard")
@iOSXCUITFindBy(accessibility = "pinOrUnPinCard")
@AndroidFindBy(accessibility = "outlinedPinIcon")
@iOSXCUITFindBy(accessibility = "outlinedPinIcon")
private WebElement pinOrUnPinCardButton;

@AndroidFindBy(accessibility = "pendingActivationOrActivated")
@iOSXCUITFindBy(accessibility = "pendingActivationOrActivated")
@AndroidFindBy(accessibility = "outlined-shielded-icon")
@iOSXCUITFindBy(accessibility = "outlined-shielded-icon")
private WebElement activationPending;

@AndroidFindBy(accessibility = "profileAuthenticated")
@iOSXCUITFindBy(accessibility = "profileAuthenticated")
@AndroidFindBy(accessibility = "wallet-activated-icon")
@iOSXCUITFindBy(accessibility = "wallet-activated-icon")
private WebElement activatedForOnlineLoginButton;

@AndroidFindBy(accessibility = "close")
Expand Down
18 changes: 15 additions & 3 deletions injitest/src/main/java/inji/pages/OtpVerificationPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,18 @@ public class OtpVerificationPage extends BasePage {
@iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeStaticText[`label == \"VID not available in database\"`]")
private WebElement vidNotAvailableMessage;

@AndroidFindBy(xpath = "//android.view.ViewGroup[@resource-id=\"resendCodeView\"]") //Not using accessibility id as parent component has correct element property
@AndroidFindBy(xpath = "//*[@resource-id=\"resendCodeView\"]") //Not using accessibility id as parent component has correct element property
@iOSXCUITFindBy(accessibility = "resendCode")
private WebElement resendCodeButton;

@AndroidFindBy(accessibility = "wait")
@iOSXCUITFindBy(accessibility = "wait")
private WebElement waitPopupButton;

@AndroidFindBy(accessibility = "otpVerificationDescription")
@iOSXCUITFindBy(accessibility = "otpVerificationDescription")
private WebElement otpVerificationDescription;


public OtpVerificationPage(AppiumDriver driver) {
super(driver);
Expand Down Expand Up @@ -113,8 +117,13 @@ public boolean verifyResendCodeButtonDisplayedEnabled() {
}

public void clickOnResendButton() {
((HidesKeyboard) driver).hideKeyboard();
clickIfVisible(waitPopupButton);
// ((HidesKeyboard) driver).hideKeyboard();
// clickIfVisible(waitPopupButton);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
retrieClickOnElemet(resendCodeButton);
}

Expand All @@ -128,6 +137,9 @@ public void WatingTimeForVerificationTimerComplete() {

public boolean verifyOtpVerificationTimerDisplayedAfterClickOnResend() {
return this.isElementDisplayed(otpVerificationTimer);
}

public boolean verifyotpVerificationDescriptionDisplayed() {
return this.isElementDisplayed(otpVerificationDescription);
}
}
16 changes: 8 additions & 8 deletions injitest/src/main/java/inji/pages/SunbirdLoginPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public class SunbirdLoginPage extends BasePage {
@AndroidFindBy(xpath = "//*[contains(@text,'Login with KBA')]")
private WebElement loginWithKBA;

@AndroidFindBy(uiAutomator = "UiSelector().className(\"android.widget.EditText\").instance(0)")
@AndroidFindBy(xpath = "//android.widget.EditText[@resource-id=\"_form_policyNumber\"]")
@iOSXCUITFindBy(xpath = "//XCUIElementTypeTextField[@name=\"Please fill in this field\" and @value=\"Policy Number\"]")
private WebElement enterPolicyTextBox;

@AndroidFindBy(uiAutomator = "UiSelector().className(\"android.widget.EditText\").instance(1)")
@AndroidFindBy(xpath = "//android.widget.EditText[@resource-id=\"_form_fullName\"]")
@iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeTextField[`name == \"Please fill in this field\"`][2]")
private WebElement enterFullnameTextBox;

Expand Down Expand Up @@ -58,24 +58,24 @@ public class SunbirdLoginPage extends BasePage {
@iOSXCUITFindBy(accessibility = "Previous Month")
private WebElement previousMonth;

@AndroidFindBy(accessibility = "activated")
@iOSXCUITFindBy(accessibility = "activated")
@AndroidFindBy(accessibility = "wallet-activated-icon")
@iOSXCUITFindBy(accessibility = "wallet-activated-icon")
private WebElement activatedStatus;

@AndroidFindBy(accessibility = "a square logo of a Sunbird")
@iOSXCUITFindBy(accessibility = "a square logo of a Sunbird")
private WebElement sunbirdLogo;

@AndroidFindBy(accessibility = "NameValue")
@iOSXCUITFindBy(accessibility = "NameValue")
@AndroidFindBy(accessibility = "fullNameValue")
@iOSXCUITFindBy(accessibility = "fullNameValue")
private WebElement fullName;

@AndroidFindBy(accessibility = "Policy NameValue")
@iOSXCUITFindBy(accessibility = "Policy NameValue")
private WebElement policyName;

@AndroidFindBy(accessibility = "idTypeValue")
@iOSXCUITFindBy(accessibility = "idTypeValue")
@AndroidFindBy(accessibility = "ID TypeValue")
@iOSXCUITFindBy(accessibility = "ID TypeValue")
private WebElement idType;

@iOSXCUITFindBy(accessibility = "Continue")
Expand Down
Loading
Loading