Socket
Socket
Sign inDemoInstall

protractor-cucumber-framework

Package Overview
Dependencies
Maintainers
3
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protractor-cucumber-framework - npm Package Compare versions

Comparing version 4.2.0 to 5.0.0-beta.0

84

lib/resultsCapturer.js

@@ -5,2 +5,7 @@ let state = require('./runState');

let Cucumber = cucumberLoader.load();
let AfterEach;
let gherkinDocuments = {};
let scenarioStepResults = [];
let scenarioFailed = false;
let stepResults = buildStepResults();

@@ -18,3 +23,8 @@ switch (cucumberVersion) {

case 3:
Cucumber.defineSupportCode(({After}) => (AfterEach = After));
module.exports = eventListeners;
break;
case 4:
AfterEach = Cucumber.After;
module.exports = eventListeners;

@@ -27,6 +37,17 @@ break;

let gherkinDocuments = {};
let scenarioFailed = false;
let stepResults = buildStepResults();
AfterEach &&
AfterEach(() => {
if (state.runner.afterEach) {
return state.runner.afterEach().then(emitScenarioResults);
} else {
emitScenarioResults();
}
});
function emitScenarioResults() {
scenarioStepResults.forEach(([event, details]) => {
state.runner.emit(event, details);
});
}
function registerHandlers() {

@@ -46,11 +67,2 @@ this.registerHandler('BeforeFeatures', setup);

function setup() {
/*
* Kind of strange to have to call this in setup, but all scenarios fail up
* until it is called when `restartBrowserBetweenTests` is used. Protractor
* is setting some internal runner state that is affecting this.
*
* https://github.com/angular/protractor/commit/23bc943a8a65bf4abab10197c5d3545189785b9a
*
*/
if (state.runner.afterEach) state.runner.afterEach();
state.results.failedCount = 0;

@@ -73,5 +85,7 @@ state.results.specResults = [];

);
if (scenario) {
return scenario;
}
const outlines = children.filter(child => child.type === 'ScenarioOutline');

@@ -83,5 +97,3 @@ return findOutlineScenario(outlines, location);

return outlines
.map(child => {
return createScenarioFromOutline(child, location);
})
.map(child => createScenarioFromOutline(child, location))
.find(outline => !!outline);

@@ -92,14 +104,11 @@ }

const foundExample = outline.examples.find(example => {
const foundRow = example.tableBody.find(row => {
return row.location.line === location.line;
});
if (!foundRow) {
return null;
}
return true;
const foundRow = example.tableBody.find(
row => row.location.line === location.line
);
return !!foundRow;
});
if (!foundExample) {
return null;
}
if (!foundExample) return null;
return createScenarioFromOutlineExample(outline, foundExample, location);

@@ -109,8 +118,8 @@ }

function createScenarioFromOutlineExample(outline, example, location) {
const found = example.tableBody.find(row => {
return row.location.line === location.line;
});
if (!found) {
return null;
}
const found = example.tableBody.find(
row => row.location.line === location.line
);
if (!found) return null;
return {

@@ -127,2 +136,3 @@ type: 'Scenario',

const modified = Object.assign({}, step);
header.cells.forEach((varable, index) => {

@@ -134,2 +144,3 @@ modified.text = modified.text.replace(

});
return modified;

@@ -153,3 +164,2 @@ });

scenarioFailed = false;
if (state.runner.afterEach) return state.runner.afterEach();
}

@@ -275,6 +285,14 @@

stepResults.events.push(Object.assign({emitterEvent}, eventDetails));
state.runner.emit(emitterEvent, eventDetails);
notifyProtractorOfStepResult(emitterEvent, eventDetails);
}
}
function notifyProtractorOfStepResult(event, details) {
if (AfterEach) {
scenarioStepResults.push([event, details]);
} else {
state.runner.emit(event, details);
}
}
function buildStepResults() {

@@ -281,0 +299,0 @@ return {

{
"name": "protractor-cucumber-framework",
"version": "4.2.0",
"version": "5.0.0-beta.0",
"description": "Protractor framework for Cucumber.js",

@@ -83,4 +83,4 @@ "main": "index.js",

"version2": "2.3.1",
"version3": "3.0.6",
"version4": "4.0.0"
"version3": "3.2.0",
"version4": "4.1.0"
},

@@ -87,0 +87,0 @@ "prettier": {

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