-
Notifications
You must be signed in to change notification settings - Fork 29
feature: add reload method to easily reset app state during tests #114
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
Conversation
| `--config=${jestConfigPath}`, | ||
| `--roots=${cwd}`, | ||
| '--runInBand', | ||
| `--globals='${JSON.stringify({ OWL_CLI_ARGS: args })}'`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the Owl config as a global variable, so that it can be accessed from the refresh method during the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also considering adding a __OWL__ or similar global here so that it can easily be used in the app to swap to using mock data etc during tests.
A good use case would be to show a Story Book type screen during Owl tests only, so that all components can be easily tested.
| import { adbInstall, adbLaunch } from '../utils/adb'; | ||
| import { | ||
| xcrunInstall, | ||
| xcrunLaunch, | ||
| xcrunRestore, | ||
| xcrunStatusBar, | ||
| xcrunUi, | ||
| } from '../utils/xcrun'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the separate build and run steps that use either ADB or xcrun have been refactored out into separate util functions. This is so that the same functions can be easily reused at other times, such as using xcrunLaunch or adbLaunch during testing as part of the reload method.
This PR adds a new
reloadmethod that terminates then relaunches the app, so that it's easier to split tests up into separate batches that each can start from a fresh app state.