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

https://mosip.atlassian.net/browse/MOSIP-30972 adding new testcases for android and ios #1145

Merged
merged 6 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion injitest/src/main/java/inji/driver/DriverManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static AppiumDriver getDriver(Target target, Boolean isDeviceFarmRun) thr
public static void startAppiumServer() {
PropertiesReader propertiesReader = new PropertiesReader();
String ipAddress = System.getProperty("ipAddress") != null ? System.getProperty("ipAddress") : propertiesReader.getIpAddress();
AppiumServiceBuilder builder = new AppiumServiceBuilder().withAppiumJS(new File(propertiesReader.getAppiumServerExecutable())).usingDriverExecutable(new File(propertiesReader.getNodePath())).withIPAddress(ipAddress).usingAnyFreePort().withArgument(GeneralServerFlag.LOCAL_TIMEZONE).withLogFile(new File(propertiesReader.getAppiumLogFilePath()));
AppiumServiceBuilder builder = new AppiumServiceBuilder().withAppiumJS(new File(propertiesReader.getAppiumServerExecutable())).usingDriverExecutable(new File(propertiesReader.getNodePath())).withIPAddress(ipAddress).usingAnyFreePort().withArgument(GeneralServerFlag.LOCAL_TIMEZONE).withArgument(() -> "--allow-insecure","chromedriver_autodownload").withLogFile(new File(propertiesReader.getAppiumLogFilePath()));
service = AppiumDriverLocalService.buildService(builder);
service.start();
}
Expand Down
29 changes: 29 additions & 0 deletions injitest/src/main/java/inji/pages/AboutInjiPage.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package inji.pages;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.iOSXCUITFindBy;

import java.util.Set;

import org.openqa.selenium.WebElement;

