Created
April 7, 2022 13:12
-
-
Save frankcalise/80f5ebe292142dcc679d837fec1e5219 to your computer and use it in GitHub Desktop.
Expo Android Appium setup from Aug 2021
This file contains 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"; | |
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