平台
Android setup
Get this machine ready to test an Expo, React Native or native Android app on an emulator with danwo.
danwo runs the same tests, invariants and fault matrix against an Android app on an emulator: an
Expo or React Native app, or a native one written with Jetpack Compose or Views. The app's calls go
through danwo's proxy, so Stripe and the rest are emulated there too. One package,
@danwo/mobile, builds your app so it trusts danwo, then runs it on a simulator or emulator. This
page gets the machine ready.
What you need
| Need | Why |
|---|---|
| Android Studio | it brings the Android SDK (adb, the emulator) and a JDK |
| a Google APIs system image | danwo needs root to trust its certificate; Play Store images can't be rooted |
| an AVD | the virtual device danwo boots |
Create the emulator
Install Android Studio
Install it, open it once, and let it download the SDK.
Add a Google APIs image
In Device Manager, create a device and pick a system image whose target says Google APIs,
not Google Play. On Apple silicon use arm64-v8a; on Intel and Linux, x86_64:
system-images;android-34;google_apis;arm64-v8aName the AVD
Give it a short name, such as danwo_spike. Your config refers to it by that name.
Add the mobile package
danwo init adds @danwo/mobile when tests drive Mobile or Web and mobile. To add it to a
project set up for the web, install it. It must be the same version as @danwo/cli, so name
that version if yours is not the latest:
npm install -D @danwo/mobileWithout it, the mobile commands stop and name that install:
danwo device doctor needs @danwo/mobile: npm install -D @danwo/[email protected]Check the machine
npx @danwo/cli device doctor --platform androidok Android SDK: ~/Library/Android/sdk
ok adb: ~/Library/Android/sdk/platform-tools/adb
ok emulator: ~/Library/Android/sdk/emulator/emulator
ok system images: rootable: system-images/android-34/google_apis/arm64-v8a
ok AVD danwo_spike: system-images/android-34/google_apis/arm64-v8a
ok JDK: /Applications/Android Studio.app/Contents/jbr/Contents/HomeEach line is ok, warn or a failure with what to do. It also warns about an emulator left with a
proxy setting from an earlier run, and about images missing their files.
In a project whose config calls withAndroidDevice, npx @danwo/cli doctor runs these checks too.
Apps that pin their TLS certificates ignore danwo's certificate, so their calls can't be emulated. Turn pinning off in the build you test.
What works on Android today
| Works | Not yet |
|---|---|
| Expo, React Native, Compose and Views apps | tests on a Flutter app, which only builds so far |
locators, expect, screenshots, the agent | hover, setInputFiles, dragTo |
| Custom Tabs (a web checkout inside the app) | reading mail from a test, saved sessions |
| the fault matrix, on one emulator or several | moving the device's own clock |
| time travel for your services and backend |