public class AboutInjiPage extends BasePage {
Expand All @@ -22,6 +25,13 @@ public class AboutInjiPage extends BasePage {
@AndroidFindBy(accessibility = "arrowLeft")
@iOSXCUITFindBy(accessibility = "arrowLeft")
private WebElement backButton;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Click here\")")
@iOSXCUITFindBy(accessibility = "Click here")
public WebElement clickHereButton;

@AndroidFindBy(accessibility = "Web View")
private WebElement WebView;

public AboutInjiPage(AppiumDriver driver) {
super(driver);
Expand All @@ -38,6 +48,21 @@ public boolean isAppIdCopiedTextDisplayed() {
public boolean isCopyTextDisplayed() {
return this.isElementDisplayed(copy);
}

public boolean isWebViewDisplayed() throws InterruptedException {
Thread.sleep(5000);
Set<String> contexts = ((AndroidDriver) driver).getContextHandles();
String actualUrl=null;
for (String context : contexts) {
if (context.contains("WEBVIEW"))
{
((AndroidDriver) driver).context(context);
actualUrl= driver.getCurrentUrl();
}
}
boolean result = (actualUrl.equalsIgnoreCase("https://docs.mosip.io/inji") == true) ? true : false;
return result;
}

public void clickOnCopyText() {
clickOnElement(copy);
Expand All @@ -46,4 +71,8 @@ public void clickOnCopyText() {
public void clickOnBackButton() {
clickOnElement(copy);
}

public void clickOnClickHereButton() {
clickOnElement(clickHereButton);
}
}
47 changes: 42 additions & 5 deletions injitest/src/main/java/inji/pages/AddNewCardPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.iOSXCUITFindBy;
import org.openqa.selenium.WebElement;
import org.testng.Assert;

public class AddNewCardPage extends BasePage{

@AndroidFindBy(accessibility = "issuersScreenHeader")
@AndroidFindBy(accessibility = "title")
@iOSXCUITFindBy(accessibility = "title")
private WebElement addNewCardHeader;

Expand All @@ -23,12 +24,15 @@ public class AddNewCardPage extends BasePage{
@iOSXCUITFindBy(accessibility = "issuerHeading-ESignet")
private WebElement downloadViaEsignet;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Please choose your preferred issuer from the options below to add a new card.\")")
@AndroidFindBy(xpath = "(//android.widget.TextView)[4]")
private WebElement addNewCardGuideMessage;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"Mangyaring piliin ang iyong gustong tagabigay mula sa mga opsyon sa ibaba upang magdagdag ng bagong card.\")")
private WebElement addNewCardGuideMessageInFillpino;

@AndroidFindBy(uiAutomator = "new UiSelector().textContains(\"नया कार्ड जोड़ने के लिए कृपया नीचे दिए गए विकल्पों में से अपना पसंदीदा जारीकर्ता चुनें।\")")
private WebElement addNewCardGuideMessageInHindi;

@AndroidFindBy(accessibility = "issuerDescription-Mosip")
@iOSXCUITFindBy(accessibility = "issuerDescription-Mosip")
private WebElement issuerDescriptionMosip;
Expand All @@ -44,6 +48,24 @@ public class AddNewCardPage extends BasePage{
public AddNewCardPage(AppiumDriver driver) {
super(driver);
}

public boolean verifyLanguageForAddNewCardGuideMessage(String language){
String actualText = addNewCardGuideMessage.getText();

switch (language) {
case "Hindi":
boolean isMessagePresentInHindi = (actualText.equals("नया कार्ड जोड़ने के लिए कृपया नीचे दिए गए विकल्पों में से अपना पसंदीदा जारीकर्ता चुनें।")==true) ? true : false;
return isMessagePresentInHindi ;
case "English":
boolean isMessagePresentInEnglish = (actualText.equals("Please choose your preferred issuer from the options below to add a new card.")==true) ? true : false;
return isMessagePresentInEnglish ;
case "Filipino":
boolean isMessagePresentInFilipino = (actualText.equals("Mangyaring piliin ang iyong gustong tagabigay mula sa mga opsyon sa ibaba upang magdagdag ng bagong card.")==true) ? true : false;
return isMessagePresentInFilipino ;
}
return false;
}


public boolean isAddNewCardPageLoaded() {
return this.isElementDisplayed(addNewCardHeader);
Expand All @@ -66,10 +88,18 @@ public boolean isDownloadViaUinDisplayed() {
return this.isElementDisplayed(downloadViaUin);
}

public boolean isDownloadViaUinDisplayedInHindi() {
return this.isElementDisplayed(downloadViaUin);
}

public boolean isDownloadViaEsignetDisplayed() {
return this.isElementDisplayed(downloadViaEsignet);
}

public boolean isDownloadViaEsignetDisplayedInHindi() {
return this.isElementDisplayed(downloadViaEsignet);
}

public boolean isDownloadViaEsignetDisplayedinFillpino() {
return this.isElementDisplayed(downloadViaEsignet);
}
Expand All @@ -87,6 +117,9 @@ public boolean isAddNewCardGuideMessageDisplayedInFillopin() {
return this.isElementDisplayed(addNewCardGuideMessageInFillpino);
}

public boolean isAddNewCardGuideMessageDisplayedInHindi() {
return this.isElementDisplayed(addNewCardGuideMessageInHindi);
}
public boolean isIssuerDescriptionMosipDisplayed() {
return this.isElementDisplayed(issuerDescriptionMosip);
}
Expand All @@ -103,9 +136,13 @@ public boolean isIssuerSearchBarDisplayedInFilipino() {
return this.isElementDisplayed(issuerSearchBar);
}

public void sendTextInIssuerSearchBar(String text) {
clearTextBoxAndSendKeys(issuerSearchBar,text);
public boolean isIssuerSearchBarDisplayedInHindi() {
return this.isElementDisplayed(issuerSearchBar);
}

public AddNewCardPage sendTextInIssuerSearchBar(String text) {
clearTextBoxAndSendKeys(issuerSearchBar, text);
return this;
}


}
18 changes: 14 additions & 4 deletions injitest/src/main/java/inji/pages/DetailedVcViewPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.iOSXCUITFindBy;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

public class DetailedVcViewPage extends BasePage {
public class DetailedVcViewPage extends BasePage{
@AndroidFindBy(accessibility = "idDetailsHeader")
@iOSXCUITFindBy(accessibility = "idDetailsHeader")
private WebElement detailedVcViewPageTitle;
Expand Down Expand Up @@ -46,10 +47,13 @@ public class DetailedVcViewPage extends BasePage {
@iOSXCUITFindBy(accessibility = "emailIdValue")
private WebElement emailIdValue;

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


@iOSXCUITFindBy(accessibility = "enableVerification")
private WebElement activeButtonIos;

@AndroidFindBy(accessibility = "profileAuthenticated")
@iOSXCUITFindBy(accessibility = "profileAuthenticated")
private WebElement profileAuthenticated;
Expand Down Expand Up @@ -130,10 +134,16 @@ public boolean isActivateButtonDisplayed() {
return this.isElementDisplayed(activateButton);
}

public PleaseConfirmPopupPage clickOnActivateButton() {
public PleaseConfirmPopupPage clickOnActivateButtonAndroid(){
clickOnElement(activateButton);
return new PleaseConfirmPopupPage(driver);
}

public PleaseConfirmPopupPage clickOnActivateButtonIos(){ //Scroll for ios need to be done
clickOnElement(activeButtonIos);
return new PleaseConfirmPopupPage(driver);

}

public boolean isProfileAuthenticatedDisplayed() {
return this.isElementDisplayed(profileAuthenticated);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,36 @@ public class HassleFreeAuthenticationPage extends BasePage {
public HassleFreeAuthenticationPage(AppiumDriver driver) {
super(driver);
}

public boolean isHassleFreeAuthenticationPageLoaded() {
return this.isElementDisplayed(hassleFreeAuthenticationText);
}

public boolean verifyLanguageforHassleFreeAuthenticationPageLoaded(String language){
String actualText = hassleFreeAuthenticationText.getText();

switch (language) {
case "English":
boolean isHederLoadedInEnglish = (actualText.equals("Hassle free authentication")==true) ? true : false;
return isHederLoadedInEnglish ;
case "Hindi":
boolean isHederLoadedInHindi = (actualText.equals("परेशानी मुक्त प्रमाणीकरण")==true) ? true : false;
return isHederLoadedInHindi ;
case "Filipino":
boolean isHederLoadedInFilipino = (actualText.equals("Walang problema sa pagpapatotoo")==true) ? true : false;
return isHederLoadedInFilipino ;
case "Tamil":
boolean isHederLoadedInTamil = (actualText.equals("தொந்தரவு இல்லாத அங்கீகாரம்")==true) ? true : false;
return isHederLoadedInTamil ;
case "Kannada":
boolean isHederLoadedInKannada = (actualText.equals("ಜಗಳ ಮುಕ್ತ ದೃಢೀಕರಣ")==true) ? true : false;
return isHederLoadedInKannada ;
}
return false;
}

public String getHassleFreeAuthenticationDescription() {
return this.getTextFromLocator(hassleFreeAuthenticationDescription);
}

public void clickOnGoBack() {
public HassleFreeAuthenticationPage clickOnGoBack() {
clickOnElement(goBackButton);
return this;
}
}
Loading