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.16 to 0.5.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## 0.5.0
* Protractor ^5.0.0 support (while keeping ^4.0.9 compatibility)
* Fix 'fullTitle() is not a function' in exit.js by @hubidu. See [#388](https://github.com/Codeception/CodeceptJS/pull/388).
* [Nightmare] Fix for `waitTimeout` by @HughZurname. See [#391](https://github.com/Codeception/CodeceptJS/pull/391). Resolves [#236](https://github.com/Codeception/CodeceptJS/issues/236)
* Dockerized CodeceptJS setup by @artiomnist. [See reference](https://github.com/Codeception/CodeceptJS/blob/master/docker/README.md)
## 0.4.16

@@ -2,0 +9,0 @@

8

lib/helper/Nightmare.js

@@ -61,3 +61,3 @@ 'use strict';

this.context = this.options.rootElement;
this.options.waitForTimeout /= 1000; // convert to seconds
this.options.waitForTimeout;
}

@@ -763,3 +763,3 @@

let locator = guessLocator(context) || { css: context};
this.browser.optionWaitTimeout = sec * 1000 || this.options.waitForTimeout;
this.browser.options.waitTimeout = sec * 1000 || this.options.waitForTimeout;

@@ -775,3 +775,3 @@ return this.browser.wait(function (by, locator, text) {

waitForVisible(locator, sec) {
this.browser.optionWaitTimeout = sec * 1000 || this.options.waitForTimeout;
this.browser.options.waitTimeout = sec * 1000 || this.options.waitForTimeout;
locator = guessLocator(locator) || { css: locator};

@@ -790,3 +790,3 @@

waitForElement(locator, sec) {
this.browser.optionWaitTimeout = sec * 1000 || this.options.waitForTimeout;
this.browser.options.waitTimeout = sec * 1000 || this.options.waitForTimeout;
locator = guessLocator(locator) || { css: locator};

@@ -793,0 +793,0 @@

'use strict';
let protractorWrapper, protractorPlugins, EC;
let By, EC, Runner;

@@ -78,3 +78,5 @@ const requireg = require('requireg');

this.options = Object.assign(this.options, config);
if (!this.options.allScriptsTimeout) this.options.allScriptsTimeout = this.options.scriptsTimeout;
if (this.options.proxy) this.options.capabilities.proxy = this.options.proxy;

@@ -86,29 +88,5 @@ if (this.options.browser) this.options.capabilities.browserName = this.options.browser;

_init() {
try {
// get selenium-webdriver
this.webdriver = requireg('selenium-webdriver');
} catch (e) {
// maybe it is installed as protractor dependency?
this.webdriver = requireg('protractor/node_modules/selenium-webdriver');
}
let ptor = requireg('protractor');
// due to api changes in protractor we need to guess wrapper
protractorWrapper = ptor.wrapDriver;
if (!protractorWrapper && ptor.Browser) protractorWrapper = ptor.Browser.wrapDriver;
if (!protractorWrapper && ptor.ProtractorBrowser) protractorWrapper = ptor.ProtractorBrowser.wrapDriver;
if (!protractorWrapper) throw new Error('Current Protractor version is not supported');
let browser = ptor.ProtractorBrowser ? ptor.ProtractorBrowser : ptor.Browser;
EC = browser.ExpectedConditions || new ptor.ProtractorExpectedConditions(browser);
global.by = browser.By || ptor.ProtractorBy;
if (!EC || !global.by) throw new Error('Current Protractor version is not supported');
let driverProviderModule = requireg('protractor/built/driverProviders/' + this.options.driver);
let className = Object.keys(driverProviderModule)[0];
this.driverProvider = new driverProviderModule[className](this.options);
this.driverProvider.setupEnv();
Runner = require('protractor/built/runner').Runner;
By = require('protractor').ProtractorBy;
this.isProtractor5 = !require('protractor').wrapDriver;
}

@@ -119,7 +97,5 @@

requireg("protractor");
require('assert').ok(requireg("protractor").ProtractorBrowser);
require('assert').ok(requireg("protractor").Browser);
require('assert').ok(requireg("protractor/built/driverProviders/hosted").Hosted);
require('assert').ok(requireg("protractor/built/runner").Runner);
} catch(e) {
return ["protractor@^4.0.0"];
return ["protractor@^5.0.0"];
}

@@ -138,7 +114,12 @@ }

_startBrowser() {
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);
let runner = new Runner(this.options);
this.browser = runner.createBrowser();
global.browser = this.browser;
global.$ = this.browser.$;
global.$$ = this.browser.$$;
global.element = this.browser.element;
global.by = global.By = new By();
global.ExpectedConditions = EC = this.browser.ExpectedConditions;
if (this.options.windowSize == 'maximize') {

@@ -169,3 +150,3 @@ this.resizeWindow(this.options.windowSize);

if (this.insideAngular) {
let context = this.browser.element(guessLocator(locator) || by.css(locator));
let context = element(guessLocator(locator) || by.css(locator));

@@ -224,3 +205,3 @@ this.browser.findElement = (l) => l ? context.element(l).getWebElement() : context.getWebElement();

sec = sec || this.options.waitForTimeout;
let el = this.browser.element(guessLocator(locator) || by.css(locator));
let el = element(guessLocator(locator) || by.css(locator));
return this.browser.wait(EC.presenceOf(el), sec * 1000);

@@ -234,3 +215,3 @@ }

sec = sec || this.options.waitForTimeout;
let el = this.browser.element(guessLocator(locator) || by.css(locator));
let el = element(guessLocator(locator) || by.css(locator));
return this.browser.wait(EC.elementToBeClickable(el), sec * 1000);

@@ -244,3 +225,3 @@ }

sec = sec || this.options.waitForTimeout;
let el = this.browser.element(guessLocator(locator) || by.css(locator));
let el = element(guessLocator(locator) || by.css(locator));
return this.browser.wait(EC.visibilityOf(el), sec * 1000);

@@ -254,3 +235,3 @@ }

sec = sec || this.options.waitForTimeout;
let el = this.browser.element(guessLocator(locator) || by.css(locator));
let el = element(guessLocator(locator) || by.css(locator));
return this.browser.wait(EC.invisibilityOf(el), sec * 1000);

@@ -273,3 +254,3 @@ }

}
let el = this.browser.element(guessLocator(context) || by.css(context));
let el = element(guessLocator(context) || by.css(context));
sec = sec || this.options.waitForTimeout;

@@ -322,2 +303,9 @@ return this.browser.wait(EC.textToBePresentInElement(el, text), sec * 1000);

}
setCookie(cookie) {
if (this.isProtractor5) {
return this.browser.manage().addCookie(cookie);
}
return super.setCookie(cookie);
}
}

