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

codeceptjs

Package Overview
Dependencies
Maintainers
1
Versions
235
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codeceptjs - npm Package Compare versions

Comparing version 0.4.8 to 0.4.9

1

bin/codecept.js

@@ -61,2 +61,3 @@ #!/usr/bin/env node

.option('--profile [value]', 'configuration profile to be used')
.option('--config [file]', 'configuration file to be used')

@@ -63,0 +64,0 @@ // mocha options

@@ -0,1 +1,10 @@

## 0.4.9
* [SeleniumWebdriver][Protractor][WebDriverIO][Nightmare] fixed `executeScript`, `executeAsyncScript` to work and return values.
* [Protractor][SeleniumWebdriver][WebDriverIO] Added `waitForInvisible` and `waitForStalenessOf` methods by @Nighthawk14.
* Added `--config` option to `codeceptjs run` to manually specify config file by @cnworks
* [Protractor] Simplified behavior of `amOutsideAngularApp` by using `ignoreSynchronization`. Fixes #278
* Set exit code to 1 when test fails at `Before`/`After` hooks. Fixes #279
## 0.4.8

@@ -2,0 +11,0 @@

3

lib/command/run.js

@@ -10,5 +10,6 @@ 'use strict';

process.profile = options.profile;
let configfile = options.config;
let testRoot = getTestRoot(suite);
let config = getConfig(testRoot);
let config = getConfig(testRoot, configfile);
try {

@@ -15,0 +16,0 @@ let codecept = new Codecept(config, options);

'use strict';
let fileExists = require('../utils').fileExists;
let isFile = require('../utils').isFile;
let output = require("../output");

@@ -12,5 +13,6 @@ let fs = require('fs');

module.exports.getConfig = function (testRoot) {
module.exports.getConfig = function (testRoot, configfile) {
let config,
manualConfigFile = configfile && path.resolve(configfile),
jsConfigFile = path.join(testRoot, 'codecept.conf.js'),

@@ -20,17 +22,30 @@ jsConfigFileDeprecated = path.join(testRoot, 'codecept.js'),

if (fileExists(jsConfigFile)) {
config = require(jsConfigFile).config;
} else if (fileExists(jsConfigFileDeprecated)) {
if (isFile(manualConfigFile)) { // --config option provided
if (path.extname(manualConfigFile) === '.js') {
return configWithDefaults(require(manualConfigFile).config);
}
return configWithDefaults(JSON.parse(fs.readFileSync(manualConfigFile, 'utf8')));
}
if (fileExists(jsConfigFile)) { // js config file
return configWithDefaults(require(jsConfigFile).config);
}
if (fileExists(jsConfigFileDeprecated)) { // deprecated js config file
console.log('Using codecept.js as configuration is deprecated, please rename it to codecept.conf.js');
config = require(jsConfigFileDeprecated).config;
} else if (fileExists(jsonConfigFile)) {
config = JSON.parse(fs.readFileSync(jsonConfigFile, 'utf8'));
} else {
output.error(`Can not load config from ${jsConfigFile} or ${jsonConfigFile}\nCodeceptJS is not initialized in this dir. Execute 'codeceptjs init' to start`);
process.exit(1);
return configWithDefaults(require(jsConfigFileDeprecated).config);
}
if (fileExists(jsonConfigFile)) { // json config provided
return configWithDefaults(JSON.parse(fs.readFileSync(jsonConfigFile, 'utf8')));
}
output.error(`Can not load config from ${jsConfigFile}, ${jsonConfigFile} or ${manualConfigFile}\nCodeceptJS is not initialized in this dir. Execute 'codeceptjs init' to start`);
process.exit(1);
};
function configWithDefaults(config) {
if (!config.include) config.include = {};
if (!config.helpers) config.helpers = {};
return config;
};
}

@@ -438,2 +438,4 @@ 'use strict';

* {{> ../webapi/executeScript }}
*
* Wrapper for synchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2)
*/

@@ -446,5 +448,9 @@ executeScript(fn) {

* {{> ../webapi/executeAsyncScript }}
*
* Wrapper for asynchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2).
* Unlike NightmareJS implementation calling `done` will return its first argument.
*/
executeAsyncScript(fn) {
return this.browser.asyncScript(arguments);
return this.browser.evaluate.apply(this.browser, arguments)
.catch((err) => err); // Nightmare's first argument is error :(
}

@@ -451,0 +457,0 @@

@@ -130,4 +130,6 @@ 'use strict';

_startBrowser() {
this.browser = this.driverProvider.getNewDriver();
global.element = this.browser.element;
let browser = this.driverProvider.getNewDriver();
global.element = browser.element;
this.browser = protractorWrapper(browser, this.options.url, this.options.rootElement);
this.browser.ready = this.browser.manage().timeouts().setScriptTimeout(this.options.scriptsTimeout);
return this.browser;

@@ -181,6 +183,5 @@ }

amOutsideAngularApp() {
if (this.browser.driver && this.insideAngular) {
this.browser = this.browser.driver;
this.insideAngular = false;
}
if (!this.browser) return;
this.browser.ignoreSynchronization = true;
return Promise.resolve(this.insideAngular = false);
}

@@ -196,11 +197,4 @@

}
this.browser = protractorWrapper(this.browser, this.options.url, this.options.rootElement);
this.browser.ready = this.browser.manage().timeouts().setScriptTimeout(this.options.scriptsTimeout);
if (this.options.useAllAngular2AppRoots) this.browser.useAllAngular2AppRoots();
if (this.options.getPageTimeout) this.browser.getPageTimeout = this.options.getPageTimeout;
if (this.options.allScriptsTimeout) this.browser.allScriptsTimeout = this.options.allScriptsTimeout;
if (this.options.debuggerServerPort) this.browser.debuggerServerPort_ = this.options.debuggerServerPort;
this.insideAngular = true;
this.browser.ignoreSynchronization = false;
return Promise.resolve(this.insideAngular = true);
}

