-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(Detox): repair e2e testing library
- Loading branch information
igroza
committed
Jan 29, 2025
1 parent
02742cb
commit a4738dc
Showing
91 changed files
with
1,123 additions
and
483 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,102 @@ | ||
# Testing HAQQ Wallet with Detox | ||
|
||
## Setup | ||
|
||
Install `detox-cli` globally to easily run Detox commands from the command line: | ||
|
||
```sh | ||
yarn global add detox-cli | ||
``` | ||
|
||
This tool is required by Detox to work with iOS simulators. | ||
|
||
```sh | ||
brew tap wix/brew | ||
brew install applesimutils | ||
``` | ||
|
||
## Start testing | ||
|
||
> [!IMPORTANT] | ||
> Never set `JEST_WORKER_ID` while using Detox, as it crashes react-native-reanimated. | ||
|
||
### Development Environment | ||
|
||
To run Detox tests in the development environment, use the following commands: | ||
|
||
#### Using dev helper script | ||
|
||
- **Show help message** | ||
```sh | ||
yarn detox:test:dev --help | ||
``` | ||
|
||
Description: | ||
This script is used to start the Metro server and run Detox end-to-end tests. | ||
|
||
Usage: | ||
```sh | ||
yarn detox:test:dev [--ios|--android] [testFileNumber] | ||
``` | ||
|
||
Options: | ||
- `[--ios|--android]`: (Optional) Run the tests on the iOS/Android simulator. | ||
- `testFileNumber`: (Optional) The prefix number of the test file to run. | ||
|
||
Examples: | ||
```sh | ||
yarn detox:test:dev | ||
yarn detox:test:dev --ios | ||
yarn detox:test:dev --android 2 | ||
``` | ||
|
||
#### Manually | ||
|
||
Before starting dev tests, you should run the Metro bundler with the `FOR_DETOX=true` environment variable: | ||
|
||
```sh | ||
FOR_DETOX=true npx react-native start --reset-cache | ||
``` | ||
|
||
- **Build and run Android tests:** | ||
```sh | ||
yarn detox:android:build:dev | ||
yarn detox:android:test:dev | ||
``` | ||
|
||
- **Build and run iOS tests:** | ||
```sh | ||
yarn detox:ios:build:dev | ||
yarn detox:ios:test:dev | ||
``` | ||
|
||
### Release Environment | ||
|
||
Before starting testing, set `FOR_DETOX=true` in your `.env` file. | ||
|
||
To run Detox tests in the release environment, use the following commands: | ||
|
||
- **Build and run Android tests:** | ||
```sh | ||
yarn detox:android:build | ||
yarn detox:android:test | ||
``` | ||
|
||
- **Build and run iOS tests:** | ||
```sh | ||
yarn detox:ios:build | ||
yarn detox:ios:test | ||
``` | ||
|
||
### Combined Commands | ||
|
||
- **Build and run all iOS tests:** | ||
```sh | ||
yarn detox:ios | ||
``` | ||
|
||
- **Build and run all Android tests:** | ||
```sh | ||
yarn detox:android | ||
``` |
This file contains 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 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 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 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,5 @@ | ||
import en from '../../assets/locales/en/en.json'; | ||
|
||
export function getText<Key extends keyof typeof en>(key: Key): string { | ||
return en[key]; | ||
} |
This file contains 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 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,3 +1,6 @@ | ||
import Config from 'react-native-config'; | ||
import {LoggerService} from '@app/services/logger'; | ||
|
||
global.Logger = new LoggerService(); | ||
global.IS_DETOX = | ||
!!process.env.JEST_WORKER_ID || !!process.env.FOR_DETOX || !!Config.FOR_DETOX; |
This file contains 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.