appium tips & inneractive integration
TRANSCRIPT
INNERACTIVEAPPIUM TIPS &
INNERACTIVE INTEGRATION
GAL AVIVVP R&D
THE BIG IDEA
Inneractive is a global independent mobile ad exchange focused on powering native and video ads
AT A GLANCE
630M
90EMPLOYEES
UNIQUE USERS
2007FOUNDED
NEW YORK
LONDON
SAN FRANCISCO
TEL AVIVBEIJING
70%OF REVENUE COMES FROM THE US
AD REQUESTSPROCESSED PER MINUTE
70%IN-APP SUPPLY
5MANDROIDUSERS
66%IPHONEUSERS
34%
5m/min 150 ms
$$$$$
WHAT WE DO?
GIL SHEPSAUTOMATION DEVELOPER
2010 - 2011 – QA Engineer at MobileMax
2011 – 2012 - QA Engineer at Tabtale
2012 – 2015 - QA Engineer at Inneractive
2016 – Today – Automation Developer at Inneractive
Proud Dad to Yahav.
Versatile modularity (cross products) Third party platform independency Stand-alone tool Java support Multi-platform No installation needed (third-party platform)
WHY?
Owner Platform Where When Limitations Phase & Scope Budget
GETTINGREADY
ALTERNATIVE WE CONSIDERED
Appthwack Appurify Saucelabs Local – Appium Perfecto Mobile Test Droid Device Anywhere
Server X not real time ? V X X X V
Client V ? X X V V V
Scripts Engine Cucamber, kalabash ? Appium Any language Appium Appium
GUI-based commands, Java API, other test framework
including HP UFT, IBM Rational, Selenium
Real \ Virtual device Real Real Virtual Cost per device Real Real Real
Notes Isn't suitable to server
Inability to communicate
They have beta program with real
devices
We'll have to manage the
server ourself and we don't want that
Cost per deviceno
manual testing sulotion
Could be another fee per used devices\time
Links https://appthwack.com/ http://appurify.com/ https://saucelabs.com/
http://appium.io/ http://www.perfectomobile.com/
http://testdroid.com/pricing
http://www.keynote.com/solutions/testing/mobile-testing
Owner - me Platform- Maven project using
Java using intellij Where - Sauce Labs / Perfecto Mobile When – Nightly / version release Limitations – Video / Unsupported
iOS elements
OUR PRACTICE
INNERACTIVE PLATFROM
MAVEN FAILSAFE SPRING INFRA
API
MOBILETESTS
SDK MOAT viewability tracking
Auto-redirect blocker
Accurate data extraction to enable better targeting
Backward compatibility with Android/iOS versions
Access to all relevant ad serving protocols (video and rich media)
Fully customizable native advertising settings
STORY video – innovative in-feed video with storytelling abilities
HOW APPIUM HELPS TEST INNERACTIVE PRODUCTS
Find and click on elements UI verification Native Event Listener
verification API verification Image recognition Webview verification
UI verification API verification Image recognition Webview verification E2E flow (client-server)
UI verification Webview verification
Mobile web
Appium is not enough Give identity to all elements Don’t use full path Use resetApp() after test Use one kind of timer
APPIUMTIPS
https://github.com/appium/appium/releases:// . / / -https github com appium java client
((JavascriptExecutor) driver).executeScript("return document.getElementById(’iaAD').height");((JavascriptExecutor) driver).executeScript("return document.getElementById(’iaAD'). width");
https://discuss.appium.io/t/is-javascriptexecutor-works-for-appium/3597
VERIFY WEBVIEW DIMENSIONS
* don’t forget to switch context
private String fileName = "/storage/emulated/legacy/config.txt";private String fileNameZero = "/storage/emulated/0/config.txt";@Overridepublic String readConfigFile() { byte[] data; try { logger.info("trying to read from " + fileName); data = appiumDriver.pullFile(fileName); } catch (Exception e) { try { logger.info("trying to read from " + fileNameZero); data = appiumDriver.pullFile(fileNameZero); } catch (Exception e1) { logger.info("trying to read from " + fileNameSuace); data = appiumDriver.pullFile(fileNameSuace); } } String logs = new String(data); logger.info(logs); return logs;}
PULLFILE()
((IOSDriver) appiumDriver).findElementByIosUIAutomation(asset).click();((AndroidDriver) appiumDriver).currentActivity().equals(SETTINGNATIVEACTIVITY))((AndroidDriver) appiumDriver).pressKeyCode(AndroidKeyCode.HOME);((AndroidDriver) appiumDriver).pressKeyCode(AndroidKeyCode.KEYCODE_BACK);((AndroidDriver) appiumDriver).pressKeyCode(AndroidKeyCode.KEYCODE_APP_SWITCH);
https://github.com/appium/appium-ios-driverhttps://github.com/appium/appium-android-driver
ANDROIDDRIVER & IOSDRIVER
private void tryToClickOnAssetWithIDOrXpath(String asset, String UIElemnt) { try { ((IOSDriver) appiumDriver).findElementByIosUIAutomation(asset).click(); } catch (NoSuchElementException e) { appiumDriver.findElement(By.xpath("//" + UIElemnt + "[@name='" + asset + "'")).click(); }}
http://testdroid.com/tech/appium-tip-18-how-to-use-xpath-locators-efficiently
FIND ELEMENT BY XPATH - IOS
appiumDriver.manage().timeouts().setScriptTimeout(long time,TimeUnit unit);appiumDriver.manage().timeouts(). pageLoadTimeout(long time,TimeUnit unit);appiumDriver.manage().timeouts().implicitlyWait(long time,TimeUnit unit);
public ClientUtils waitForInternalBrowserToLoaded(Long timoutSec) { changeToWebView(appiumDriver); appiumDriver.manage().timeouts().pageLoadTimeout(timoutSec, TimeUnit.SECONDS); changeToAppView(appiumDriver); return this;}
TIMEOUTS
ExpectedConditions.visibilityOfElementLocatedExpectedConditions.presenceOfElementLocatedExpectedConditions.urlContainsExpectedConditions.elementToBeClickable
:// . . / / / / / / / / / / .https seleniumhq github io selenium docs api java org openqa selenium support ui ExpectedConditions html
WEBDRIVERWAIT + EXPECTEDCONDITIONS
@Overridepublic ClientUtils waitForActivity(final String activityName , long timeount) { logger.info("waitForActivity Activity : " + activityName); WebDriverWait uiWait = new WebDriverWait(appiumDriver, MINDAPPIUMDRIVERTIMEOUT); uiWait.until(new Predicate<WebDriver>() { @Override public boolean apply(WebDriver input) { if (((AndroidDriver) appiumDriver).currentActivity().equals(activityName)) { return true; } return false; } }); return this;}
DEMORUNNING TESTS ON PERFECTO MOBILE