├── MobileAutomationFramework ├── ApiDemos-debug.apk ├── ExtentReports │ └── index.html ├── Screenshots │ └── Test scroll on API demo app │ │ ├── 1585380596492.png │ │ └── 1585380655930.png ├── pom.xml ├── src │ ├── main │ │ └── java │ │ │ └── com │ │ │ ├── constants │ │ │ └── Constants.java │ │ │ ├── driver │ │ │ ├── Driver.java │ │ │ └── DriverManager.java │ │ │ ├── listeners │ │ │ ├── AnnotationTransformer.java │ │ │ └── ListenerClass.java │ │ │ ├── pages │ │ │ ├── APIDemoHomePage.java │ │ │ ├── APIDemoViewsPage.java │ │ │ ├── BasePage.java │ │ │ ├── HamburgerPage.java │ │ │ ├── HomePage.java │ │ │ ├── LoginPage.java │ │ │ ├── ReceiveHBPage.java │ │ │ ├── ReceiveONHPage.java │ │ │ └── ReceivePage.java │ │ │ ├── reports │ │ │ ├── ExtentManager.java │ │ │ ├── ExtentReport.java │ │ │ └── LogStatus.java │ │ │ └── utils │ │ │ ├── DynamicXpath.java │ │ │ ├── JsonParser.java │ │ │ └── TestUtils.java │ └── test │ │ ├── java │ │ └── com │ │ │ └── testcases │ │ │ ├── APIDemosTest.java │ │ │ ├── BaseTest.java │ │ │ ├── LoginTests.java │ │ │ └── ReceivePageTests.java │ │ └── resources │ │ ├── chromedriver.exe │ │ ├── config.json │ │ ├── extentreport.xml │ │ └── testdata.xlsx ├── target │ ├── classes │ │ └── com │ │ │ ├── constants │ │ │ └── Constants.class │ │ │ ├── driver │ │ │ ├── Driver.class │ │ │ └── DriverManager.class │ │ │ ├── listeners │ │ │ ├── AnnotationTransformer.class │ │ │ └── ListenerClass.class │ │ │ ├── pages │ │ │ ├── APIDemoHomePage.class │ │ │ ├── BasePage.class │ │ │ ├── HamburgerPage.class │ │ │ ├── HomePage.class │ │ │ ├── LoginPage.class │ │ │ ├── ReceiveHBPage.class │ │ │ ├── ReceiveONHPage.class │ │ │ ├── ReceivePage.class │ │ │ └── ViewsPage.class │ │ │ ├── reports │ │ │ ├── ExtentManager.class │ │ │ ├── ExtentReport.class │ │ │ └── LogStatus.class │ │ │ └── utils │ │ │ ├── DynamicXpath.class │ │ │ ├── JsonParser.class │ │ │ └── TestUtils.class │ └── test-classes │ │ ├── chromedriver.exe │ │ ├── com │ │ └── testcases │ │ │ ├── APIDemosTest.class │ │ │ ├── BaseTest.class │ │ │ ├── LoginTests.class │ │ │ └── ReceivePageTests.class │ │ ├── config.json │ │ ├── extentreport.xml │ │ └── testdata.xlsx ├── test-output │ ├── Suite │ │ ├── Test.html │ │ ├── Test.xml │ │ └── testng-failed.xml │ ├── bullet_point.png │ ├── collapseall.gif │ ├── emailable-report.html │ ├── failed.png │ ├── index.html │ ├── jquery-1.7.1.min.js │ ├── junitreports │ │ ├── TEST-com.testcases.APIDemosTest.xml │ │ ├── TEST-com.testcases.LoginTests.xml │ │ └── TEST-com.testcases.ReceivePageTests.xml │ ├── navigator-bullet.png │ ├── old │ │ ├── Suite │ │ │ ├── Test.properties │ │ │ ├── classes.html │ │ │ ├── groups.html │ │ │ ├── index.html │ │ │ ├── main.html │ │ │ ├── methods-alphabetical.html │ │ │ ├── methods-not-run.html │ │ │ ├── methods.html │ │ │ ├── reporter-output.html │ │ │ ├── testng.xml.html │ │ │ └── toc.html │ │ └── index.html │ ├── passed.png │ ├── skipped.png │ ├── testng-failed.xml │ ├── testng-reports.css │ ├── testng-reports.js │ ├── testng-results.xml │ └── testng.css └── testng.xml └── README.md /MobileAutomationFramework/ApiDemos-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/ApiDemos-debug.apk -------------------------------------------------------------------------------- /MobileAutomationFramework/Screenshots/Test scroll on API demo app/1585380596492.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/Screenshots/Test scroll on API demo app/1585380596492.png -------------------------------------------------------------------------------- /MobileAutomationFramework/Screenshots/Test scroll on API demo app/1585380655930.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/Screenshots/Test scroll on API demo app/1585380655930.png -------------------------------------------------------------------------------- /MobileAutomationFramework/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | MobileAutomation 6 | MobileAutomationFramework 7 | 0.0.1-SNAPSHOT 8 | 9 | 10 | 11 | 12 | maven-compiler-plugin 13 | 3.3 14 | 15 | 1.8 16 | 1.8 17 | 18 | 19 | 20 | org.apache.maven.plugins 21 | maven-surefire-plugin 22 | 2.18.1 23 | 24 | 0 25 | 26 | testng.xml 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | UTF-8 35 | 1.6 36 | 1.6 37 | 38 | 39 | 40 | 41 | org.testng 42 | testng 43 | 6.14.3 44 | compile 45 | 46 | 47 | 48 | 49 | io.appium 50 | java-client 51 | 7.2.0 52 | 53 | 54 | 55 | 56 | org.seleniumhq.selenium 57 | selenium-java 58 | 3.141.59 59 | 60 | 61 | 62 | org.apache.directory.studio 63 | org.apache.commons.io 64 | 2.4 65 | 66 | 67 | 68 | 69 | org.apache.poi 70 | poi 71 | 3.16-beta2 72 | 73 | 74 | 75 | 76 | org.apache.poi 77 | poi-ooxml 78 | 3.9 79 | 80 | 81 | org.apache.poi 82 | poi-ooxml-schemas 83 | 3.9 84 | 85 | 86 | org.apache.poi 87 | poi-scratchpad 88 | 3.9 89 | 90 | 91 | org.apache.poi 92 | ooxml-schemas 93 | 1.1 94 | 95 | 96 | 97 | org.apache.poi 98 | openxml4j 99 | 1.0-beta 100 | 101 | 102 | org.apache.poi 103 | poi 104 | 3.9 105 | 106 | 107 | org.apache.poi 108 | poi-ooxml 109 | 3.9 110 | 111 | 112 | org.apache.poi 113 | poi-ooxml-schemas 114 | 3.9 115 | 116 | 117 | org.apache.poi 118 | poi-scratchpad 119 | 3.9 120 | 121 | 122 | org.apache.poi 123 | ooxml-schemas 124 | 1.1 125 | 126 | 127 | 128 | org.apache.poi 129 | openxml4j 130 | 1.0-beta 131 | 132 | 133 | 134 | org.apache.commons 135 | commons-email 136 | 1.5 137 | 138 | 139 | 140 | 141 | 142 | com.relevantcodes 143 | extentreports 144 | 2.41.2 145 | 146 | 147 | 148 | 149 | 150 | com.jayway.jsonpath 151 | json-path 152 | 2.4.0 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/constants/Constants.java: -------------------------------------------------------------------------------- 1 | package com.constants; 2 | 3 | public class Constants { 4 | 5 | public static final String EXTENTREPORTPATH=System.getProperty("user.dir")+"\\ExtentReports\\index.html"; 6 | public static final String JSONPATH=System.getProperty("user.dir")+"\\src\\test\\resources\\config.json"; 7 | public static final Integer IMPLICITWAIT=10; 8 | public static final Integer EXPLICITWAIT=15; 9 | public static final String SCREENSHOTPATH=System.getProperty("user.dir")+"\\Screenshots"; 10 | public static final String TESTDATAPATH=System.getProperty("user.dir")+"\\src\\test\\resources\\testdata.xlsx"; 11 | public static final String EXTENTCONFIGFILEPATH=System.getProperty("user.dir")+"\\src\\test\\resources\\extentreport.xml"; 12 | public static final String CHROMEDRIVERPATH = System.getProperty("user.dir")+"\\src\\test\\resources\\chromedriver.exe"; 13 | public static final String EXCELPATH=System.getProperty("user.dir")+"\\src\\test\\resources\\testdata.xlsx"; 14 | } 15 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/driver/Driver.java: -------------------------------------------------------------------------------- 1 | package com.driver; 2 | 3 | import java.io.IOException; 4 | import java.net.URL; 5 | import java.util.concurrent.TimeUnit; 6 | 7 | import org.openqa.selenium.Platform; 8 | import org.openqa.selenium.WebDriver; 9 | import org.openqa.selenium.WebDriverException; 10 | import org.openqa.selenium.chrome.ChromeDriver; 11 | import org.openqa.selenium.firefox.FirefoxDriver; 12 | import org.openqa.selenium.remote.DesiredCapabilities; 13 | 14 | import com.constants.Constants; 15 | import com.reports.LogStatus; 16 | import com.utils.JsonParser; 17 | 18 | import io.appium.java_client.AppiumDriver; 19 | import io.appium.java_client.MobileElement; 20 | import io.appium.java_client.android.AndroidDriver; 21 | import io.appium.java_client.ios.IOSDriver; 22 | import io.appium.java_client.remote.AndroidMobileCapabilityType; 23 | import io.appium.java_client.remote.MobileCapabilityType; 24 | 25 | 26 | 27 | /* 28 | * SingleTon Pattern 29 | * Make sure to update the test name in the excel 30 | */ 31 | public class Driver { 32 | 33 | public static AppiumDriver driver; 34 | public DesiredCapabilities capability; 35 | 36 | /* 37 | * nature can be android,ios,webandroid and webios. 38 | * Need to set this for each test case in the excel sheet (sheetname = TestData) 39 | */ 40 | private Driver(String nature,String devicename,String udid,int port) throws IOException { 41 | 42 | if(nature.equalsIgnoreCase("android")){ 43 | capability = new DesiredCapabilities(); 44 | capability.setCapability(MobileCapabilityType.UDID, udid); 45 | capability.setCapability(MobileCapabilityType.DEVICE_NAME, devicename); 46 | capability.setCapability(AndroidMobileCapabilityType.SYSTEM_PORT, port); 47 | capability.setCapability(MobileCapabilityType.AUTOMATION_NAME,"uiautomator2"); 48 | capability.setCapability(MobileCapabilityType.APP, System.getProperty("user.dir")+"\\ApiDemos-debug.apk"); 49 | //capability.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, JsonParser.getValue("config.global.apppackage")); 50 | //capability.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY,JsonParser.getValue("config.global.appactivity")); 51 | driver= new AndroidDriver(new URL(JsonParser.getValue("config.global.appiumurl")),capability); 52 | DriverManager.setIsAndroid(true); 53 | } 54 | else if(nature.equalsIgnoreCase("webandroid")) { 55 | capability = new DesiredCapabilities(); 56 | capability.setCapability(MobileCapabilityType.UDID, udid); 57 | capability.setCapability(MobileCapabilityType.DEVICE_NAME, devicename); 58 | capability.setCapability(AndroidMobileCapabilityType.SYSTEM_PORT, port); 59 | capability.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome"); 60 | capability.setCapability(MobileCapabilityType.DEVICE_NAME, "Android"); 61 | capability.setCapability(MobileCapabilityType.PLATFORM_NAME, Platform.ANDROID ); 62 | capability.setCapability(AndroidMobileCapabilityType.CHROMEDRIVER_EXECUTABLE, Constants.CHROMEDRIVERPATH); 63 | driver= new AndroidDriver(new URL(JsonParser.getValue("config.global.appiumurl")),capability); 64 | DriverManager.setIsAndroid(true); 65 | } 66 | else if(nature.equalsIgnoreCase("ios")) { 67 | 68 | capability.setCapability("platformName", "ios"); 69 | capability.setCapability("deviceName", devicename); 70 | capability.setCapability("bundleId",JsonParser.getValue("config.global.bundleid")); 71 | driver= new IOSDriver(new URL(JsonParser.getValue("config.global.appiumurl")),capability); 72 | DriverManager.setIsAndroid(false); 73 | } 74 | else if(nature.equalsIgnoreCase("webios")) { 75 | capability.setCapability("platformName", "ios"); 76 | capability.setCapability("deviceName", devicename); 77 | capability.setCapability("automationName", "Appium"); 78 | capability.setCapability("browserName", "Safari"); 79 | capability.setCapability(MobileCapabilityType.UDID, udid); 80 | driver= new IOSDriver(new URL(JsonParser.getValue("config.global.appiumurl")),capability); 81 | DriverManager.setIsAndroid(false); 82 | } 83 | else { 84 | LogStatus.fatal(("Please check your capabilities")); 85 | } 86 | driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); 87 | DriverManager.setAppiumDriver(driver); 88 | 89 | } 90 | 91 | 92 | 93 | public static void initialize(String nature,String devicename,String udid, int port) throws IOException { 94 | if(DriverManager.getDriver()==null) 95 | new Driver(nature,devicename,udid,port); 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/driver/DriverManager.java: -------------------------------------------------------------------------------- 1 | package com.driver; 2 | 3 | import io.appium.java_client.AppiumDriver; 4 | import io.appium.java_client.MobileElement; 5 | import io.appium.java_client.android.AndroidDriver; 6 | 7 | public class DriverManager { 8 | 9 | public static ThreadLocal> dr = new ThreadLocal>(); 10 | public static ThreadLocal isAndroid = new ThreadLocal(); 11 | 12 | public static AppiumDriver getDriver() { 13 | 14 | return dr.get(); 15 | 16 | } 17 | 18 | public static void setAppiumDriver(AppiumDriver driver) { 19 | 20 | dr.set(driver); 21 | } 22 | 23 | public static Boolean getIsAndroid() { 24 | 25 | return isAndroid.get(); 26 | 27 | } 28 | 29 | public static void setIsAndroid(Boolean value) { 30 | 31 | isAndroid.set(value); 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/listeners/AnnotationTransformer.java: -------------------------------------------------------------------------------- 1 | package com.listeners; 2 | 3 | import java.lang.reflect.Constructor; 4 | import java.lang.reflect.Method; 5 | 6 | import org.testng.IAnnotationTransformer; 7 | import org.testng.annotations.ITestAnnotation; 8 | 9 | import com.utils.TestUtils; 10 | 11 | public class AnnotationTransformer implements IAnnotationTransformer{ 12 | int count=0; 13 | 14 | @Override 15 | public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) { 16 | 17 | 18 | try { 19 | if(count==0) { 20 | TestUtils.getRunStatus(); 21 | } 22 | } catch (Exception e) { 23 | e.printStackTrace(); 24 | } 25 | 26 | for(int i=0;i0) { 143 | click(DriverManager.getDriver().findElement(by)); 144 | } 145 | } 146 | 147 | 148 | protected String getText(By by) { 149 | return getText(DriverManager.getDriver().findElement(by)); 150 | 151 | } 152 | 153 | protected String getText(MobileElement element) { 154 | explicitlyWait(element); 155 | String temp=element.getAttribute("text"); 156 | LogStatus.info("Text retrieved :"+temp); 157 | return temp; 158 | 159 | } 160 | 161 | 162 | protected void tap(WebElement webelement) { 163 | ta=new TouchAction(DriverManager.getDriver()); 164 | ta.tap(tapOptions().withElement(element(webelement))).perform(); 165 | } 166 | protected void longPress(WebElement webelement) { 167 | ta=new TouchAction(DriverManager.getDriver()); 168 | ta.longPress(longPressOptions().withElement(element(webelement)).withDuration(ofSeconds(4))).release().perform(); 169 | } 170 | 171 | protected void swipe(WebElement source,WebElement target) { 172 | ta=new TouchAction(DriverManager.getDriver()); 173 | ta.longPress(longPressOptions().withElement(element(source)).withDuration(ofSeconds(3))) 174 | .moveTo(element(target)).release().perform(); 175 | } 176 | /*protected void scollToSpecificElement(String text) { 177 | //driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"WebView\"))"); ---->hardcoding 178 | //---->Below one is dynamic 179 | DriverManager.getDriver().findElementByAndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textContains(\""+text+"\").instance(0))"); 180 | 181 | }*/ 182 | 183 | 184 | 185 | public void scrollToSpecificElementandClick(By by) 186 | { 187 | 188 | while(DriverManager.getDriver().findElements(by).size()==0) 189 | { 190 | Dimension dimensions = DriverManager.getDriver().manage().window().getSize(); 191 | Double screenHeightStart = dimensions.getHeight() * 0.5; 192 | int scrollStart = screenHeightStart.intValue(); 193 | Double screenHeightEnd = dimensions.getHeight() * 0.2; 194 | int scrollEnd = screenHeightEnd.intValue(); 195 | int center = (int) (dimensions.width*0.5); 196 | ta=new TouchAction(DriverManager.getDriver()); 197 | ta.press(PointOption.point(center,scrollStart)).waitAction(WaitOptions.waitOptions(Duration.ofMillis(500))). 198 | moveTo(PointOption.point(center,scrollEnd)).release().perform(); 199 | } 200 | 201 | if(DriverManager.getDriver().findElements(by).size()>0) 202 | { 203 | click(by); 204 | } 205 | } 206 | 207 | public void scrollToSpecificElementandClick(String locatorname,String androidlocatorvalue,String ioslocatorvalue) 208 | { 209 | if(DriverManager.getIsAndroid()) { 210 | if(locatorname.equalsIgnoreCase("xpath")) { 211 | scrollToSpecificElementandClick(By.xpath(androidlocatorvalue)); 212 | } 213 | } 214 | else { 215 | if(locatorname.equalsIgnoreCase("xpath")) { 216 | scrollToSpecificElementandClick(By.xpath(ioslocatorvalue)); 217 | } 218 | } 219 | 220 | } 221 | 222 | protected void dragAndDrop(WebElement source, WebElement target) { 223 | ta=new TouchAction(DriverManager.getDriver()); 224 | ta.longPress(longPressOptions().withElement(element(source))).moveTo(element(target)).release().perform(); 225 | 226 | } 227 | protected void clickElementOneUntilElementTwoAppears(By by1, By by2) { 228 | while(!DriverManager.getDriver().findElement(by2).isDisplayed()) { 229 | click(by1); 230 | } 231 | } 232 | 233 | protected void clickElementUntilElementDisAppears(By by) { 234 | boolean isElementPresent=false; 235 | int count=3; 236 | while((!isElementPresent) &&(count>0)) { 237 | 238 | try { 239 | click(by); 240 | count--; 241 | isElementPresent=!(DriverManager.getDriver().findElement(by).isDisplayed()); 242 | } 243 | catch(Exception e) { 244 | isElementPresent=true; 245 | } 246 | } 247 | } 248 | 249 | } 250 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/pages/HamburgerPage.java: -------------------------------------------------------------------------------- 1 | package com.pages; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | public class HamburgerPage extends BasePage { 6 | 7 | public static By btn_logout=By.xpath("//*[contains(@resource-id,'drawer_logout_button_inner')]"); 8 | 9 | public void clickLogout() { 10 | click(btn_logout); 11 | } 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/pages/HomePage.java: -------------------------------------------------------------------------------- 1 | package com.pages; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | public class HomePage extends BasePage { 6 | 7 | 8 | private static By btn_receive = By.xpath("//*[contains(@resource-id,'home_button_receive')]"); 9 | private static By btn_process = By.xpath("//*[contains(@resource-id,'home_button_process')]"); 10 | private static By btn_release = By.xpath("//*[contains(@resource-id,'home_button_release')]"); 11 | private static By btn_return = By.xpath("//*[contains(@resource-id,'home_button_return')]"); 12 | 13 | 14 | 15 | 16 | public HamburgerPage clickHamburger() { 17 | click(btn_hamburger); 18 | return new HamburgerPage(); 19 | } 20 | 21 | public ReceivePage clickReceive() { 22 | click(btn_receive); 23 | return new ReceivePage(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/pages/LoginPage.java: -------------------------------------------------------------------------------- 1 | package com.pages; 2 | 3 | import java.io.IOException; 4 | 5 | import org.openqa.selenium.By; 6 | import org.openqa.selenium.WebElement; 7 | 8 | import com.utils.JsonParser; 9 | 10 | 11 | public class LoginPage extends BasePage{ 12 | 13 | 14 | 15 | 16 | private static By lnk_allow=By.xpath("//*[@text='ALLOW']"); 17 | private static By txtbox_username=By.xpath("//*[contains(@resource-id,'login_username')]"); 18 | private static By txtbox_password=By.xpath("//*[contains(@resource-id,'login_password')]"); 19 | private static By btn_login=By.xpath("//*[contains(@resource-id,'login_button')]"); 20 | 21 | public HomePage loginToApplication() throws Exception { 22 | try { 23 | logoutIfNeeded(); 24 | } 25 | catch(Exception e) { 26 | 27 | } 28 | clickIfExists(lnk_allow); 29 | clickElementUntilElementDisAppears(btn_retry); 30 | sendKeys(txtbox_username, JsonParser.getValue("config.global.username")); 31 | sendKeys(txtbox_password,JsonParser.getValue("config.global.password")); 32 | click(btn_login); 33 | return new HomePage(); 34 | } 35 | 36 | 37 | 38 | private void logoutIfNeeded() { 39 | clickElementOneUntilElementTwoAppears(btn_backinmenubar, btn_hamburger); 40 | click(btn_hamburger); 41 | click(HamburgerPage.btn_logout); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/pages/ReceiveHBPage.java: -------------------------------------------------------------------------------- 1 | package com.pages; 2 | 3 | import java.util.Hashtable; 4 | 5 | import org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.GenericSignatureFormatException; 6 | import org.openqa.selenium.By; 7 | import org.testng.Assert; 8 | 9 | import com.driver.DriverManager; 10 | import com.utils.TestUtils; 11 | 12 | public class ReceiveHBPage extends ReceivePage{ 13 | 14 | protected static By txtbox_pieces =By.xpath("//*[contains(@resource-id,'receive_info_dimensions_pieces_layout')]//android.widget.EditText"); 15 | protected static By txtbox_length =By.xpath("//*[contains(@resource-id,'receive_info_dimensions_length_layout')]//android.widget.EditText"); 16 | 17 | protected static By txtbox_width =By.xpath("//*[contains(@resource-id,'receive_info_dimensions_width_layout')]//android.widget.EditText"); 18 | protected static By txtbox_height =By.xpath("//*[contains(@resource-id,'receive_info_dimensions_height_layout')]//android.widget.EditText"); 19 | protected static By txtbox_weight =By.xpath("//*[contains(@resource-id,'receive_info_dimensions_weight_line_layout')]//android.widget.EditText"); 20 | protected static By btn_set =By.xpath("//*[@text='SET']"); 21 | protected static By txtbox_hbnumber =By.xpath("//android.widget.EditText[contains(@resource-id,'receive_housebill_number')]"); 22 | protected static By btn_createonly =By.xpath("//*[@text='Create only']"); 23 | protected static By txtbox_consigneename =By.xpath("//*[contains(@resource-id,'receive_info_consignee')]"); 24 | protected static By errormsgwhenpiecesnotgiven =By.xpath("android.widget.TextView//[@text='Please provide piece count and packing type']"); 25 | protected static By successmsgforhbreceive =By.xpath("android.widget.TextView//[contains(@text,'FSI Housebill has been received.')]"); 26 | 27 | 28 | 29 | public void receiveHB() { 30 | 31 | sendKeys(txtbox_hbnumber, TestUtils.generateRandomHBnumber()); 32 | DriverManager.getDriver().hideKeyboard(); 33 | 34 | scrollToSpecificElementandClick(piecesrow); 35 | sendKeys(txtbox_pieces, TestUtils.generateRandomNumericString(2)); 36 | sendKeys(txtbox_length, TestUtils.generateRandomNumericString(2)); 37 | sendKeys(txtbox_width, TestUtils.generateRandomNumericString(2)); 38 | sendKeys(txtbox_height, TestUtils.generateRandomNumericString(2)); 39 | sendKeys(txtbox_weight, TestUtils.generateRandomNumericString(2)); 40 | click(btn_set); 41 | click(btn_send); 42 | click(btn_createonly); 43 | Assert.assertEquals(getText(successmsgforhbreceive), "FSI Housebill has been received"); 44 | } 45 | 46 | 47 | 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/pages/ReceiveONHPage.java: -------------------------------------------------------------------------------- 1 | package com.pages; 2 | 3 | public class ReceiveONHPage extends ReceivePage{ 4 | 5 | } 6 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/pages/ReceivePage.java: -------------------------------------------------------------------------------- 1 | package com.pages; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | public class ReceivePage extends BasePage { 6 | 7 | private static By btn_receivefsihb =By.xpath("//*[contains(@resource-id,'receive_fsi_hb_button')]"); 8 | private static By btn_receiveonhand =By.xpath("//*[contains(@resource-id,'receive_onhand_button')]"); 9 | private static By btn_receivelairtruck =By.xpath("//*[contains(@resource-id,'receive_lair_truck_button')]"); 10 | 11 | private static By btn_export =By.xpath("//*[contains(@resource-id,'receive_menu_export')]"); 12 | private static By btn_import =By.xpath("//*[contains(@resource-id,'receive_menu_tms_booking')]"); 13 | private static By btn_unknown =By.xpath("//*[contains(@resource-id,'receive_menu_import')]"); 14 | private static By btn_afrexportedibooking =By.xpath("//*[contains(@resource-id,'receive_menu_unknown')]"); 15 | private static By btn_close =By.xpath("//*[contains(@resource-id,'receive_menu_cancel')]"); 16 | 17 | 18 | protected static By piecesrow =By.xpath("//*[contains(@resource-id,'receive_info_dimensions_table')]"); 19 | protected static By btn_send =By.xpath("//*[contains(@resource-id,'receive_floating_menu')]/android.widget.ImageButton"); 20 | 21 | public ReceivePage clickReceiveFSIHB() { 22 | click(btn_receivefsihb); 23 | return this; 24 | } 25 | 26 | public ReceivePage clickReceiveOnhand() { 27 | click(btn_receiveonhand); 28 | return this; 29 | } 30 | 31 | public ReceivePage clickReceiveLAIRTruck() { 32 | click(btn_receivelairtruck); 33 | return this; 34 | } 35 | 36 | public ReceiveHBPage clickExportHB() { 37 | click(btn_export); 38 | return new ReceiveHBPage(); 39 | } 40 | public ReceiveHBPage clickImportHB() { 41 | click(btn_import); 42 | return new ReceiveHBPage(); 43 | } 44 | public ReceiveHBPage clickUnknownHB() { 45 | click(btn_unknown); 46 | return new ReceiveHBPage(); 47 | } 48 | public ReceiveHBPage clickAFRexportHB() { 49 | click(btn_afrexportedibooking); 50 | return new ReceiveHBPage(); 51 | } 52 | 53 | public ReceiveONHPage clickExportONH() { 54 | click(btn_export); 55 | return new ReceiveONHPage(); 56 | } 57 | public ReceiveONHPage clickImportONH() { 58 | click(btn_import); 59 | return new ReceiveONHPage(); 60 | } 61 | public ReceiveONHPage clickUnknownONH() { 62 | click(btn_unknown); 63 | return new ReceiveONHPage(); 64 | } 65 | 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/reports/ExtentManager.java: -------------------------------------------------------------------------------- 1 | package com.reports; 2 | 3 | import com.relevantcodes.extentreports.ExtentTest; 4 | 5 | public class ExtentManager { 6 | 7 | public static ThreadLocal exTest= new ThreadLocal(); 8 | 9 | 10 | public static ExtentTest getExtTest() { 11 | return exTest.get(); 12 | } 13 | 14 | public static void setExtentTest(ExtentTest test) { 15 | exTest.set(test); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/reports/ExtentReport.java: -------------------------------------------------------------------------------- 1 | package com.reports; 2 | 3 | import java.io.File; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | 7 | import com.constants.Constants; 8 | import com.relevantcodes.extentreports.ExtentReports; 9 | import com.relevantcodes.extentreports.ExtentTest; 10 | import com.relevantcodes.extentreports.LogStatus; 11 | 12 | 13 | public class ExtentReport { 14 | 15 | public static ExtentReports report=null; 16 | public static String extentreportpath=""; 17 | 18 | 19 | //To avoid external initialization 20 | private ExtentReport() { 21 | extentreportpath=Constants.EXTENTREPORTPATH; 22 | report=new ExtentReports(extentreportpath); 23 | report.loadConfig(new File(Constants.EXTENTCONFIGFILEPATH)); 24 | 25 | } 26 | 27 | public static void initialize() 28 | { 29 | if(report==null) 30 | new ExtentReport(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/reports/LogStatus.java: -------------------------------------------------------------------------------- 1 | package com.reports; 2 | 3 | import com.utils.TestUtils; 4 | 5 | public class LogStatus { 6 | 7 | private LogStatus() { 8 | //private to avoid initialization 9 | } 10 | public static void pass(String message) 11 | { 12 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.PASS, message); 13 | 14 | } 15 | 16 | public static void fail(String message) 17 | { 18 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.FAIL, message); 19 | } 20 | 21 | public static void fail(Exception message) 22 | { 23 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.FAIL, message); 24 | } 25 | 26 | public static void fail(AssertionError a) 27 | { 28 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.FAIL, a); 29 | } 30 | 31 | public static void info(String message) 32 | { 33 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.INFO, message); 34 | } 35 | 36 | public static void error(String message) 37 | { 38 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.ERROR, message); 39 | } 40 | 41 | public static void fatal(String message) 42 | { 43 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.FATAL, message); 44 | } 45 | 46 | public static void skip(String message) 47 | { 48 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.SKIP, message); 49 | } 50 | 51 | public static void unknown(String message) 52 | { 53 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.UNKNOWN, message); 54 | } 55 | 56 | public static void warning(String message) 57 | { 58 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.WARNING, message); 59 | } 60 | public static void pass(String string, String addScreenCapture) { 61 | 62 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.PASS, string,ExtentManager.getExtTest().addBase64ScreenShot("data:image/png;base64,"+TestUtils.getBase64Image(addScreenCapture))); 63 | 64 | } 65 | 66 | public static void fail(String string, String addScreenCapture) 67 | { 68 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.FAIL, string,ExtentManager.getExtTest().addBase64ScreenShot("data:image/png;base64,"+TestUtils.getBase64Image(addScreenCapture))); 69 | } 70 | 71 | public static void skip(String string, String addScreenCapture) 72 | { 73 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.SKIP, string,ExtentManager.getExtTest().addBase64ScreenShot("data:image/png;base64,"+TestUtils.getBase64Image(addScreenCapture))); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/utils/DynamicXpath.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | /* 4 | * It will be used to handle dynamic xpaths at run time 5 | */ 6 | public class DynamicXpath { 7 | 8 | public static String get(String xpath, String data) { 9 | 10 | String rawxpath = xpath.replaceAll("%replaceable%", data); 11 | return rawxpath; 12 | 13 | } 14 | 15 | public static String get(String xpath, String data1,String data2) { 16 | 17 | String rawxpath = xpath.replaceAll("%replaceable1%", data1).replaceAll("%replaceable2%", data2); 18 | return rawxpath; 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/utils/JsonParser.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.IOException; 6 | 7 | import com.constants.Constants; 8 | import com.jayway.jsonpath.JsonPath; 9 | 10 | 11 | public class JsonParser { 12 | private static File jsonFile; 13 | 14 | public static String getValue(String path) throws IOException { 15 | String temp = ""; 16 | try { 17 | jsonFile=new File(Constants.JSONPATH); 18 | temp=JsonPath.read(jsonFile,"$."+path); 19 | } 20 | catch(Exception e) { 21 | 22 | } 23 | return temp; 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/main/java/com/utils/TestUtils.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileNotFoundException; 6 | import java.io.FileOutputStream; 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.lang.reflect.Method; 10 | import java.security.SecureRandom; 11 | import java.text.DateFormat; 12 | import java.text.SimpleDateFormat; 13 | import java.util.ArrayList; 14 | import java.util.Base64; 15 | import java.util.Calendar; 16 | import java.util.HashMap; 17 | import java.util.Hashtable; 18 | 19 | import java.util.List; 20 | 21 | import java.util.Random; 22 | 23 | 24 | import javax.mail.Message; 25 | import javax.mail.PasswordAuthentication; 26 | import javax.mail.Session; 27 | import javax.mail.Transport; 28 | import javax.mail.internet.InternetAddress; 29 | import javax.mail.internet.MimeMessage; 30 | 31 | import org.apache.commons.io.FileUtils; 32 | import org.apache.commons.mail.DefaultAuthenticator; 33 | import org.apache.commons.mail.Email; 34 | import org.apache.commons.mail.EmailAttachment; 35 | import org.apache.commons.mail.EmailException; 36 | import org.apache.commons.mail.HtmlEmail; 37 | import org.apache.commons.mail.MultiPartEmail; 38 | import org.apache.commons.mail.SimpleEmail; 39 | import org.apache.poi.ss.usermodel.Cell; 40 | import org.apache.poi.ss.usermodel.Row; 41 | import org.apache.poi.util.ArrayUtil; 42 | import org.apache.poi.util.IOUtils; 43 | import org.apache.poi.xssf.usermodel.XSSFCell; 44 | import org.apache.poi.xssf.usermodel.XSSFSheet; 45 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; 46 | import org.openqa.selenium.JavascriptExecutor; 47 | import org.openqa.selenium.OutputType; 48 | import org.openqa.selenium.TakesScreenshot; 49 | import org.openqa.selenium.WebElement; 50 | import org.testng.ITestResult; 51 | import org.testng.annotations.DataProvider; 52 | 53 | import com.constants.Constants; 54 | import com.driver.DriverManager; 55 | import com.listeners.ListenerClass; 56 | 57 | 58 | 59 | 60 | 61 | 62 | /* 63 | * All the utilities needed for the framework is placed in this class including excel utilities, screenshot capture. 64 | * We have used method overloading concept in getCellContent Method. 65 | */ 66 | public class TestUtils { 67 | 68 | public static FileInputStream fs; 69 | public static XSSFWorkbook workbook; 70 | public static XSSFSheet sheet; 71 | public static List testCases= new ArrayList(); 72 | public static List runStatus= new ArrayList(); 73 | public static List testDescription= new ArrayList(); 74 | public static List invocationCount= new ArrayList(); 75 | public static List priority= new ArrayList(); 76 | public static HashMap rowAndTestCaseMap=new HashMap(); 77 | public static SecureRandom random= new SecureRandom(); 78 | 79 | public static void getRunStatus() throws Exception { 80 | try { 81 | fs=new FileInputStream(Constants.EXCELPATH); 82 | workbook=new XSSFWorkbook(fs); 83 | sheet=workbook.getSheet("RunManager"); 84 | for(int i=1;i<=getLastRowNum("RunManager");i++) { 85 | testCases.add(getCellContent("RunManager", i, "TestCaseName")); 86 | testDescription.add(getCellContent("RunManager", i, "Test Case Description")); 87 | runStatus.add(getCellContent("RunManager", i, "Execute")); 88 | invocationCount.add(getCellContent("RunManager", i, "InvocationCount")); 89 | priority.add(getCellContent("RunManager", i, "Priority")); 90 | } 91 | } 92 | catch(FileNotFoundException e) { 93 | e.printStackTrace(); 94 | } 95 | 96 | } 97 | 98 | /* 99 | * public static Object getRowNumForTestCase(String testcasename) { Object 100 | * a=null; for(Map.Entry m:rowAndTestCaseMap.entrySet()){ 101 | * if(m.getValue().toString().equalsIgnoreCase(testcasename)) { a= m.getKey(); } 102 | * } return a; } 103 | */ 104 | 105 | /* 106 | * Takes rowname and sheetname as parameter 107 | * return row number based of rowname 108 | */ 109 | public static int getRowNumForRowName(String sheetname,String rowName) { 110 | int rownum=0; 111 | sheet=workbook.getSheet(sheetname); 112 | for(int i=1;i<=getLastRowNum(sheetname);i++) { 113 | if(rowName.equalsIgnoreCase(sheet.getRow(i).getCell(0).getStringCellValue())) { 114 | rownum=i; 115 | break; 116 | } 117 | } 118 | 119 | return rownum; 120 | } 121 | 122 | /* 123 | * Takes columnname and sheetname as parameter 124 | * return column number based of columnheader 125 | */ 126 | 127 | public static int getColumnNumForColumnName(String sheetname, String columnname) { 128 | int colnum=0; 129 | sheet=workbook.getSheet(sheetname); 130 | for(int i=0;i rowscount=getNumberofIterationsForATestCase(sheetname, testcasename); 256 | Object[][] b=new Object[rowscount.size()][1]; 257 | Hashtable table =null; 258 | for(int i=1;i<=rowscount.size();i++) { 259 | table=new Hashtable(); 260 | for(int j=0;j getNumberofIterationsForATestCase(String sheetname,String testcasename) { 273 | ArrayList a=new ArrayList(); 274 | 275 | for(int i=1;i<=getLastRowNum(sheetname);i++) { 276 | if(testcasename.equalsIgnoreCase(getCellContent(sheetname, i, 0))) { 277 | a.add(i); 278 | } 279 | } 280 | 281 | return a; 282 | } 283 | 284 | 285 | public static void deleteFolder(File folder) { 286 | File[] files = folder.listFiles(); 287 | if(files!=null) { 288 | for(File f: files) { 289 | if(f.isDirectory()) { 290 | deleteFolder(f); 291 | } else { 292 | f.delete(); 293 | } 294 | } 295 | } 296 | 297 | } 298 | 299 | public static String generateRandomString(int length) { 300 | 301 | String text ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 302 | StringBuilder sb = new StringBuilder(length); 303 | for( int i = 0; i < length; i++ ) 304 | sb.append( text.charAt( random.nextInt(text.length()) ) ); 305 | return sb.toString(); 306 | 307 | } 308 | 309 | public static String generateRandomNumericString(int length) { 310 | String textnumber ="0123456789"; 311 | StringBuilder sb = new StringBuilder(length); 312 | for( int i = 0; i < length; i++ ) 313 | sb.append( textnumber.charAt( random.nextInt(textnumber.length()) ) ); 314 | return sb.toString(); 315 | 316 | } 317 | 318 | public static String generateRandomMasterBillNumber() { 319 | return generateRandomString(5)+generateRandomNumericString(2); 320 | } 321 | 322 | public static String generateRandomMasterFileNumber() { 323 | return generateRandomString(6)+generateRandomNumericString(3); 324 | } 325 | 326 | 327 | public static String generateRandomHBnumber() { 328 | return generateRandomString(5)+generateRandomNumericString(3); 329 | } 330 | 331 | public static String generateRandomHouseFilenumber() { 332 | return generateRandomString(8)+generateRandomNumericString(3); 333 | } 334 | 335 | 336 | 337 | 338 | 339 | 340 | } 341 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/test/java/com/testcases/APIDemosTest.java: -------------------------------------------------------------------------------- 1 | package com.testcases; 2 | 3 | import java.io.IOException; 4 | import java.util.Hashtable; 5 | 6 | import org.testng.annotations.Test; 7 | 8 | import com.driver.Driver; 9 | import com.pages.APIDemoHomePage; 10 | import com.pages.LoginPage; 11 | import com.pages.APIDemoViewsPage; 12 | 13 | public class APIDemosTest extends BaseTest{ 14 | 15 | //udid for the device can be obtained by adb devices command in the cmd 16 | //port can 8200 and 8201 if you want to run two tests in parallel 17 | //device name is mandatory but can be any name ie)My Test Device 18 | 19 | 20 | APIDemoHomePage hpage; 21 | APIDemoViewsPage viewpage; 22 | 23 | //validateTapAndScrolling 24 | @Test 25 | public void testAPIDemo(Hashtable data) throws NumberFormatException, IOException { 26 | Driver.initialize(data.get("nature"),data.get("deviceName"),data.get("udid"),Integer.parseInt(data.get("port"))); 27 | hpage= new APIDemoHomePage(); 28 | viewpage=hpage.clickview(); 29 | viewpage.clickMenu("Expandable Lists"); 30 | 31 | 32 | } 33 | 34 | @Test 35 | public void testAPIScroll(Hashtable data) throws NumberFormatException, IOException { 36 | Driver.initialize(data.get("nature"),data.get("deviceName"),data.get("udid"),Integer.parseInt(data.get("port"))); 37 | hpage= new APIDemoHomePage(); 38 | viewpage=hpage.clickview(); 39 | viewpage.scrollAndClickMenu("WebView"); 40 | 41 | 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/test/java/com/testcases/BaseTest.java: -------------------------------------------------------------------------------- 1 | package com.testcases; 2 | 3 | import java.awt.Desktop; 4 | import java.io.File; 5 | 6 | import org.testng.annotations.AfterMethod; 7 | import org.testng.annotations.AfterSuite; 8 | import org.testng.annotations.BeforeMethod; 9 | import org.testng.annotations.BeforeSuite; 10 | 11 | import com.constants.Constants; 12 | import com.driver.Driver; 13 | import com.driver.DriverManager; 14 | import com.reports.ExtentReport; 15 | import com.utils.TestUtils; 16 | 17 | 18 | /* 19 | * 20 | * Only APIDemosTest is valid for API demo app. Other tests are invalid 21 | * All test classes needs to extend BaseTest 22 | * 23 | */ 24 | public class BaseTest { 25 | 26 | 27 | @BeforeSuite 28 | public void beforeSuite() throws Exception { 29 | ExtentReport.initialize(); 30 | TestUtils.deleteFolder(new File(System.getProperty("user.dir")+"\\Screenshots")); 31 | 32 | } 33 | 34 | 35 | 36 | 37 | @AfterMethod 38 | public static void wrapUp() throws InterruptedException { 39 | Thread.sleep(10000); 40 | DriverManager.setAppiumDriver(null); 41 | 42 | } 43 | 44 | 45 | 46 | @AfterSuite 47 | public void afterSuite() throws Exception { 48 | 49 | ExtentReport.report.flush(); 50 | File htmlFile = new File(Constants.EXTENTREPORTPATH); 51 | Desktop.getDesktop().browse(htmlFile.toURI()); 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/test/java/com/testcases/LoginTests.java: -------------------------------------------------------------------------------- 1 | package com.testcases; 2 | 3 | import java.util.Hashtable; 4 | 5 | import org.testng.annotations.Test; 6 | 7 | import com.driver.Driver; 8 | import com.pages.HamburgerPage; 9 | import com.pages.HomePage; 10 | import com.pages.LoginPage; 11 | 12 | public class LoginTests extends BaseTest{ 13 | 14 | LoginPage loginpage; 15 | HomePage homepage; 16 | HamburgerPage hpage; 17 | 18 | @Test 19 | public void loginTest(Hashtable data) throws Exception { 20 | 21 | 22 | Driver.initialize(data.get("nature"),data.get("deviceName"),data.get("udid"),Integer.parseInt(data.get("port"))); 23 | 24 | loginpage= new LoginPage(); 25 | homepage=loginpage.loginToApplication(); 26 | hpage=homepage.clickHamburger(); 27 | hpage.clickLogout(); 28 | } 29 | 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/test/java/com/testcases/ReceivePageTests.java: -------------------------------------------------------------------------------- 1 | package com.testcases; 2 | 3 | import java.util.Hashtable; 4 | 5 | import org.testng.annotations.Test; 6 | 7 | import com.driver.Driver; 8 | import com.pages.HamburgerPage; 9 | import com.pages.HomePage; 10 | import com.pages.LoginPage; 11 | import com.pages.ReceiveHBPage; 12 | import com.pages.ReceivePage; 13 | 14 | public class ReceivePageTests extends BaseTest{ 15 | 16 | 17 | LoginPage loginpage; 18 | HomePage homepage; 19 | HamburgerPage hpage; 20 | ReceiveHBPage rhbpage; 21 | 22 | @Test 23 | public void receiveFSIHBTest(Hashtable data) throws Exception { 24 | Driver.initialize(data.get("nature"),data.get("deviceName"),data.get("udid"),Integer.parseInt(data.get("port"))); 25 | 26 | loginpage= new LoginPage(); 27 | homepage=loginpage.loginToApplication(); 28 | rhbpage=homepage.clickReceive().clickReceiveFSIHB().clickExportHB(); 29 | rhbpage.receiveHB(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/test/resources/chromedriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/src/test/resources/chromedriver.exe -------------------------------------------------------------------------------- /MobileAutomationFramework/src/test/resources/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": 3 | { 4 | "global": 5 | { 6 | "username" : "asakthiv", 7 | "password" : "1234" , 8 | "bundleid" : "", 9 | "apppackage":"com.dhl.fsi.android.dev", 10 | "appactivity":"com.dhl.fsi.android.activity.login.LoginActivity", 11 | "appiumurl": "http://127.0.0.1:4723/wd/hub" 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /MobileAutomationFramework/src/test/resources/extentreport.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | standard 7 | 8 | 9 | 10 | UTF-8 11 | 12 | 13 | 14 | https 15 | 16 | 17 | FSI Automation 18 | 19 | 20 | Results 21 | 22 | 23 | Automation Report 24 | 25 | 26 | 27 | yyyy-MM-dd 28 | 29 | 30 | 31 | HH:mm:ss 32 | 33 | 34 | 35 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /MobileAutomationFramework/src/test/resources/testdata.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/src/test/resources/testdata.xlsx -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/constants/Constants.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/constants/Constants.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/driver/Driver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/driver/Driver.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/driver/DriverManager.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/driver/DriverManager.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/listeners/AnnotationTransformer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/listeners/AnnotationTransformer.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/listeners/ListenerClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/listeners/ListenerClass.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/pages/APIDemoHomePage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/pages/APIDemoHomePage.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/pages/BasePage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/pages/BasePage.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/pages/HamburgerPage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/pages/HamburgerPage.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/pages/HomePage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/pages/HomePage.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/pages/LoginPage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/pages/LoginPage.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/pages/ReceiveHBPage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/pages/ReceiveHBPage.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/pages/ReceiveONHPage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/pages/ReceiveONHPage.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/pages/ReceivePage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/pages/ReceivePage.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/pages/ViewsPage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/pages/ViewsPage.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/reports/ExtentManager.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/reports/ExtentManager.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/reports/ExtentReport.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/reports/ExtentReport.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/reports/LogStatus.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/reports/LogStatus.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/utils/DynamicXpath.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/utils/DynamicXpath.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/utils/JsonParser.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/utils/JsonParser.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/classes/com/utils/TestUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/classes/com/utils/TestUtils.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/test-classes/chromedriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/test-classes/chromedriver.exe -------------------------------------------------------------------------------- /MobileAutomationFramework/target/test-classes/com/testcases/APIDemosTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/test-classes/com/testcases/APIDemosTest.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/test-classes/com/testcases/BaseTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/test-classes/com/testcases/BaseTest.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/test-classes/com/testcases/LoginTests.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/test-classes/com/testcases/LoginTests.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/test-classes/com/testcases/ReceivePageTests.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/test-classes/com/testcases/ReceivePageTests.class -------------------------------------------------------------------------------- /MobileAutomationFramework/target/test-classes/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": 3 | { 4 | "global": 5 | { 6 | "username" : "asakthiv", 7 | "password" : "1234" , 8 | "bundleid" : "", 9 | "apppackage":"com.dhl.fsi.android.dev", 10 | "appactivity":"com.dhl.fsi.android.activity.login.LoginActivity", 11 | "appiumurl": "http://127.0.0.1:4723/wd/hub" 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /MobileAutomationFramework/target/test-classes/extentreport.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | standard 7 | 8 | 9 | 10 | UTF-8 11 | 12 | 13 | 14 | https 15 | 16 | 17 | FSI Automation 18 | 19 | 20 | Results 21 | 22 | 23 | Automation Report 24 | 25 | 26 | 27 | yyyy-MM-dd 28 | 29 | 30 | 31 | HH:mm:ss 32 | 33 | 34 | 35 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /MobileAutomationFramework/target/test-classes/testdata.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/target/test-classes/testdata.xlsx -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/Suite/Test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestNG: Test 4 | 5 | 6 | 7 | 11 | 53 | 54 | 55 | 56 |

Test

57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
Tests passed/Failed/Skipped:1/0/0
Started on:Sat Mar 28 12:58:55 IST 2020
Total time:130 seconds (130875 ms)
Included groups:
Excluded groups:

69 | (Hover the method name to see the test class name)

70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 |
PASSED TESTS
Test methodExceptionTime (seconds)Instance
testAPIScroll
Test class: com.testcases.APIDemosTest
Test method: Test scroll on API demo app
Parameters: {width=, length=, port=8200, pieces=, udid=emulator-5554, nature=android, weight=, deviceName=Emulator, hbnumber=, TestCaseName=testAPIScroll, height=}
120com.testcases.APIDemosTest@1aa7ecca

83 | 84 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/Suite/Test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/Suite/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/bullet_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/test-output/bullet_point.png -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/collapseall.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/test-output/collapseall.gif -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/emailable-report.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TestNG Report 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
Test# Passed# Skipped# FailedTime (ms)Included GroupsExcluded Groups
Suite
Test100130,875
14 | 15 |
ClassMethodStartTime (ms)
Suite
Test — passed
com.testcases.APIDemosTesttestAPIScroll1585380535815120792
16 |

Test

com.testcases.APIDemosTest#testAPIScroll

Parameter #1
{width=, length=, port=8200, pieces=, udid=emulator-5554, nature=android, weight=, deviceName=Emulator, hbnumber=, TestCaseName=testAPIScroll, height=}

back to summary

17 | 18 | 19 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/test-output/failed.png -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | TestNG reports 7 | 8 | 9 | 10 | 11 | 12 | 18 | 21 | 22 | 23 | 24 |
25 | Test results 26 |
27 | 1 suite 28 |
29 | 117 |
118 |
119 |
120 |
121 |
122 | 123 | com.testcases.APIDemosTest 124 |
125 |
126 |
127 |
128 | 129 | 130 | testAPIScroll 131 | ({width=, length=, port=8200, pieces=, udid=emulator-5554, nature=android, weight=, deviceName=Emulator, hbnumber=, TestCaseName=testAPIScroll, height=}) 132 | 133 | (Test scroll on API demo app) 134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 | C:\Users\asakthiv\eclipse-workspace\MobileAutomationFramework\testng.xml 142 |
143 |
144 |
145 | <?xml version="1.0" encoding="UTF-8"?>
146 | <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
147 | <suite guice-stage="DEVELOPMENT" name="Suite">
148 |   <listeners>
149 |     <listener class-name="com.listeners.ListenerClass"/>
150 |     <listener class-name="com.listeners.AnnotationTransformer"/>
151 |   </listeners>
152 |   <test thread-count="1" name="Test" parallel="methods">
153 |     <classes>
154 |       <class name="com.testcases.LoginTests"/>
155 |       <class name="com.testcases.BaseTest"/>
156 |       <class name="com.testcases.ReceivePageTests"/>
157 |       <class name="com.testcases.APIDemosTest"/>
158 |     </classes>
159 |   </test> <!-- Test -->
160 | </suite> <!-- Suite -->
161 |             
162 |
163 |
164 |
165 |
166 | Tests for Suite 167 |
168 |
169 |
    170 |
  • 171 | Test (4 classes) 172 |
  • 173 |
174 |
175 |
176 |
177 |
178 | Groups for Suite 179 |
180 |
181 |
182 |
183 |
184 |
185 | Times for Suite 186 |
187 |
188 |
189 | 206 | Total running time: 2 minutes 207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 | Reporter output for Suite 215 |
216 |
217 |
218 |
219 |
220 |
221 | 9 ignored methods 222 |
223 |
224 |
225 | com.testcases.BaseTest 226 |
227 | beforeSuite 228 |
229 | afterSuite 230 |
231 |
232 |
233 |
234 | com.testcases.APIDemosTest 235 |
236 | beforeSuite 237 |
238 | testAPIDemo 239 |
240 | afterSuite 241 |
242 |
243 |
244 |
245 | com.testcases.LoginTests 246 |
247 | loginTest 248 |
249 |
250 |
251 |
252 | com.testcases.ReceivePageTests 253 |
254 | receiveFSIHBTest 255 |
256 | beforeSuite 257 |
258 | afterSuite 259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 | Methods in chronological order 267 |
268 |
269 |
270 |
com.testcases.LoginTests
271 |
272 | beforeSuite 273 | 0 ms 274 |
275 |
276 |
277 |
com.testcases.APIDemosTest
278 |
279 | testAPIScroll({width=, length=, port=8200, pieces=, udid=emulator-5554, nature=android, weight=, deviceName=Emulat...) 280 | 325 ms 281 |
282 |
283 | wrapUp 284 | 121126 ms 285 |
286 |
287 |
288 |
com.testcases.LoginTests
289 |
290 | afterSuite 291 | 131173 ms 292 |
293 |
294 |
295 |
296 |
297 | 298 | 299 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/junitreports/TEST-com.testcases.APIDemosTest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/junitreports/TEST-com.testcases.LoginTests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/junitreports/TEST-com.testcases.ReceivePageTests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | 66 | 67 | 68 | 69 | 77 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/navigator-bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/test-output/navigator-bullet.png -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/Suite/Test.properties: -------------------------------------------------------------------------------- 1 | [SuiteResult context=Test] -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/Suite/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
Class nameMethod nameGroups
com.testcases.APIDemosTest  
@Test
 testAPIDemo 
 testAPIScroll 
@BeforeClass
@BeforeMethod
@AfterMethod
 wrapUp 
@AfterClass
37 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/Suite/groups.html: -------------------------------------------------------------------------------- 1 |

Groups used for this test run

-------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/Suite/index.html: -------------------------------------------------------------------------------- 1 | Results for Suite 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/Suite/main.html: -------------------------------------------------------------------------------- 1 | Results for Suite 2 | Select a result on the left-hand pane. 3 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/Suite/methods-alphabetical.html: -------------------------------------------------------------------------------- 1 |

Methods run, sorted chronologically

>> means before, << means after


Suite

(Hover the method name to see the test class name)

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
TimeDelta (ms)Suite
configuration
Test
configuration
Class
configuration
Groups
configuration
Method
configuration
Test
method
ThreadInstances
20/03/28 13:01:06 0 <<afterSuite      main@29183965
20/03/28 12:58:55 -131163 >>beforeSuite      main@29183965
20/03/28 12:58:55 -130848      testAPIScrollTestNG-PoolService-0@1255595013
20/03/28 13:00:56 -10046     <<wrapUp  TestNG-PoolService-0@1255595013
13 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/Suite/methods-not-run.html: -------------------------------------------------------------------------------- 1 |

Methods that were not run

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
com.testcases.ReceivePageTests.receiveFSIHBTest
    To check whether the user can receive the export HB successfully
com.testcases.BaseTest.beforeSuite
com.testcases.BaseTest.beforeSuite
com.testcases.BaseTest.beforeSuite
com.testcases.LoginTests.loginTest
    To check whether the user can login to the application and logout successfully
com.testcases.APIDemosTest.testAPIDemo
    To verify whether the API demo test app
com.testcases.BaseTest.afterSuite
com.testcases.BaseTest.afterSuite
com.testcases.BaseTest.afterSuite
-------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/Suite/methods.html: -------------------------------------------------------------------------------- 1 |

Methods run, sorted chronologically

>> means before, << means after


Suite

(Hover the method name to see the test class name)

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
TimeDelta (ms)Suite
configuration
Test
configuration
Class
configuration
Groups
configuration
Method
configuration
Test
method
ThreadInstances
20/03/28 12:58:55 0 >>beforeSuite      main@29183965
20/03/28 12:58:55 315      testAPIScrollTestNG-PoolService-0@1255595013
20/03/28 13:00:56 121117     <<wrapUp  TestNG-PoolService-0@1255595013
20/03/28 13:01:06 131163 <<afterSuite      main@29183965
13 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/Suite/reporter-output.html: -------------------------------------------------------------------------------- 1 |

Reporter output

-------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/Suite/testng.xml.html: -------------------------------------------------------------------------------- 1 | testng.xml for Suite<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite guice-stage="DEVELOPMENT" name="Suite">
  <listeners>
    <listener class-name="com.listeners.ListenerClass"/>
    <listener class-name="com.listeners.AnnotationTransformer"/>
  </listeners>
  <test thread-count="1" name="Test" parallel="methods">
    <classes>
      <class name="com.testcases.LoginTests"/>
      <class name="com.testcases.BaseTest"/>
      <class name="com.testcases.ReceivePageTests"/>
      <class name="com.testcases.APIDemosTest"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->
-------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/Suite/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Results for Suite 4 | 5 | 6 | 7 | 8 |

Results for
Suite

9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 |
1 test1 class1 method:
14 |   chronological
15 |   alphabetical
16 |   not run (9)
0 groupreporter outputtestng.xml
23 | 24 |

29 |

25 |
Test (1/0/0) 26 | Results 27 |
28 |
30 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/old/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Test results

6 | 7 | 8 | 9 |
SuitePassedFailedSkippedtestng.xml
Total100 
Suite100Link
10 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/passed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/test-output/passed.png -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/skipped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MobileAutomationFramework/159e7cacc4bdfdcdec7d086c5b330cab5e3f8702/MobileAutomationFramework/test-output/skipped.png -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/testng-reports.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0px 0px 5px 5px; 3 | } 4 | 5 | ul { 6 | margin: 0px; 7 | } 8 | 9 | li { 10 | list-style-type: none; 11 | } 12 | 13 | a { 14 | text-decoration: none; 15 | } 16 | 17 | a:hover { 18 | text-decoration: underline; 19 | } 20 | 21 | .navigator-selected { 22 | background: #ffa500; 23 | } 24 | 25 | .wrapper { 26 | position: absolute; 27 | top: 60px; 28 | bottom: 0; 29 | left: 400px; 30 | right: 0; 31 | overflow: auto; 32 | } 33 | 34 | .navigator-root { 35 | position: absolute; 36 | top: 60px; 37 | bottom: 0; 38 | left: 0; 39 | width: 400px; 40 | overflow-y: auto; 41 | } 42 | 43 | .suite { 44 | margin: 0px 10px 10px 0px; 45 | background-color: #fff8dc; 46 | } 47 | 48 | .suite-name { 49 | padding-left: 10px; 50 | font-size: 25px; 51 | font-family: Times; 52 | } 53 | 54 | .main-panel-header { 55 | padding: 5px; 56 | background-color: #9FB4D9; //afeeee; 57 | font-family: monospace; 58 | font-size: 18px; 59 | } 60 | 61 | .main-panel-content { 62 | padding: 5px; 63 | margin-bottom: 10px; 64 | background-color: #DEE8FC; //d0ffff; 65 | } 66 | 67 | .rounded-window { 68 | border-radius: 10px; 69 | border-style: solid; 70 | border-width: 1px; 71 | } 72 | 73 | .rounded-window-top { 74 | border-top-right-radius: 10px 10px; 75 | border-top-left-radius: 10px 10px; 76 | border-style: solid; 77 | border-width: 1px; 78 | overflow: auto; 79 | } 80 | 81 | .light-rounded-window-top { 82 | border-top-right-radius: 10px 10px; 83 | border-top-left-radius: 10px 10px; 84 | } 85 | 86 | .rounded-window-bottom { 87 | border-style: solid; 88 | border-width: 0px 1px 1px 1px; 89 | border-bottom-right-radius: 10px 10px; 90 | border-bottom-left-radius: 10px 10px; 91 | overflow: auto; 92 | } 93 | 94 | .method-name { 95 | font-size: 12px; 96 | font-family: monospace; 97 | } 98 | 99 | .method-content { 100 | border-style: solid; 101 | border-width: 0px 0px 1px 0px; 102 | margin-bottom: 10; 103 | padding-bottom: 5px; 104 | width: 80%; 105 | } 106 | 107 | .parameters { 108 | font-size: 14px; 109 | font-family: monospace; 110 | } 111 | 112 | .stack-trace { 113 | white-space: pre; 114 | font-family: monospace; 115 | font-size: 12px; 116 | font-weight: bold; 117 | margin-top: 0px; 118 | margin-left: 20px; 119 | } 120 | 121 | .testng-xml { 122 | font-family: monospace; 123 | } 124 | 125 | .method-list-content { 126 | margin-left: 10px; 127 | } 128 | 129 | .navigator-suite-content { 130 | margin-left: 10px; 131 | font: 12px 'Lucida Grande'; 132 | } 133 | 134 | .suite-section-title { 135 | margin-top: 10px; 136 | width: 80%; 137 | border-style: solid; 138 | border-width: 1px 0px 0px 0px; 139 | font-family: Times; 140 | font-size: 18px; 141 | font-weight: bold; 142 | } 143 | 144 | .suite-section-content { 145 | list-style-image: url(bullet_point.png); 146 | } 147 | 148 | .top-banner-root { 149 | position: absolute; 150 | top: 0; 151 | height: 45px; 152 | left: 0; 153 | right: 0; 154 | padding: 5px; 155 | margin: 0px 0px 5px 0px; 156 | background-color: #0066ff; 157 | font-family: Times; 158 | color: #fff; 159 | text-align: center; 160 | } 161 | 162 | .top-banner-title-font { 163 | font-size: 25px; 164 | } 165 | 166 | .test-name { 167 | font-family: 'Lucida Grande'; 168 | font-size: 16px; 169 | } 170 | 171 | .suite-icon { 172 | padding: 5px; 173 | float: right; 174 | height: 20; 175 | } 176 | 177 | .test-group { 178 | font: 20px 'Lucida Grande'; 179 | margin: 5px 5px 10px 5px; 180 | border-width: 0px 0px 1px 0px; 181 | border-style: solid; 182 | padding: 5px; 183 | } 184 | 185 | .test-group-name { 186 | font-weight: bold; 187 | } 188 | 189 | .method-in-group { 190 | font-size: 16px; 191 | margin-left: 80px; 192 | } 193 | 194 | table.google-visualization-table-table { 195 | width: 100%; 196 | } 197 | 198 | .reporter-method-name { 199 | font-size: 14px; 200 | font-family: monospace; 201 | } 202 | 203 | .reporter-method-output-div { 204 | padding: 5px; 205 | margin: 0px 0px 5px 20px; 206 | font-size: 12px; 207 | font-family: monospace; 208 | border-width: 0px 0px 0px 1px; 209 | border-style: solid; 210 | } 211 | 212 | .ignored-class-div { 213 | font-size: 14px; 214 | font-family: monospace; 215 | } 216 | 217 | .ignored-methods-div { 218 | padding: 5px; 219 | margin: 0px 0px 5px 20px; 220 | font-size: 12px; 221 | font-family: monospace; 222 | border-width: 0px 0px 0px 1px; 223 | border-style: solid; 224 | } 225 | 226 | .border-failed { 227 | border-top-left-radius: 10px 10px; 228 | border-bottom-left-radius: 10px 10px; 229 | border-style: solid; 230 | border-width: 0px 0px 0px 10px; 231 | border-color: #f00; 232 | } 233 | 234 | .border-skipped { 235 | border-top-left-radius: 10px 10px; 236 | border-bottom-left-radius: 10px 10px; 237 | border-style: solid; 238 | border-width: 0px 0px 0px 10px; 239 | border-color: #edc600; 240 | } 241 | 242 | .border-passed { 243 | border-top-left-radius: 10px 10px; 244 | border-bottom-left-radius: 10px 10px; 245 | border-style: solid; 246 | border-width: 0px 0px 0px 10px; 247 | border-color: #19f52d; 248 | } 249 | 250 | .times-div { 251 | text-align: center; 252 | padding: 5px; 253 | } 254 | 255 | .suite-total-time { 256 | font: 16px 'Lucida Grande'; 257 | } 258 | 259 | .configuration-suite { 260 | margin-left: 20px; 261 | } 262 | 263 | .configuration-test { 264 | margin-left: 40px; 265 | } 266 | 267 | .configuration-class { 268 | margin-left: 60px; 269 | } 270 | 271 | .configuration-method { 272 | margin-left: 80px; 273 | } 274 | 275 | .test-method { 276 | margin-left: 100px; 277 | } 278 | 279 | .chronological-class { 280 | background-color: #0ccff; 281 | border-style: solid; 282 | border-width: 0px 0px 1px 1px; 283 | } 284 | 285 | .method-start { 286 | float: right; 287 | } 288 | 289 | .chronological-class-name { 290 | padding: 0px 0px 0px 5px; 291 | color: #008; 292 | } 293 | 294 | .after, .before, .test-method { 295 | font-family: monospace; 296 | font-size: 14px; 297 | } 298 | 299 | .navigator-suite-header { 300 | font-size: 22px; 301 | margin: 0px 10px 5px 0px; 302 | background-color: #deb887; 303 | text-align: center; 304 | } 305 | 306 | .collapse-all-icon { 307 | padding: 5px; 308 | float: right; 309 | } 310 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/testng-reports.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $('a.navigator-link').click(function() { 3 | // Extract the panel for this link 4 | var panel = getPanelName($(this)); 5 | 6 | // Mark this link as currently selected 7 | $('.navigator-link').parent().removeClass('navigator-selected'); 8 | $(this).parent().addClass('navigator-selected'); 9 | 10 | showPanel(panel); 11 | }); 12 | 13 | installMethodHandlers('failed'); 14 | installMethodHandlers('skipped'); 15 | installMethodHandlers('passed', true); // hide passed methods by default 16 | 17 | $('a.method').click(function() { 18 | showMethod($(this)); 19 | return false; 20 | }); 21 | 22 | // Hide all the panels and display the first one (do this last 23 | // to make sure the click() will invoke the listeners) 24 | $('.panel').hide(); 25 | $('.navigator-link').first().click(); 26 | 27 | // Collapse/expand the suites 28 | $('a.collapse-all-link').click(function() { 29 | var contents = $('.navigator-suite-content'); 30 | if (contents.css('display') == 'none') { 31 | contents.show(); 32 | } else { 33 | contents.hide(); 34 | } 35 | }); 36 | }); 37 | 38 | // The handlers that take care of showing/hiding the methods 39 | function installMethodHandlers(name, hide) { 40 | function getContent(t) { 41 | return $('.method-list-content.' + name + "." + t.attr('panel-name')); 42 | } 43 | 44 | function getHideLink(t, name) { 45 | var s = 'a.hide-methods.' + name + "." + t.attr('panel-name'); 46 | return $(s); 47 | } 48 | 49 | function getShowLink(t, name) { 50 | return $('a.show-methods.' + name + "." + t.attr('panel-name')); 51 | } 52 | 53 | function getMethodPanelClassSel(element, name) { 54 | var panelName = getPanelName(element); 55 | var sel = '.' + panelName + "-class-" + name; 56 | return $(sel); 57 | } 58 | 59 | $('a.hide-methods.' + name).click(function() { 60 | var w = getContent($(this)); 61 | w.hide(); 62 | getHideLink($(this), name).hide(); 63 | getShowLink($(this), name).show(); 64 | getMethodPanelClassSel($(this), name).hide(); 65 | }); 66 | 67 | $('a.show-methods.' + name).click(function() { 68 | var w = getContent($(this)); 69 | w.show(); 70 | getHideLink($(this), name).show(); 71 | getShowLink($(this), name).hide(); 72 | showPanel(getPanelName($(this))); 73 | getMethodPanelClassSel($(this), name).show(); 74 | }); 75 | 76 | if (hide) { 77 | $('a.hide-methods.' + name).click(); 78 | } else { 79 | $('a.show-methods.' + name).click(); 80 | } 81 | } 82 | 83 | function getHashForMethod(element) { 84 | return element.attr('hash-for-method'); 85 | } 86 | 87 | function getPanelName(element) { 88 | return element.attr('panel-name'); 89 | } 90 | 91 | function showPanel(panelName) { 92 | $('.panel').hide(); 93 | var panel = $('.panel[panel-name="' + panelName + '"]'); 94 | panel.show(); 95 | } 96 | 97 | function showMethod(element) { 98 | var hashTag = getHashForMethod(element); 99 | var panelName = getPanelName(element); 100 | showPanel(panelName); 101 | var current = document.location.href; 102 | var base = current.substring(0, current.indexOf('#')) 103 | document.location.href = base + '#' + hashTag; 104 | var newPosition = $(document).scrollTop() - 65; 105 | $(document).scrollTop(newPosition); 106 | } 107 | 108 | function drawTable() { 109 | for (var i = 0; i < suiteTableInitFunctions.length; i++) { 110 | window[suiteTableInitFunctions[i]](); 111 | } 112 | 113 | for (var k in window.suiteTableData) { 114 | var v = window.suiteTableData[k]; 115 | var div = v.tableDiv; 116 | var data = v.tableData 117 | var table = new google.visualization.Table(document.getElementById(div)); 118 | table.draw(data, { 119 | showRowNumber : false 120 | }); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/testng-results.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /MobileAutomationFramework/test-output/testng.css: -------------------------------------------------------------------------------- 1 | .invocation-failed, .test-failed { background-color: #DD0000; } 2 | .invocation-percent, .test-percent { background-color: #006600; } 3 | .invocation-passed, .test-passed { background-color: #00AA00; } 4 | .invocation-skipped, .test-skipped { background-color: #CCCC00; } 5 | 6 | .main-page { 7 | font-size: x-large; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /MobileAutomationFramework/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MobileAutomationFramework 2 | 3 | Test Driven Framework developed using Java with TestNG, Extent Reports. 4 | 5 | Can work on both android, ios including physical devices, emulators. 6 | 7 | How to use this framework? 8 | 9 | 1. Clone the repository to your workspace. 10 | 2. Open the testdata.xlsx under the src/test/resources folder 11 | 3. In the RunManager sheet -->Choose the test cases you want to run by choosing yes 12 | 4. In the testdata sheet --->Choose the test data you want to pass to the testcase from excel sheet. 13 | 5. The data from the excel sheet will be passed to the test method as a hashtable. 14 | 6. Run the testng.xml file. You can even run as mvn test which will trigger the testng.xml 15 | 16 | How the framework works? 17 | 18 | 1. AnnotationTransformer class which implements IAnnotationTransformer is reponsible for reading the data from RunManager sheet in testdata.xlsx 19 | It sets the annotation of the test methods like description,enabled, priority, dataprovider values read from the excel. 20 | 21 | Things to note : Test name in the first column of the excel sheet should match with atleast an @Test available in test classes mentioned in the testng.xml 22 | 23 | 2. All the tests will have the same dataprovider in the TestUtils class. For example the loginTest in RunManager sheet of testdata.xlsx will take the data from 24 | TestData sheet which have row where the testname is loginTest. If there are multiple rows with loginTest as test name , framework will consider it as 25 | this as multiple iterations for a test case. 26 | 27 | How to run on different mobile devices or emulators? 28 | 29 | 1. Type adb devices in the cmd(Make sure adb is installed and path set correctly) and update the values generated in the udid column of TestData sheet in testdata.xlsx 30 | 2. Device name can be anything but not null(Used to denote the device where you are running the test like MyS9Device) 31 | 3. Port is used for parallel execution. If there are two different ports used and testng threadcount is two ,then two tests will be run in parallel. 32 | 4. You can use more ports if you want to increase the parallel execution count. 33 | 34 | Other tips: 35 | 36 | 1. TestCase description given in the excel sheet will be displayed in the extent reports. 37 | 2. Reusable methods are placed in BasePage.java and can be utilised in your tests. 38 | 3. Data from excel sheet will be available as Hashtable parameter to your tests. You can fetch the value using data.get("columnnameinexcel") 39 | Refer the already existing tests for more details. 40 | 4. Make sure that your appium server is up and running before starting the tests. 41 | 42 | Please feel to report any issue or PR for any improvements. 43 | Reach me at mech.amuthansakthivel@gmail.com 44 | --------------------------------------------------------------------------------