Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage with Expo instructions #630

Merged
merged 8 commits into from
Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 10,7 @@ Gray box end-to-end testing and automation library for mobile apps.
- [About](#about)
- [Getting Started](/docs/Introduction.GettingStarted.md)
- [Documentation](/docs/README.md)
- [Usage with Expo](/docs/Guide.Expo.md)

<img src="http://i.imgur.com/eoaDEYp.gif">

Expand Down
45 changes: 45 additions & 0 deletions docs/Guide.Expo.md
Original file line number Diff line number Diff line change
@@ -0,0 1,45 @@
---
id: Guide.Expo
title: Expo
---

## Usage with Expo (iOS)

- Install `detox` and `detox-expo-helpers` (yarn or npm)
- Add `detox` configuration to [package.json](https://github.com/expo/with-detox-tests/blob/master/package.json#L21-L29):

```es6
"detox": {
"configurations": {
"ios.sim": {
"binaryPath": "bin/Exponent.app",
"type": "ios.simulator",
"name": "iPhone 7"
}
}
}
```

- Download the Expo app from [Expo.io/tools](https://expo.io/tools).
- Unzip the iOS IPA and **rename the folder** to `Exponent.app`. It'll have a file icon but will still be a folder.
- Create `bin` folder in your project and put `Exponent.app` inside so it matches the binaryPath you set above.
- Create an `e2e` and copy over the settings from [the example app](https://github.com/expo/with-detox-tests/tree/master/e2e)

The most important piece of this the `reloadApp` from `detox-expo-helpers`. Don't forget this.

```es6
const { reloadApp } = require('detox-expo-helpers');
// ...
beforeEach(async () => {
await reloadApp();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, is it possible at all to not have to reload the app in between every test? The setup/teardown process adds a fairly significant amount of time to test runs, but when I remove this beforeEach hook from my tests the tests get screwy, so I was wondering if this is just the way it is for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is just the way it has to be for now.

});
```

That's it! The rest of what you do should be similar to normal detox settings. If you have questions, [tweet @peterpme](https://twitter.com/peterpme)

## Usage with Expo (Android)

- We haven't personally tried getting this to work on Android. If you have, feel free to open up a PR!

### Example App
[expo/with-detox-tests](https://github.com/expo/with-detox-tests)