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

@codeceptjs/detox-helper

Package Overview
Dependencies
Maintainers
2
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.2 to 1.0.3

277

Detox.js

@@ -1,3 +0,2 @@

const Helper = require('codeceptjs').helper;
const recorder = require('codeceptjs').recorder;
const { recorder } = require('codeceptjs');
const path = require('path');

@@ -14,22 +13,22 @@

* 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** solution, 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 access to application source code, and a way to build and execute it on emulator.
*
* Comparing to Appium, Detox runs faster and more stable but requires an additional setup for build.
*
*
* ### Setup
*
*
* 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:
*
* 3. Install [CodeceptJS](https://codecept.io) and detox-helper:
*
* ```
* npm i @codeceptjs/detox-helper --save
* ```
*
*
* Detox configuration is required in `package.json` under `detox` section.
*
*
* If you completed step 1 and step 2 you should have a configuration similar this:
*
*
* ```js

@@ -47,10 +46,10 @@ * "detox": {

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

@@ -60,12 +59,12 @@ * helpers: {

* require: '@codeceptjs/detox-helper',
* configuration: '<detox-configuration-name>',
* }
* configuration: '<detox-configuration-name>',
* }
* }
*
*
* ```
*
*
* It's important to specify a package name under `require` section and current detox configuration taken from `package.json`.
*
*
* Options:
*
*
* * `configuration` - a detox configuration name. Required.

@@ -75,3 +74,3 @@ * * `reloadReactNative` - should be enabled for React Native applications.

* * `registerGlobals` - (default: true) Register Detox helper functions `by`, `element`, `expect`, `waitFor` globally.
*
*
*/

@@ -132,3 +131,3 @@ class Detox extends Helper {

} catch (e) {
return ['detox@^12'];
return ['detox@^19'];
}

@@ -160,8 +159,8 @@ }

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

