Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save frankcalise/80f5ebe292142dcc679d837fec1e5219 to your computer and use it in GitHub Desktop.
Save frankcalise/80f5ebe292142dcc679d837fec1e5219 to your computer and use it in GitHub Desktop.
Expo Android Appium setup from Aug 2021
import { remote } from "webdriverio";
jest.setTimeout(60000);
const appPackage = "host.exp.exponent";
const appActivity = `${appPackage}.experience.HomeActivity`;
const capabilities = {
platformName: "android",
deviceName: "89RX0E545", // Change to the name of the AVD you're using
automationName: "UiAutomator2",
appPackage,
appWaitActivity: appActivity,
appActivity,
appWaitForLaunch: true,
noSign: true,
newCommandTimeout: 180,
uiautomator2ServerInstallTimeout: 100000,
adbExecTimeout: 1000000,
skipLogcatCapture: true,
};
const options = {
services: ["appium"],
path: "/wd/hub/",
port: 4723,
};
async function launchExpoAndroid() {
const client = await remote({ ...options, capabilities });
await client.pause(3000);
await client.closeApp();
await client.startActivity(appPackage, appActivity); //Reload to force update
await client.execute("mobile:deepLink", {
url: "exp://127.0.0.1:19000",
package: appPackage,
});
return client;
}
describe("Example Test", () => {
let client;
beforeAll(async () => {
client = await launchExpoAndroid();
});
afterAll(async () => {
if (client) {
await client.deleteSession();
}
});
// Add tests here
test("Get Started opens Auth0 login", async () => {
await client.pause(2000);
const getStartedButton = await client.$("~SignInScreen.GetStarted");
await getStartedButton.click();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment