Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@codeceptjs/detox-helper

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codeceptjs/detox-helper - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

58

Detox.js

@@ -12,7 +12,7 @@ const Helper = require('codeceptjs').helper;

/**
* This is a wrapper on top of [Detox](https://github.com/wix/Detox) library by Wix aimied to unify testing experience for CodeceptJS framework.
* This is a wrapper on top of [Detox](https://github.com/wix/Detox) library, aimied to unify testing experience for CodeceptJS framework.
* Detox provides a grey box testing for mobile applications, playing especially good for React Native apps.
*
* Detox plays quite differently from Appium. To establish detox testing you need to build a mobile application in a special way to inject Detox code.
* This why Detox is grey box testing, so you need an access to application source code, and a way to build and execute it on emulator.
* This why **Detox is grey box testing** solution, so you need an access to application source code, and a way to build and execute it on emulator.
*

@@ -23,6 +23,6 @@ * Comparing to Appium, Detox runs faster and more stable but requires an additional setup for build.

*
* To install and condifure Detox [see the official guide for iOS](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md) and [Android](https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md)
* 1. [Install and configure Detox for iOS](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md) and [Android](https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md)
* 2. [Build an application](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md#step-4-build-your-app-and-run-detox-tests) using `detox build` command.
* 3. Install [CodeceptJS](https://codecept.io) and detox-helper:
*
* After you performed all steps required to set up Detox by itself you are ready to configure this helper. Install it via npm:
*
* ```

@@ -34,3 +34,3 @@ * npm i @codeceptjs/detox-helper --save

*
* Example:
* If you completed step 1 and step 2 you should have a configuration similar this:
*

@@ -50,4 +50,7 @@ * ```js

*
*
* ### Configuration
*
* Besides Detox configuration, CodeceptJS should also be configured to use Detox.
*
* In `codecept.conf.js` enable Detox helper:

@@ -59,3 +62,3 @@ *

* require: '@codeceptjs/detox',
* configuration: 'ios.sim.debug',
* configuration: '<detox-configuration-name>',
* }

@@ -72,4 +75,5 @@ * }

* * `reloadReactNative` - should be enabled for React Native applications.
* * `reuse` - reuse application for tests. By default, Detox reinstalls and relaunches app.
* * `registerGlobals` - (default: true) Register Detox helper functions `by`, `element`, `expect`, `waitFor` globally.
*
*
*/