@@ -206,3 +205,3 @@ async saveScreenshot(name) {

* Relaunches an application.
*
*
* ```js

@@ -218,3 +217,3 @@ * I.relaunchApp();

* Launches an application. If application instance already exists, use [relaunchApp](#relaunchApp).
*
*
* ```js

@@ -231,3 +230,3 @@ * I.launchApp();

* Application is installed by default.
*
*
* ```js

@@ -243,3 +242,3 @@ * I.installApp();

* Shakes the device.
*
*
* ```js

@@ -255,3 +254,3 @@ * I.shakeDevice();

* Goes back on Android
*
*
* ```js

@@ -267,3 +266,3 @@ * I.goBack(); // on Android only

* Switches device to landscape orientation
*
*
* ```js

@@ -279,3 +278,3 @@ * I.setLandscapeOrientation();

* Switches device to portrait orientation
*
*
* ```js

@@ -330,9 +329,9 @@ * I.setPortraitOrientation();

/**
* Taps on an element.
* Taps on an element.
* Element can be located by its text or id or accessibility id.
*
*
* The second parameter is a context element to narrow the search.
*
*
* Same as [click](#click)
*
*
* ```js

@@ -345,5 +344,5 @@ * I.tap('Login'); // locate by text

* ```
*
* @param {CodeceptJS.LocatorOrString} locator
* @param {CodeceptJS.LocatorOrString | null} [context=null]
*
* @param {CodeceptJS.LocatorOrString} locator
* @param {CodeceptJS.LocatorOrString | null} [context=null]
*/

@@ -357,6 +356,6 @@ tap(locator, context = null) {

* Element can be located by its text or id or accessibility id.
*
*
* Set the number of taps in second argument.
* Optionally define the context element by third argument.
*
*
* ```js

@@ -368,5 +367,5 @@ * I.multiTap('Login', 2); // locate by text

* ```
*
*
* @param {CodeceptJS.LocatorOrString} locator element to locate
* @param {number} num number of taps
* @param {number} num number of taps
* @param {CodeceptJS.LocatorOrString | null} [context=null] context element

@@ -382,3 +381,3 @@ */

* Taps an element and holds for a requested time.
*
*
* ```js

@@ -389,6 +388,6 @@ * I.longPress('Login', 2); // locate by text, hold for 2 seconds

* ```
*
*
* @param {CodeceptJS.LocatorOrString} locator element to locate
* @param {number} sec number of seconds to hold tap
* @param {CodeceptJS.LocatorOrString | null} [context=null] context element
* @param {CodeceptJS.LocatorOrString | null} [context=null] context element
*/

@@ -403,9 +402,9 @@ async longPress(locator, sec, context = null) {

/**
* Clicks on an element.
* Clicks on an element.
* Element can be located by its text or id or accessibility id
*
*
* The second parameter is a context (id | type | accessibility id) to narrow the search.
*
*
* Same as [tap](#tap)
*
*
* ```js

@@ -418,5 +417,5 @@ * I.click('Login'); // locate by text

* ```
*
* @param {CodeceptJS.LocatorOrString} locator
* @param {CodeceptJS.LocatorOrString | null} [context=null]
*
* @param {CodeceptJS.LocatorOrString} locator
* @param {CodeceptJS.LocatorOrString | null} [context=null]
*/

@@ -430,5 +429,26 @@ async click(locator, context = null) {

/**
* Clicks on an element.
* Element can be located by its label
*
* The second parameter is a context (id | type | accessibility id) to narrow the search.
*
*
* ```js
* I.tapByLabel('Login'); // locate by text
* I.tapByLabel('Login', '#nav'); // locate by text inside #nav
* ```
*
* @param {CodeceptJS.LocatorOrString} locator
* @param {CodeceptJS.LocatorOrString | null} [context=null]
*/
async tapByLabel(locator, context = null) {
locator = this._detectLocator(locator, 'label');
if (context) locator = this._detectLocator(context).withDescendant(locator);
await element(locator).tap();
}
/**
* Performs click on element with horizontal and vertical offset.
* An element is located by text, id, accessibility id.
*
*
* ```js

@@ -438,3 +458,3 @@ * I.clickAtPoint('Save', 10, 10);

* ```
*
*
* @param {CodeceptJS.LocatorOrString} locator

@@ -451,3 +471,3 @@ * @param {number} [x=0] horizontal offset

* Use second parameter to narrow down the search.
*
*
* ```js

@@ -458,5 +478,5 @@ * I.see('Record created');

* ```
*
*
* @param {string} text to check visibility
* @param {CodeceptJS.LocatorOrString | null} [context=null] element inside which to search for text
* @param {CodeceptJS.LocatorOrString | null} [context=null] element inside which to search for text
*/

@@ -473,3 +493,3 @@ see(text, context = null) {

* Use second parameter to narrow down the search.
*
*
* ```js

@@ -492,3 +512,3 @@ * I.dontSee('Record created');

* Use second parameter to narrow down the search.
*
*
* ```js

@@ -498,4 +518,4 @@ * I.seeElement('~edit'); // located by accessibility id

* ```
*
* @param {CodeceptJS.LocatorOrString} locator element to locate
*
* @param {CodeceptJS.LocatorOrString} locator element to locate
* @param {CodeceptJS.LocatorOrString | null} [context=null] context element

@@ -509,2 +529,19 @@ */

/**
* Checks if an element exists.
*
* ```js
* I.checkIfElementExists('~edit'); // located by accessibility id
* I.checkIfElementExists('~edit', '#menu'); // element inside #menu
* ```
*
* @param {CodeceptJS.LocatorOrString} locator element to locate
* @param {CodeceptJS.LocatorOrString | null} [context=null] context element
*/
checkIfElementExists(locator, context = null) {
locator = this._detectLocator(locator);
if (context) locator = this._detectLocator(context).withDescendant(locator);
if (element(locator)) return true;
return false;
}

@@ -514,3 +551,3 @@ /**

* Use second parameter to narrow down the search.
*
*
* ```js

@@ -532,3 +569,3 @@ * I.dontSeeElement('~edit'); // located by accessibility id

* Use second parameter to narrow down the search.
*
*
* ```js

@@ -538,4 +575,4 @@ * I.seeElementExists('~edit'); // located by accessibility id

* ```
*
* @param {CodeceptJS.LocatorOrString} locator element to locate
*
* @param {CodeceptJS.LocatorOrString} locator element to locate
* @param {CodeceptJS.LocatorOrString} [context=null] context element

@@ -552,3 +589,3 @@ */

* Use second parameter to narrow down the search.
*
*
* ```js

@@ -558,4 +595,4 @@ * I.dontSeeElementExist('~edit'); // located by accessibility id

* ```
*
* @param {CodeceptJS.LocatorOrString} locator element to locate
*
* @param {CodeceptJS.LocatorOrString} locator element to locate
* @param {CodeceptJS.LocatorOrString} [context=null] context element

@@ -572,3 +609,3 @@ */

* A field can be located by text, accessibility id, id.
*
*
* ```js

@@ -579,5 +616,5 @@ * I.fillField('Username', 'davert');

* ```
*
*
* @param {CodeceptJS.LocatorOrString} field an input element to fill in
* @param {string} value value to fill
* @param {string} value value to fill
*/

@@ -591,9 +628,26 @@ async fillField(field, value) {

/**
* Taps return key.
* A field can be located by text, accessibility id, id.
*
* ```js
* I.tapReturnKey('Username');
* I.tapReturnKey('~name');
* I.tapReturnKey({ android: 'NAME', ios: 'name' });
* ```
*
* @param {CodeceptJS.LocatorOrString} field an input element to fill in
*/
async tapReturnKey(field) {
const locator = this._detectLocator(field);
await element(locator).tapReturnKey()
}
/**
* Clears a text field.
* A field can be located by text, accessibility id, id.
*
*
* ```js
* I.clearField('~name');
* ```
*
* ```
*
* @param {CodeceptJS.LocatorOrString} field an input element to clear

@@ -610,9 +664,9 @@ */

* A field can be located by text, accessibility id, id.
*
*
* ```js
* I.appendField('name', 'davert');
* ```
*
* @param {CodeceptJS.LocatorOrString} field
* @param {string} value
*
* @param {CodeceptJS.LocatorOrString} field
* @param {string} value
*/

@@ -627,8 +681,8 @@ async appendField(field, value) {

* Scrolls to the top of an element.
*
*
* ```js
* I.scrollUp('#container');
* ```
*
* @param {CodeceptJS.LocatorOrString} locator
*
* @param {CodeceptJS.LocatorOrString} locator
*/

@@ -641,8 +695,8 @@ async scrollUp(locator) {

* Scrolls to the bottom of an element.
*
*
* ```js
* I.scrollDown('#container');
* ```
*
* @param {CodeceptJS.LocatorOrString} locator
*
* @param {CodeceptJS.LocatorOrString} locator
*/

@@ -655,8 +709,8 @@ async scrollDown(locator) {

* Scrolls to the left of an element.
*
*
* ```js
* I.scrollLeft('#container');
* ```
*
* @param {CodeceptJS.LocatorOrString} locator
*
* @param {CodeceptJS.LocatorOrString} locator
*/

@@ -670,8 +724,8 @@ async scrollLeft(locator) {

* Scrolls to the right of an element.
*
*
* ```js
* I.scrollRight('#container');
* ```
*
* @param {CodeceptJS.LocatorOrString} locator
*
* @param {CodeceptJS.LocatorOrString} locator
*/

@@ -686,7 +740,7 @@ async scrollRight(locator) {

* Can be `slow` or `fast` swipe.
*
*
* ```js
* I.swipeUp('#container');
* ```
*
*
* @param {CodeceptJS.LocatorOrString} locator an element on which to perform swipe

@@ -703,7 +757,7 @@ * @param {string} [speed='slow'] a speed to perform: `slow` or `fast`.

* Can be `slow` or `fast` swipe.
*
*
* ```js
* I.swipeUp('#container');
* ```
*
*
* @param {CodeceptJS.LocatorOrString} locator an element on which to perform swipe

@@ -720,7 +774,7 @@ * @param {string} [speed='slow'] a speed to perform: `slow` or `fast`.

* Can be `slow` or `fast` swipe.
*
*
* ```js
* I.swipeUp('#container');
* ```
*
*
* @param {CodeceptJS.LocatorOrString} locator an element on which to perform swipe

@@ -737,7 +791,7 @@ * @param {string} [speed='slow'] a speed to perform: `slow` or `fast`.

* Can be `slow` or `fast` swipe.
*
*
* ```js
* I.swipeUp('#container');
* ```
*
*
* @param {CodeceptJS.LocatorOrString} locator an element on which to perform swipe

@@ -752,7 +806,7 @@ * @param {string} [speed='slow'] a speed to perform: `slow` or `fast`.

* Waits for number of seconds
*
*
* ```js
* I.wait(2); // waits for 2 seconds
* ```
*
*
* @param {number} sec number of seconds to wait

@@ -768,7 +822,7 @@ */

* Waits for an element to exist on page.
*
*
* ```js
* I.waitForElement('#message', 1); // wait for 1 second
* ```
*
*
* @param {CodeceptJS.LocatorOrString} locator an element to wait for

@@ -783,7 +837,7 @@ * @param {number} [sec=5] number of seconds to wait, 5 by default

* Waits for an element to be visible on page.
*
*
* ```js
* I.waitForElementVisible('#message', 1); // wait for 1 second
* ```
*
*
* @param {CodeceptJS.LocatorOrString} locator an element to wait for

@@ -798,7 +852,7 @@ * @param {number} [sec=5] number of seconds to wait

* Waits an elment to become not visible.
*
*
* ```js
* I.waitToHide('#message', 2); // wait for 2 seconds
* ```
*
*
* @param {CodeceptJS.LocatorOrString} locator an element to wait for

@@ -832,2 +886,5 @@ * @param {number} [sec=5] number of seconds to wait

}
if (type === 'label') {
return by.label(locator);
}
return by.type(locator);

@@ -834,0 +891,0 @@ }

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

@@ -12,3 +12,4 @@ "main": "Detox.js",

"files": [
"./Detox.js"
"./Detox.js",
"README.md"
],

@@ -18,3 +19,3 @@ "directories": {},

"type": "git",
"url": "git+https://github.com/Codeception/detox-helper.git"
"url": "git+https://github.com/codeceptjs/detox-helper.git"
},

@@ -24,12 +25,12 @@ "author": "Michael Bodnarchuk @davert",

"bugs": {
"url": "https://github.com/Codeception/detox-helper/issues"
"url": "https://github.com/codeceptjs/detox-helper/issues"
},
"homepage": "https://github.com/Codeception/detox-helper#readme",
"homepage": "https://github.com/codeceptjs/detox-helper#readme",
"dependencies": {
"detox": "^12.11.3"
"detox": "19.13.0"
},
"devDependencies": {
"codeceptjs": "^2.2.1",
"documentation": "^11.0.1"
"codeceptjs": "3.5.12",
"documentation": "11.0.1"
}
}

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

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.
1. [Install and configure Detox for iOS and Android](https://wix.github.io/Detox/docs/introduction/getting-started/)
2. [Build an application](https://wix.github.io/Detox/docs/introduction/your-first-test) using `detox build` command.
3. Install [CodeceptJS](https://codecept.io) and detox-helper:

@@ -555,3 +555,3 @@

Performs a swipe up inside an element.
Performs a scroll down inside an element.
Can be `slow` or `fast` swipe.

@@ -570,3 +570,3 @@

Performs a swipe up inside an element.
Performs a scroll up inside an element.
Can be `slow` or `fast` swipe.

@@ -573,0 +573,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