Mobile Testing
4.3.1. Utilities for Mobile Testing
4.3.1.1. MobileDriverUtilities class to get AppiumDriver, captureScreenShort,…
1. driver = MobileDriverUtilities.getDriver(); // throw Exception and failed step if can get AppiumDriver
2. AppiumDriver driver = MobileDriverUtilities.getDriverQuietly(); // return null if can get AppiumDriver
4.3.1.2. MobileGestureUtilities class to simulate touch action
1. public void demo(UIObject target, int timeout){
2. AppiumDriver driver = MobileDriverUtilities.getDriver();
3. WebElement element = target.convertToWebElementWithTimeout(driver, timeout);
4. int xCenter = element.getLocation().getX() + element.getSize().getWidth() / 2;
5. int yCenter = element.getLocation().getY() + element.getSize().getHeight() / 2;
6. driver.perform(Arrays.asList(MobileGestureUtilities.createTapAction(xCenter, yCenter)));
7. }
4.3.2. MobileKeyword in a CustomKeyword
4.3.2.1. AppInteractKeyword
AkaAT Studio tool support methods to open app, get app status, close app.
1. public void demo(String appId){
2. AppInteractKeyword appInteractKeyword = new AppInteractKeyword();
3. appInteractKeyword.activeApp(appId); // to open app
4. appInteractKeyword.getAppState(appId); // to get app status
5. appInteractKeyword.terminateApp(appId); // to close app
6. }
4.3.2.2. DeviceActionKeyword
AkaAT Studio tool support multiple methods in DeviceActionKeyword class to interact with mobile device.