Skip to content

Instantly share code, notes, and snippets.

@colinfwren
Created August 12, 2020 20:55
Show Gist options
  • Save colinfwren/d748340ef81365220ff38c5172df19a7 to your computer and use it in GitHub Desktop.
Save colinfwren/d748340ef81365220ff38c5172df19a7 to your computer and use it in GitHub Desktop.
Launching the Expo Client on Android and loading the app under test
import {remote} from "webdriverio";
const capabilities = {
platformName: 'android',
deviceName: 'AVD_NAME', // Change to the name of the AVD you're using
automationName: 'UiAutomator2',
pkg: 'host.exp.exponent',
intentAction: 'android.intent.action.VIEW',
activity: 'host.exp.exponent.experience.HomeActivity',
appWaitForLaunch: true,
};
const options = {
path: '/wd/hub/',
port: 4723,
};
async function launchExpoAndroid() {
const client = await remote({ ...options, capabilities});
await client.closeApp();
await client.startActivity(androidCaps.pkg, androidCaps.activity,); //Reload to force update
await client.execute('mobile:deepLink', { url: 'exp://127.0.0.1:19000', package: androidCaps.pkg });
return client;
}
describe('Example Test', () => {
let client;
beforeAll(async () => {
client = await launchExpoAndroid();
});
afterAll(async () => {
await client.deleteSession();
});
// Add tests here
});
@gharatla
Copy link

Its giving below error

import error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment