-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add Jest unit tests and Detox end to end tests #415
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
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
48a9931
Tests are noisy, but are passing locally!
AndrewGable d18bf2f
Clean up workflow and job names for GitHub actions
AndrewGable 4db0827
Move tests and mocks into a tests/ folder, configure Jest to find it …
AndrewGable 16f9fb0
Continue to configure.. Tests are silent on my machine
AndrewGable 6b92a1f
Continue to explore unit tests
AndrewGable 0914a43
Start to add detox
AndrewGable fd79338
Merge branch 'master' into andrew-test
AndrewGable 7ee502c
Tweak configs
AndrewGable 08d384b
Continue config of detox
AndrewGable e54bd90
Add passing tests
AndrewGable 6c49e8d
Install xcpretty from gem
AndrewGable 276e2c7
Tweak sim used
AndrewGable 5b95625
Add more logs
AndrewGable b0432aa
Increase timeout
AndrewGable ca94b4a
Merge branch 'master' into andrew-test
AndrewGable 6e32bdf
Try to use release configs
AndrewGable daf8312
Debug -> Release
AndrewGable 9941403
Update detox to latest
AndrewGable de68055
Tweaking config a bit
AndrewGable 1e42322
Updating things, still not sure what is wrong
AndrewGable d59b3b2
Merge branch 'master' into andrew-test
AndrewGable 5b7fe44
Add more logs
AndrewGable 96c6af8
Add ssh key
AndrewGable a3eba2f
Fix lint
AndrewGable 80782ff
Try to mock libraries
AndrewGable 8c2454a
Remove mocks
AndrewGable fd4ae9e
Test not using config, will need to revert this
AndrewGable 00e66dc
add ssh key for npm install
AndrewGable 72400b4
Merge branch 'master' into andrew-test
AndrewGable 916174e
Jest tests passing locally
AndrewGable 34151bb
Fix lint
AndrewGable 89c57c3
Merge branch 'master' into andrew-test
AndrewGable 12ae6b3
Tweaking configs, names, and directories.
AndrewGable cdb8f5b
Fix lint
AndrewGable b5fd3f0
Remove hard coded config
AndrewGable 8819cb1
Use Xcode 11.5
AndrewGable e86066d
Merge branch 'master' into andrew-test
AndrewGable d42ef6e
Apply peer review changes
AndrewGable 618b789
Update readme and add two new scripts
AndrewGable 1efe05c
Merge branch 'master' into andrew-test
AndrewGable File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| name: automerge | ||
| name: Automerge PR | ||
|
|
||
| # This workflow is triggered by a pull request that is labeled | ||
| on: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: E2E iOS Tests | ||
|
|
||
| # Only run e2e tests on branches that aren't related to master and the deploy process | ||
| on: | ||
| push: | ||
| branches-ignore: | ||
| - 'master' | ||
| - 'version-bump-*' | ||
| tags-ignore: | ||
| - '*' | ||
|
|
||
| env: | ||
| DEVELOPER_DIR: /Applications/Xcode_11.5.app/Contents/Developer | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: macos-10.15 | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - uses: actions/setup-ruby@v1 | ||
|
|
||
| - name: Install bundler | ||
| run: gem install bundler | ||
|
|
||
| - name: Install gems | ||
| run: bundle install | ||
|
|
||
| - uses: webfactory/ssh-agent@v0.4.1 | ||
| with: | ||
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
|
|
||
| - name: Install node packages | ||
| run: npm install | ||
|
|
||
| - name: Install detox | ||
| run: npm install -g detox-cli | ||
|
|
||
| - name: Install cocoapods | ||
| run: cd ios && pod install --repo-update | ||
|
|
||
| - name: Install brew depdencies | ||
| run: | | ||
| brew tap wix/brew | ||
| brew install applesimutils | ||
|
|
||
| - name: Build tests | ||
| run: detox build --configuration ios.sim.release | ||
|
|
||
| - name: Run tests | ||
| run: detox test --configuration ios.sim.release --cleanup --debug-synchronization 200 --loglevel trace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| name: Jest Unit Tests | ||
|
|
||
| # Only run unit tests on branches that aren't related to master and the deploy process | ||
| on: | ||
| push: | ||
| branches-ignore: | ||
| - 'master' | ||
| - 'version-bump-*' | ||
| tags-ignore: | ||
| - '*' | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Use Node.js | ||
| uses: actions/setup-node@v1 | ||
| - uses: webfactory/ssh-agent@v0.4.1 | ||
| with: | ||
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
| - run: npm install | ||
| - run: npm run test | ||
| env: | ||
| CI: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ on: | |
| branches: [master] | ||
|
|
||
| jobs: | ||
| build: | ||
| version: | ||
| runs-on: ubuntu-16.04 | ||
|
|
||
| steps: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ source "https://rubygems.org" | |
|
|
||
| gem "fastlane" | ||
| gem "cocoapods" | ||
| gem "xcpretty" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| module.exports = { | ||
| testRunner: 'jest', | ||
| runnerConfig: 'tests/e2e/config.json', | ||
| configurations: { | ||
| 'ios.sim.debug': { | ||
| binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/Chat.app', | ||
| build: 'xcodebuild -workspace ios/ReactNativeChat.xcworkspace -scheme ReactNativeChat -configuration ' | ||
| + 'Debug -sdk iphonesimulator -derivedDataPath ios/build | xcpretty', | ||
| type: 'ios.simulator', | ||
| name: 'iPhone 11' | ||
| }, | ||
| 'ios.sim.release': { | ||
| binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/Chat.app', | ||
| build: 'xcodebuild -workspace ios/ReactNativeChat.xcworkspace -scheme ReactNativeChat -configuration ' | ||
| + 'Release -sdk iphonesimulator -derivedDataPath ios/build | xcpretty', | ||
| type: 'ios.simulator', | ||
| name: 'iPhone 11' | ||
| }, | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could you please add more info in this Readme about the difference between unit tests and e2e tests and when you would use one instead of the other and the benefits of either of them?
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.
Yes!