Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rotemmiz committed Jun 27, 2018
1 parent bda4981 commit bd11fc5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
3 changes: 2 additions & 1 deletion docs/APIRef.DetoxCLI.md
Expand Up @@ -32,7 +32,8 @@ detox [options] [command]

| Options | Description |
| --- | --- |
| -h<br>--help | Output usage information |
| -h, --help | Output usage information |


## Commands

Expand Down
33 changes: 17 additions & 16 deletions docs/Guide.Contributing.md
Expand Up @@ -45,15 +45,20 @@ git submodule update --init --recursive
lerna bootstrap
```

### Building
### Building & Testing
##### Automatically
`scripts/ci.ios.sh` and `scripts/ci.android.sh` are the scripts Detox runs in CI, they will run `lerna bootstrap`, unit tests, and E2E tests. Make sure these scripts pass before submitting a PR, this is exactly what Detox is going to run in CI.

```sh
lerna run build
```
##### Manually
Alternativley, you can run it manually

### Testing
#### 0. Fixing compilation issues in RN sources
Detox Android test project uses React Native sources instead of the precompiled AAR. The test project uses RN51 and RN53, both have issues with compilation ([Fixed in RN55](https://github.com/facebook/react-native/commit/d8bb990abc226e778e2f32c2de3c6661c0aa64e5#diff-f44163238d434a443b56bd27b3ba0578)). In order to fix this issue, from inside `detox/test` run:
```sh
mv node_modules/react-native/ReactAndroid/release.gradle node_modules/react-native/ReactAndroid/release.gradle.bak
```

### 1. Unit tests
#### 1. Unit tests

```sh
lerna run test
Expand All @@ -69,36 +74,32 @@ npm run unit
npm run unit:watch
```

#### How to read the coverage report
##### How to read the coverage report
After running the tests, jest will create a coverage report.

```sh
cd detox
open coverage/lcov-report/index.html
```

### 2. Running Detox e2e coverage tests
#### 2. Running Detox e2e coverage tests
Detox has a suite of e2e tests to test its own API while developing (and for regression). The way we do is is by maintaining a special application that is "tested" against Detox's API, but essentially, it's the API that is tested, not the app.
To run the e2e tests, go to `detox/detox/test`

```sh
cd detox/test
```


```sh
npm run build
```

To run the e2e tests, after the application was built.

#### iOS
##### iOS
```sh
npm run build:ios
npm run e2e:ios
```

#### Android
##### Android
```sh
npm run build:android
npm run e2e:android
Expand All @@ -120,7 +121,7 @@ launchctl setenv PATH $PATH
```


### 3. Android Native tests
#### 3. Android Native tests

0. Install Java and Android SDK 25
1. In `detox/android` run `./gradlew install` run
Expand All @@ -129,7 +130,7 @@ launchctl setenv PATH $PATH
./gradlew test
```

### 4. Code Generation
#### 4. Code Generation

We are using a code generator based on `babel` and `objective-c-parser` to generate a Javascript Interface for `EarlGrey` (the testing library we use on iOS).
This interface allows us to call Objective-C methods through the WebSocket connection directly on the testing device.
Expand Down
4 changes: 2 additions & 2 deletions docs/Guide.Jest.md
Expand Up @@ -5,7 +5,7 @@ title: Jest

## Usage

### 0. Use the [Getting Started](Introduction.GettingStarted.md) Guide to set up detox
### 0. Use the [Getting Started](Introduction.GettingStarted.md) Guide to set up Detox

### 1. Install Jest

Expand Down Expand Up @@ -37,7 +37,7 @@ detox init -r jest

There are some things you should notice:

- Don't worry about mocks being used, detox works on the compiled version of your app.
- Don't worry about mocks being used, Detox works on the compiled version of your app.
- Detox exposes it's primitives (`expect`, `device`, ...) globally, it will override Jest's global `expect` object.

## How to run unit test and E2E tests in the same project
Expand Down
9 changes: 5 additions & 4 deletions docs/Introduction.GettingStarted.md
Expand Up @@ -87,17 +87,18 @@ npm install detox --save-dev

> TIP: Remember to add the "node_modules" folder to your git ignore.
#### 2. Install test runner
#### 2. Install a test runner

You can use any JavaScript test runner. At the moment, only two are documented:
You can use any JavaScript test runner. Detox CLI supports Jest and Mocha out of the box.

- [Jest](Guide.Jest.md)
- [Jest](http://jestjs.io/)

```sh
npm install jest --save-dev
```
Read the [Jest integration guide](Guide.Jest.md) for more details and gotchas.

- [Mocha](https://mochajs.org/) is a good one we recommend:
- [Mocha](https://mochajs.org/)

```sh
npm install mocha --save-dev
Expand Down

0 comments on commit bd11fc5

Please sign in to comment.