Error message : TypeError: Cannot read property 'execute' of undefined
after "Step Definition: features\support\step_definitions\browser_steps.js:5
Message:"
I tried the sample code in 'https://github.com/cucumber/cucumber-js/blob/master/docs/nodejs_example.md'
I have an error
OS; Windows 7
Node: 6.9.1
package used:
"devDependencies": {
"chromedriver": "^2.25.1",
"cucumber": "^1.3.1",
"selenium-webdriver": "^3.0.0"
}
command in rum : cucumber-js
other command(cucumber, cucumber.js) came out javascript error.
馃憤 getting the same issue
I spent some time trying to solve this problem and found this package:
https://www.npmjs.com/package/nightwatch-cucumber
It integrates CucumberJS with Nightwatch. If you already use Nightwatch then the package will just work after adding a few lines to the config. If not, you can try to set up Nightwatch first using its docs, they are pretty simple.
@anatoliyarkhipov Anatoliy, you mentioned "...adding a few lines to the config" in your comment, could you please share some details about that? Thanks!
features/support/world.js should read:
var webdriver = require('selenium-webdriver');
function CustomWorld() {
this.driver = new webdriver.Builder()
.forBrowser('chrome')
.build();
}
module.exports = function() {
this.World = CustomWorld;
};
I suspect the selenium-driver API might have changed since the example was written; the code above uses the example in the npm README.
@coco-gsd it's step 4 from the docs:
// nightwatch.conf.js
require('nightwatch-cucumber')({
nightwatchClientAsParameter: true,
/* other configuration options */
})
module.exports = {
...
}
module.exports
- it's your Nightwatch config, and the lines above it's what you need to add.
Hi I am trying to generate cucumber-html-reports in nightwatchJS, declared code in Afterfeatures like below code but getting an error saying reporter not find. Someone please help me resolving this ASAP
please see the hooks code and error as well:
const {client} = require('nightwatch-cucumber');
const {defineSupportCode} = require('cucumber');
registerHandler('AfterFeatures', function(features, callback) {
var options = {
theme: 'bootstrap',
jsonFile: './reports/cucumber.json',
output: './reports/',
reportSuiteAsScenarios: true,
launchReport: true,
metadata: {
"App Version":"0.3.2",
"Test Environment": "STAGING",
"Browser": "Chrome 54.0.2840.98",
"Platform": "Windows 10",
"Parallel": "Scenarios",
"Executed": "Remote"
}
};
reporter.generate(options);
callback();
VError: a handler errored, process exiting: hooks.js:38: reporter is not defined
at /Users/sowjanya/nightwatch-test-framework/node_modules/cucumber/lib/runtime/event_broadcaster.js:78:21
at next (native)
at undefined.tryCatcher (/Users/sowjanya/nightwatch-test-framework/node_modules/bluebird/js/release/util.js:16:23)
at PromiseSpawn._promiseFulfilled (/Users/sowjanya/nightwatch-test-framework/node_modules/bluebird/js/release/generators.js:97:49)
at Promise._settlePromise (/Users/sowjanya/nightwatch-test-framework/node_modules/bluebird/js/release/promise.js:574:26)
The error message says reporter is not defined
. In your code sample you have the line reporter.generate(options);
and it doesn't appear that reporter is defined.
Hi @charlierudolph .. Thanks yaar, I have done a very silly mistake, Do u have any in detail sample framework on nightwatchJS please? (I am using nightwatchJS-0.9.13, "nightwatch-cucumber": "^7.0.12", "cucumber": "2.0.0-rc.8", "cucumber-html-reporter": "^0.3.7",)
Nope. Nighwatch is a separate project and one I have never used. Please ask for that over on the nightwatch-cucumber repo.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
features/support/world.js should read:
I suspect the selenium-driver API might have changed since the example was written; the code above uses the example in the npm README.