Created
August 12, 2020 20:55
-
-
Save colinfwren/d748340ef81365220ff38c5172df19a7 to your computer and use it in GitHub Desktop.
Launching the Expo Client on Android and loading the app under test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Its giving below error