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

added detoxReuse option #45

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ See Detox's own [E2E test suite](detox/test/e2e) to learn the test API by exampl

See the [Flakiness](FLAKINESS.md) handbook

## Faster test runs with app reuse
By default the app is removed, reinstalled and launched before each run.
Starting fresh is critical in CI but in dev you might be able to save time between test runs and reuse the app that was previously installed in the simulator. To do so use the `detoxReuse` flag and run your tests like this:`mocha e2e --opts ./e2e/mocha.opts --detoxReuse`.
This is especially useful with React Native DEV mode when making Javascript code changes that are getting picked up by the packager (and thus no reinstall is needed). This can save up to 7 seconds per run!
You should not use this option if you made native code changes or if your app relies on local ("disk") storage.

## Some implementation details

* We let you write your e2e tests in JS (they can even be cross-platform)
Expand Down
7 changes: 6 additions & 1 deletion detox/src/ios/simulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,12 @@ function prepare(params, onComplete) {
onComplete(err2);
return;
}
deleteAndRelaunchApp(onComplete);
if ( _getArgValue('detoxReuse')) {
console.log('Reusing existing app')
relaunchApp(onComplete);
} else {
deleteAndRelaunchApp(onComplete);
}
});
});
} else {
Expand Down