Skip to content

Commit

Permalink
Updated docs re #374: export platform specific objects through proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
rotemmiz committed Jan 26, 2018
1 parent f8c9b6f commit ab4cabc
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions docs/APIRef.DetoxObjectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,26 @@ before(async () => {
});
```

#### controlling first app intialization
##### Explicit imports during initilization
Detox exports `device `, `expect`, `element`, `by` and `waitFor` as globals by default, if you want to control their initialization manually, set init detox with `initGlobals` set to `false`. This is useful when during E2E tests you also need to run regular expectations in node. jest `Expect` for instance, will not be overriden by Detox when this option is used.

```js
before(async () => {
await detox.init(config, {initGlobals: false});
});
```

Then import them manually:

```js
const {device, expect, element, by, waitFor} = require('detox');
```

Use [this example](../examples/demo-react-native/e2eExplicitRequire) for initial setup



#### Controlling first app intialization
By default `await detox.init(config);` will launch the installed app. If you wish to control when your app is launched, add `{launchApp: false}` param to your init.

```js
Expand All @@ -36,7 +55,7 @@ before(async () => {
});
```

>NOTE: Detox 6.X.X will introduce a **breaking change** , setting `launchApp` to `false` by default. In order to prevent any breaking changes to your tests when you upgrade (and if you still would like `init` to launch the app for you) do the following:
>NOTE: Detox 6.X.X introduced a **breaking change** , setting `launchApp` to `false` by default. In order to prevent any breaking changes to your tests when you upgrade (and if you still would like `init` to launch the app for you) do the following:
```js
before(async () => {
Expand Down

0 comments on commit ab4cabc

Please sign in to comment.