https://github.com/software-mansion-labs/detox-your-graphql
Example app for E2E testing with Detox and Apollo GraphQL Server
https://github.com/software-mansion-labs/detox-your-graphql
Last synced: about 2 months ago
JSON representation
Example app for E2E testing with Detox and Apollo GraphQL Server
- Host: GitHub
- URL: https://github.com/software-mansion-labs/detox-your-graphql
- Owner: software-mansion-labs
- Created: 2018-11-23T16:20:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-05T15:22:53.000Z (over 6 years ago)
- Last Synced: 2025-04-11T02:13:48.535Z (about 2 months ago)
- Language: JavaScript
- Size: 204 KB
- Stars: 15
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example app for `Detox your GraphQL` article.
Article: https://blog.swmansion.com/detox-your-graphql-74b58dca3221
The purpose of this React Native app is to show how to create E2E testing environment, which won't be dependent on your backend server.
We use Detox for E2E tests and Apollo GraphQL server to create a mocked server.
# Requirements
React Native setup for iOS (not Expo!):
https://facebook.github.io/react-native/docs/getting-started.htmlDetox setup (Step 1):
https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.mdIf you don't have a Macbook, then you can try running the app on Android with a standalone mocked server. Detox support for Android is still a WIP.
# How to start
Install dependencies:
`yarn`
Run the app on iOS:
`react-native run-ios`
Start the mocked server (`server/index.js`):
`node server`
Build iOS simulator for Detox tests:
`detox build`
Run Detox tests (remember to turn off the standalone server):
`detox test`
# More info
All tests and GraphQL mocks are under `e2e` directory.
Standalone mocked GraphQL server is in `server/index.js`. You can specify mocks to use there, and then run the server to play with it on your simulator.
If you want to "see" Detox tests (it runs them in headless mode by default) then open your Simulator.app when it's running (Xcode -> Open Developer Tool -> Simulator).