Skip to content

Instantly share code, notes, and snippets.

@leomenezessz
Last active March 9, 2018 14:20
Show Gist options
  • Save leomenezessz/ed2794de493e462dd1ea2b3ceb8c9008 to your computer and use it in GitHub Desktop.
Save leomenezessz/ed2794de493e462dd1ea2b3ceb8c9008 to your computer and use it in GitHub Desktop.
public class TestAndroidCalculator {
private static CalculatorScreen calculatorScreen;
private static AppiumDriver<MobileElement> appiumDriver;
@BeforeClass
public static void setup() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("app",new File("apps/app-android-calculator.apk"));
capabilities.setCapability("platformName","Android" );
capabilities.setCapability("deviceName","Android Emulator API 22");
capabilities.setCapability("unicodeKeyboard", true);
capabilities.setCapability("disableAndroidWatchers" , true);
appiumDriver = new AndroidDriver<MobileElement>(new URL("http://localhost:4723/wd/hub") , capabilities);
calculatorScreen = new CalculatorScreen(appiumDriver);
}
@Test
public void shouldSum() {
calculatorScreen.fillFirstNumber("10").fillSecondNumber("10").buttonSum.click();
assertTrue(calculatorScreen.operationResult().equals("20"));
}
@AfterClass
public static void teardown() {
calculatorScreen.quitDriver();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment