I am trying to get my android app that I am creating using the maven android plugin to run my integration tests automatically on Saucelabs with Appium. Everything that I have tried so far has only given me the error "Failed to download mobile app: c:\workspace\android\android-it..\android-app\target\android-app.apk"
I am using sauceconnect in my integration test pom file with the following configuration:
<plugins>
<plugin>
<groupId>com.saucelabs.maven.plugin</groupId>
<artifactId>sauce-connect-plugin</artifactId>
<version>1.0.15</version>
<configuration>
<sauceUsername>MY USERNAME</sauceUsername>
<sauceAccessKey>MY KEY</sauceAccessKey>
</configuration>
<executions>
<!-- Start Sauce Connect prior to running the integration tests -->
<execution>
<id>start-sauceconnct</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-sauceconnect</goal>
</goals>
</execution>
<!-- Stop the Sauce Connect process after the integration tests have finished -->
<execution>
<id>stop-sauceconnect</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-sauceconnect</goal>
</goals>
</execution>
</executions>
</plugin>
My configuration for my appium test is done in my setup method and looks like this:
@Before
public void setUp() throws Exception {
File classpathRoot = new File(System.getProperty("user.dir"));
File app = new File(classpathRoot, "../android-app/target/android-app.apk");
logger.info("PATH");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version", "1.0");
capabilities.setCapability("apk", "sauce-storage:my_app.apk");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "4.2");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("deviceType", "phone");
capabilities.setCapability("device","Android");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("app-package", "com.android-app");
capabilities.setCapability("app-activity", ".MainActivity");
capabilities.setCapability("takesScreenshot", true);
driver = new RemoteWebDriver(
new URL("http://user:key@ondemand.saucelabs.com:80/wd/hub"),
capabilities);
// driver = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
According to everything that I've read on Saucelabs and Appium, this should allow my apk to download correctly and run when I run a maven build, however, as stated above, this doesn't seem to be the case. If anyone can provide me with pointers toward what I am missing I would greatly appreciate it.