@@ -236,2 +230,18 @@

/**
* {{> ../webapi/waitForInvisible }}
*/
waitForInvisible(locator, sec) {
sec = sec || 1;
let el = this.browser.element(guessLocator(locator) || by.css(locator));
return this.browser.wait(EC.invisibilityOf(el), sec*1000);
}
/**
* {{> ../webapi/waitForStalenessOf }}
*/
waitForStalenessOf(locator, sec) {
return this.waitForInvisible(locator, sec);
}
/**
* {{> ../webapi/waitForText }}

@@ -245,3 +255,3 @@ */

sec = sec || 1;
return this.browser.wait (EC.textToBePresentInElement(el, text), sec*1000);
return this.browser.wait(EC.textToBePresentInElement(el, text), sec*1000);
}

@@ -248,0 +258,0 @@

@@ -47,2 +47,3 @@ 'use strict';

* * `waitForTimeout`: (optional) sets default wait time in _ms_ for all `wait*` functions. 1000 by default;
* * `scriptTimeout`: (optional) sets default timeout for scripts in `executeAsync`. 1000 by default.
* * `manualStart` (optional, default: false) - do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriverIO"]._startBrowser()`

@@ -71,2 +72,3 @@ * * `capabilities`: {} - list of [Desired Capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities)

waitforTimeout: 1000, // ms
scriptTimeout: 1000, // ms
manualStart: false,

@@ -492,3 +494,3 @@ capabilities: {}

executeScript(fn) {
return this.browser.execute.apply(this.browser, arguments);
return this.browser.executeScript.apply(this.browser, arguments);
}

@@ -500,3 +502,4 @@

executeAsyncScript(fn) {
return this.browser.executeAsync.apply(this.browser, arguments);
this.browser.manage().timeouts().setScriptTimeout(this.options.scriptTimeout);
return this.browser.executeAsyncScript.apply(this.browser, arguments);
}

@@ -648,2 +651,20 @@

/**
* {{> ../webapi/waitForInvisible }}
*/
waitForInvisible(locator, sec) {
sec = sec || this.options.waitforTimeout;
let el = this.browser.findElement(guessLocator(locator) || by.css(locator));
return this.browser.wait(this.webdriver.until.elementIsNotVisible(el), sec*1000);
}
/**
* {{> ../webapi/waitForStalenessOf }}
*/
waitForStalenessOf(locator, sec) {
sec = sec || this.options.waitforTimeout;
let el = this.browser.findElement(guessLocator(locator) || by.css(locator));
return this.browser.wait(this.webdriver.until.stalenessOf(el), sec*1000);
}
/**
* {{> ../webapi/waitForText }}

@@ -650,0 +671,0 @@ */