@@ -324,0 +312,0 @@

@@ -66,15 +66,15 @@ /**

context.BeforeSuite = function (fn) {
suites[0].beforeAll('BeforeSuite', scenario.injected(fn));
suites[0].beforeAll('BeforeSuite', scenario.injected(fn, suites[0]));
};
context.AfterSuite = function (fn) {
suites[0].afterAll('AfterSuite', scenario.injected(fn));
suites[0].afterAll('AfterSuite', scenario.injected(fn, suites[0]));
};
context.Background = context.Before = function (fn) {
suites[0].beforeEach('Before', scenario.injected(fn));
suites[0].beforeEach('Before', scenario.injected(fn, suites[0]));
};
context.After = function (fn) {
suites[0].afterEach('After', scenario.injected(fn));
suites[0].afterEach('After', scenario.injected(fn, suites[0]));
};

@@ -81,0 +81,0 @@

@@ -9,9 +9,13 @@ 'use strict';

event.dispatcher.on(event.test.failed, function (test) {
failedTests.push(test.fullTitle());
event.dispatcher.on(event.test.failed, function (testOrSuite) {
// NOTE When an error happens in one of the hooks (BeforeAll/BeforeEach...) the event object
// is a suite and not a test
failedTests.push(testOrSuite.fullTitle());
});
// if test was successful after retries
event.dispatcher.on(event.test.passed, function (test) {
failedTests = failedTests.filter((failed) => test.fullTitle() !== failed);
event.dispatcher.on(event.test.passed, function (testOrSuite) {
// NOTE When an error happens in one of the hooks (BeforeAll/BeforeEach...) the event object
// is a suite and not a test
failedTests = failedTests.filter((failed) => testOrSuite.fullTitle() !== failed);
});

@@ -18,0 +22,0 @@

@@ -74,3 +74,3 @@ 'use strict';

*/
module.exports.injected = function (fn) {
module.exports.injected = function (fn, suite) {
return function () {

@@ -83,3 +83,3 @@ try {

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

@@ -86,0 +86,0 @@ });

{
"name": "codeceptjs",
"version": "0.4.16",
"version": "0.5.0",
"description": "Modern Era Aceptance Testing Framework for NodeJS",

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

"nightmare-upload": "^0.1.1",
"protractor": "^4.0.0",
"protractor": ">4.0.9 <6.0",
"selenium-webdriver": "^2.53.1",

@@ -62,0 +62,0 @@ "sinon": "^1.17.2",

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