From ab4cabc8377c7afbeccc0312c8f4434cc6c29cdb Mon Sep 17 00:00:00 2001 From: Rotem M Date: Fri, 26 Jan 2018 16:05:55 +0200 Subject: [PATCH] Updated docs re #374: export platform specific objects through proxy --- docs/APIRef.DetoxObjectAPI.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/APIRef.DetoxObjectAPI.md b/docs/APIRef.DetoxObjectAPI.md index bbe244be1a..8d5c82c22c 100644 --- a/docs/APIRef.DetoxObjectAPI.md +++ b/docs/APIRef.DetoxObjectAPI.md @@ -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 @@ -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 () => {