@@ -197,3 +197,6 @@ 'use strict';

restart: true,
manualStart: false
manualStart: false,
timeouts: {
script: 1000 // ms
}
};

@@ -777,5 +780,7 @@

* {{> ../webapi/executeScript }}
*
* Wraps [execute](http://webdriver.io/api/protocol/execute.html) command.
*/
executeScript(fn) {
return this.browser.execute.apply(this.browser, arguments);
return this.browser.execute.apply(this.browser, arguments).then((res) => res.value);
}

@@ -787,3 +792,3 @@

executeAsyncScript(fn) {
return this.browser.executeAsync.apply(this.browser, arguments);
return this.browser.executeAsync.apply(this.browser, arguments).then((res) => res.value);
}

@@ -1004,2 +1009,10 @@

/**
* {{> ../webapi/waitForInvisible }}
*/
waitForInvisible(locator, sec) {
sec = sec || this.options.waitForTimeout;
return this.browser.waitForVisible(withStrictLocator(locator), sec * 1000, true);
}
/**
* Waits for an element to become invisible on a page (by default waits for 1sec).

@@ -1009,4 +1022,11 @@ * Element can be located by CSS or XPath.

waitToHide(locator, sec) {
return this.waitForInvisible(locator, sec);
}
/**
* {{> ../webapi/waitForStalenessOf }}
*/
waitForStalenessOf(locator, sec) {
sec = sec || this.options.waitForTimeout;
return this.browser.waitForVisible(withStrictLocator(locator), sec * 1000, true);
return this.browser.waitForExist(withStrictLocator(locator), sec * 1000, true);
}

@@ -1013,0 +1033,0 @@

@@ -77,2 +77,6 @@ 'use strict';

}
recorder.catch((err) => {
event.emit(event.test.failed, {}, err); // emit
throw err;
});
return recorder.promise();

@@ -79,0 +83,0 @@ };

@@ -13,2 +13,13 @@ var fs = require('fs');

module.exports.isFile = function (filePath) {
var filestat;
try {
filestat = fs.statSync(filePath);
} catch (err) {
if (err.code === 'ENOENT') return false;
}
if (!filestat) return false;
return filestat.isFile();
};
module.exports.getParamNames = function (fn) {

@@ -20,8 +31,8 @@ if (fn.isSinonProxy) return [];

module.exports.installedLocally = function() {
return path.resolve(__dirname+'/../').indexOf(process.cwd()) === 0;
module.exports.installedLocally = function () {
return path.resolve(__dirname + '/../').indexOf(process.cwd()) === 0;
}
module.exports.methodsOfObject = function (obj, className) {
var methods = [];
var methods = [];

@@ -40,3 +51,3 @@ const standard = [

Object.getOwnPropertyNames(obj).forEach((prop) => {
if (typeof(obj[prop]) !== 'function') return;
if (typeof (obj[prop]) !== 'function') return;
if (standard.indexOf(prop) >= 0) return;

@@ -43,0 +54,0 @@ if (prop.indexOf('_') === 0) return;

{
"name": "codeceptjs",
"version": "0.4.8",
"version": "0.4.9",
"description": "Modern Era Aceptance Testing Framework for NodeJS",

@@ -36,3 +36,3 @@ "homepage": "http://codecept.io",

"mkdirp": "^0.5.1",
"mocha": "^2.4.2",
"mocha": "^3.1.2",
"requireg": "^0.1.5"

@@ -39,0 +39,0 @@ },

@@ -73,3 +73,3 @@ # CodeceptJS [![NPM version][npm-image]][npm-url] [![Build Status](https://travis-ci.org/Codeception/CodeceptJS.svg)](https://travis-ci.org/Codeception/CodeceptJS) [![Join the chat at https://gitter.im/Codeception/CodeceptJS](https://badges.gitter.im/Codeception/CodeceptJS.svg)](https://gitter.im/Codeception/CodeceptJS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

```
codeceptjs generate test
codeceptjs generate:test
```

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