Skip to content

Commit

Permalink
ci: move detox artifacts folder
Browse files Browse the repository at this point in the history
  • Loading branch information
WarleyLopes committed May 19, 2024
1 parent 4c1e8f2 commit 1f0d6ff
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: detox-artifacts
path: native-app/artifacts/
path: native-app/e2e/test-assets/artifacts/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ dist
.netlify

# detox artifacts
native-app/artifacts
**/artifacts/*

# snapshot artifact
native-app/components/__tests__/__snapshots__/**.snap
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This repository showcases mobile test automation for a React Native project usin
- [Unit Tests for Components - Jest](./native-app/components/__tests__/MachineScore.test.tsx)
- [Unit Tests for the API - Jest](./backend/__tests__/calculate.test.ts)
- [API Test Automation - Axios Request](./backend/__tests__/api.test.ts)
- [Detox Artifacts](./native-app/artifacts/)
- [Detox Artifacts](./native-app/e2e/test-assets/artifacts/)
- [Jest Test Coverage from Unit Tests - Mobile App](./native-app/coverage/lcov-report/index.html)
- [Jest Test Coverage from Unit Tests - API](./backend/coverage/lcov-report/index.html)
- [Mobile Components/UI Snapshots](./native-app/components/__tests__/__snapshots__/)
Expand All @@ -48,10 +48,15 @@ Make sure you have [nvm](https://github.com/nvm-sh/nvm?tab=readme-ov-file#instal
6. In a new terminal window, navigate to `./native-app/`
7. Run `nvm install`
8. Install dependencies: `yarn install`
9. Run the build with: `yarn detox:build`
10. Run the tests with: `yarn detox:test`
9. Run the build for iOS with: `yarn detox:build:ios`
10. Run the tests for iOS with: `yarn detox:test:ios`
11. For Android, make sure you have an android emulator in Android Studio named as `Pixel_3a_API_31_x86_64`
12. Make sure the android emulator is created with the API_31 and x86_64 architecture
13. Run the build for Android with: `yarn detox:build:android`
14. Run the tests for Android with: `yarn detox:test:android`

Artifacts for the run will be generated in case of any failing tests inside the [artifacts](./native-app/artifacts/) folder.

Artifacts for the run will be generated in case of any failing tests inside the [artifacts](./native-app/e2e/test-assets/artifacts/) folder.

## Mobile Components Unit Testing

Expand Down
9 changes: 9 additions & 0 deletions native-app/.detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,14 @@ module.exports = {
device: 'emulator',
app: 'android.debug'
}
},
artifacts: {
rootDir: 'e2e/test-assets/artifacts/',
plugins: {
screenshot: {
shouldTakeAutomaticSnapshots: true,
keepOnlyFailedTestsArtifacts: true
}
}
}
};
2 changes: 1 addition & 1 deletion native-app/e2e/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
[
'jest-junit',
{
outputDirectory: '<rootDir>/artifacts/reports/',
outputDirectory: '<rootDir>/e2e/test-assets/artifacts/reports/',
outputName: 'test_results.xml'
}
]
Expand Down

0 comments on commit 1f0d6ff

Please sign in to comment.