This example works with Expo 42 and Detox 18.
- Install dependencies:
yarn install
- Download Expo App Binaries:
# this will download and place `Exponent.app` under `e2e/bin/`.
# if this doesn't work for you: - download them here: https://expo.dev/tools#client
# - place them into e2e/bin/
yarn downloadExpoApp
- Start Metro Bundler & Simulator:
yarn ios
- Run Test in seperate shell:
yarn test
jest-expo
is not used with this project, because it seem to have issues withjest-circus/runner
. That's why we're using vanillajest
detox-expo-helpers
is a fork (seepackage.json
)- The Expo SDK version of the binary you use must match that of the binary you download from their website. (click download ipa, maybe you can swap out version number via url)
- Android is completely removed from the tests as it's not really working right now
- The most important change is the
sleep
-function call infirstTest.e2e.js
:
describe("Example", () => {
beforeAll(async () => {
await reloadApp();
// sleep so app can boot
await sleep(4000);
});
beforeEach(async () => {});
- Alternatively, you could wait for the first element of your app (for example button on startscreen etc.), which is potentially faster:
describe('Example', () => {
beforeAll(async () => {
await reloadApp();
const welcomeMessage = element(by.id('welcome_message'));
await waitFor(welcomeMessage).toBeVisible().withTimeout(10000);
});
Note that this guide uses jest-expo
which doesn't work (anymore)
https://blog.expo.io/testing-expo-apps-with-detox-and-react-native-testing-library-7fbdbb82ac87
This issue is having similar problems, though the suggested change didn't help with Detox@18 expo/detox-tools#1 (comment)