@@ -85,17 +89,28 @@ class Detox extends Helper {

this.device = detox.device;
this._registerGlobals();
this._useDetoxFunctions();
}
_registerOptions() {
if (this.options.configuration) {
if (this.options.configuration && process.argv.indexOf('--configuration') < 0) {
process.argv.push('--configuration');
process.argv.push(this.options.configuration);
}
if (!process.argv.indexOf('--artifacts-location') < 0) {
process.argv.push('--artifacts-location');
process.argv.push(global.output_dir + '/');
}
}
_registerGlobals() {
global.by = by = detox.by;
global.element = element = detox.element;
global.expect = expect = detox.expect;
global.waitFor = waitFor = detox.waitFor;
_useDetoxFunctions() {
by = detox.by;
element = detox.element;
expect = detox.expect;
waitFor = detox.waitFor;
if (this.options.registerGlobals) {
global.by = by
global.element = element
global.expect = expect
global.waitFor = waitFor
}
}

@@ -145,2 +160,15 @@

/**
* Saves a screenshot to the output dir
*
* ```js
* I.saveScreenshot('main-window.png');
* ```
*
* @param string name
*/
async saveScreenshot(name) {
return this.device.takeScreenshot(name);
}
async _test(test) {

@@ -147,0 +175,0 @@ await detox.beforeEach({

{
"name": "@codeceptjs/detox-helper",
"version": "1.0.0",
"version": "1.0.1",
"description": "Detox helper for CodeceptJS",

@@ -9,3 +9,3 @@ "main": "Detox.js",

"docs": "npx documentation readme Detox.js --section=API --shallow",
"release": "npm run docs && npm publish"
"release": "npm run docs && npm publish --access public"
},

@@ -12,0 +12,0 @@ "files": [

@@ -40,2 +40,4 @@ # [Detox](https://github.com/wix/Detox) Helper for [CodeceptJS](https://codecept.io)

- [Parameters](#parameters)
- [saveScreenshot](#savescreenshot)
- [Parameters](#parameters-1)
- [relaunchApp](#relaunchapp)

@@ -49,57 +51,57 @@ - [launchApp](#launchapp)

- [runOnIOS](#runonios)
- [Parameters](#parameters-1)
- [Parameters](#parameters-2)
- [runOnAndroid](#runonandroid)
- [Parameters](#parameters-2)
- [Parameters](#parameters-3)
- [tap](#tap)
- [Parameters](#parameters-3)
- [Parameters](#parameters-4)
- [multiTap](#multitap)
- [Parameters](#parameters-4)
- [Parameters](#parameters-5)
- [longPress](#longpress)
- [Parameters](#parameters-5)
- [Parameters](#parameters-6)
- [click](#click)
- [Parameters](#parameters-6)
- [Parameters](#parameters-7)
- [clickAtPoint](#clickatpoint)
- [Parameters](#parameters-7)
- [Parameters](#parameters-8)
- [see](#see)
- [Parameters](#parameters-8)
- [Parameters](#parameters-9)
- [dontSee](#dontsee)
- [Parameters](#parameters-9)
- [Parameters](#parameters-10)
- [seeElement](#seeelement)
- [Parameters](#parameters-10)
- [Parameters](#parameters-11)
- [dontSeeElement](#dontseeelement)
- [Parameters](#parameters-11)
- [Parameters](#parameters-12)
- [seeElementExists](#seeelementexists)
- [Parameters](#parameters-12)
- [Parameters](#parameters-13)
- [dontSeeElementExists](#dontseeelementexists)
- [Parameters](#parameters-13)
- [Parameters](#parameters-14)
- [fillField](#fillfield)
- [Parameters](#parameters-14)
- [Parameters](#parameters-15)
- [clearField](#clearfield)
- [Parameters](#parameters-15)
- [Parameters](#parameters-16)
- [appendField](#appendfield)
- [Parameters](#parameters-16)
- [Parameters](#parameters-17)
- [scrollUp](#scrollup)
- [Parameters](#parameters-17)
- [Parameters](#parameters-18)
- [scrollDown](#scrolldown)
- [Parameters](#parameters-18)
- [Parameters](#parameters-19)
- [scrollLeft](#scrollleft)
- [Parameters](#parameters-19)
- [Parameters](#parameters-20)
- [scrollRight](#scrollright)
- [Parameters](#parameters-20)
- [Parameters](#parameters-21)
- [swipeUp](#swipeup)
- [Parameters](#parameters-21)
- [Parameters](#parameters-22)
- [swipeDown](#swipedown)
- [Parameters](#parameters-22)
- [Parameters](#parameters-23)
- [swipeLeft](#swipeleft)
- [Parameters](#parameters-23)
- [Parameters](#parameters-24)
- [swipeRight](#swiperight)
- [Parameters](#parameters-24)
- [Parameters](#parameters-25)
- [wait](#wait)
- [Parameters](#parameters-25)
- [Parameters](#parameters-26)
- [waitForElement](#waitforelement)
- [Parameters](#parameters-26)
- [Parameters](#parameters-27)
- [waitForElementVisible](#waitforelementvisible)
- [Parameters](#parameters-27)
- [Parameters](#parameters-28)
- [waitToHide](#waittohide)
- [Parameters](#parameters-28)
- [Parameters](#parameters-29)

@@ -110,7 +112,7 @@ ### Detox

This is a wrapper on top of [Detox](https://github.com/wix/Detox) library by Wix aimied to unify testing experience for CodeceptJS framework.
This is a wrapper on top of [Detox](https://github.com/wix/Detox) library, aimied to unify testing experience for CodeceptJS framework.
Detox provides a grey box testing for mobile applications, playing especially good for React Native apps.
Detox plays quite differently from Appium. To establish detox testing you need to build a mobile application in a special way to inject Detox code.
This why Detox is grey box testing, so you need an access to application source code, and a way to build and execute it on emulator.
This why **Detox is grey box testing** solution, so you need an access to application source code, and a way to build and execute it on emulator.

@@ -121,5 +123,6 @@ Comparing to Appium, Detox runs faster and more stable but requires an additional setup for build.

To install and condifure Detox [see the official guide for iOS](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md) and [Android](https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md)
1. [Install and configure Detox for iOS](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md) and [Android](https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md)
2. [Build an application](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md#step-4-build-your-app-and-run-detox-tests) using `detox build` command.
3. Install [CodeceptJS](https://codecept.io) and detox-helper:
After you performed all steps required to set up Detox by itself you are ready to configure this helper. Install it via npm:

@@ -130,3 +133,3 @@ npm i @codeceptjs/detox-helper --save

Example:
If you completed step 1 and step 2 you should have a configuration similar this:

@@ -148,2 +151,4 @@ ```js

Besides Detox configuration, CodeceptJS should also be configured to use Detox.
In `codecept.conf.js` enable Detox helper:

@@ -155,3 +160,3 @@

require: '@codeceptjs/detox',
configuration: 'ios.sim.debug',
configuration: '<detox-configuration-name>',
}

@@ -167,2 +172,4 @@ }

- `reloadReactNative` - should be enabled for React Native applications.
- `reuse` - reuse application for tests. By default, Detox reinstalls and relaunches app.
- `registerGlobals` - (default: true) Register Detox helper functions `by`, `element`, `expect`, `waitFor` globally.

@@ -173,2 +180,15 @@ #### Parameters

#### saveScreenshot
Saves a screenshot to the output dir
```js
I.saveScreenshot('main-window.png');
```
##### Parameters
- `name`
- `string` name
#### relaunchApp

@@ -175,0 +195,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc