Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
Leo Li
I tried and it won't let me
Hello everyone, I can't seem to access the attach property of this in the After hook. I verified that I'm not using arrow function. I don't have any error until my program actually gets to the specific line and print "this.attach is not a function" can someone help me ?
what is the best practive to setup setWorldConstructor?
actually where? because if I try to set this with protractor onPrepare, it fails with Cannot set property 'World' of undefined
and if im using the mocha before all hook because there is no such hook in cucumber can i access the file path of the current test I see i can only access the title ?
Andrey Melnichenko
Hi everyone, can anyone help me to setup CustomWorld in my project here(https://github.com/AndreyMelnichenko/wdio-cucumber)? I can't reload default World object, project stack: WDIO5+Cucumber+TS.
is it support cucumber html report with WDIO5 ?
Zhaopeng XUAN
Hey team, any idea about cucumber/cucumber-js#1288
@PlaxoGhouse yes
can anyone able to explain how i can implement 'http://mklabs.github.io/mocha-gherkin/‘ this ?
George Aristy
I'm trying to use cucumber within headless chrome, running my tests with karma.
I get this error while setting my custom world:
  TypeError: Cannot set property 'World' of undefined
      at setWorldConstructor (node_modules/cucumber/dist/cucumber.js:79569:29)
I browse to that line and I don't see where the options is set on _this?
  function SupportCodeLibraryBuilder() {
    var _this = this;

    _classCallCheck(this, SupportCodeLibraryBuilder);

    this.methods = {
      defineParameterType: this.defineParameterType.bind(this),
      After: this.defineTestCaseHook('afterTestCaseHookDefinitions'),
      AfterAll: this.defineTestRunHook('afterTestRunHookDefinitions'),
      Before: this.defineTestCaseHook('beforeTestCaseHookDefinitions'),
      BeforeAll: this.defineTestRunHook('beforeTestRunHookDefinitions'),
      defineStep: this.defineStep.bind(this),
      defineSupportCode: _util.default.deprecate(function (fn) {
      }, 'cucumber: defineSupportCode is deprecated. Please require/import the individual methods instead.'),
      setDefaultTimeout: function setDefaultTimeout(milliseconds) {
        _this.options.defaultTimeout = milliseconds;
      setDefinitionFunctionWrapper: function setDefinitionFunctionWrapper(fn) {
        _this.options.definitionFunctionWrapper = fn;
      setWorldConstructor: function setWorldConstructor(fn) {
        _this.options.World = fn;                                                                 // ERROR ON THIS LINE
    this.methods.Given = this.methods.When = this.methods.Then = this.methods.defineStep;
George Aristy
Ok - think I found where this.options is supposed to be set
George Aristy
Has anyone managed to make cucumber work with karma?
Hi Anyone - Wondering if any one can help with cucumber hooks
I need hooks defined globally once, rather then part of every steps
At the moment it works when its part of step file
After((scenario) => {
const path = './errorShots/'+Date.now()+'.png';
if(scenario.result.status === 'failed'){
console.log('Screenshot location:', path);
console.log('Scenario '+ scenario.pickle.name +' '+ scenario.result.status)
does anyone have an example of cucumber.js version 6 used with selenium webdriver? I tried to look this up on online unfortunately didn't get any examples.

.\node_modules.bin\cucumber-js features\POC.feature --require features*\.js


1) Scenario: POC # features\POC.feature:3
? Given The application is launched
Undefined. Implement with the following snippet:

     Given('The application is launched', function () {
       // Write code here that turns the phrase above into concrete actions
       return 'pending';

1 scenario (1 undefined)
1 step (1 undefined)

I am not sure how to make cucumber read the step definitions
Miguel A. Alonso
Hi @venkatrao-rgare . I suggest you try https://webdriver.io. You will find it quite useful, and some interesting starting up guides.
Also supports cucumberjs, and you have there some boilerplate projects: https://webdriver.io/docs/boilerplate.html
Andrew Stewart Gibson
I'm sure this is a RTFM thing, but I'm struggling to find a description of how to test ES6 modules with cucumber
Andrew Stewart Gibson
I think the problem is that cucumber uses "require" to pull in my step definitions, so I can't then use "import" to pull in the modules?
You can use the import, installing the babel dependency worked for me
Hello, Any one can help me, i need to know how share information between steps, I watch the documentation (World) it doesn't help (Im new in js)

Hi, I am using cucumberjs and trying to run hooks in order, however it always runs in the order functions are mentioned in the file rather than order mentioned.

Before({ tags: '@test2', order:2}, function() {
console.log("Test 2");

Before({ tags: '@test0', order:0}, function() {
console.log("Test 0");

Before({ tags: '@test1', order:1}, function() {
console.log("Test 1");

So output is
Test 2
Test 0
Test 1

But not
Test 0
Test 1
Test 2

Any help please?

@here Do we have any duplicate step checker for javascript + webdriver IO + cucumber ?
@here is there is option to repeate like 2 releated steps in scenario etc When type something , Then take snapshot for like 10 times ?
Examples seems to be working for one step or whole scenario
Abhinaba Ghosh
@here I am using protractor-cucumber. Is there a way to re-run all the failed scenarios for a number of time using cucumberOpts?
Hi All, Is there a way to specify multiple formats via the cucumber-js cli? For example --format pretty, json:reports/report.json?
I'm having an issue where the summary report is taking too long to generate is there a way to disable it?
Hi. Could you tell me please about the cypress-cucumber-html-report. Why do not the Skipped and Pending display tests in the report? The skipped and passed autotests are displayed like Failed
Hi, Could anyone let me know why 'TypeError: Cannot set property 'World' of undefined' error would happen?
Thomas G Henry
@a22183nj fwiw, I was just wondering this myself.
import { setWorldConstructor } from "cucumber";

class CustomWorld {
  constructor() {
    this.cwd = process.cwd();

TypeError: Arguments to path.resolve must be strings

    at Object.exports.resolve (http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:78415:13)
    at Object.exports.relative (http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:78476:18)
    at getDefinitionLineAndUri (http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:26986:27)
    at buildStepDefinitionConfig (http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:26926:7)
    at SupportCodeLibraryBuilder.defineStep (http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:27112:79)
    at Object.25.../screens.json (http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:1742:20)
    at o (http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:1:265)
    at http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:1:316
    at Suite.<anonymous> (http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:52:1)
    at Object.1./Users/thomasghenry/code/.../cypress/support/step_definitions/cypress/integration/examples/actions.spec.js (http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:29:3)
    at o (http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:1:265)
    at r (http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:1:431)
    at http://localhost:63862/__cypress/tests?p=cypress/integration/testrail/login/login.feature-179:1:460
Thomas G Henry
oops. got distracted and pasted the wrong thing, but while investigating what I pasted, I ended up seeing what you're seeing also.
Thomas G Henry
Uncaught TypeError: Cannot set property 'World' of undefined
    at setWorldConstructor (http://localhost:64786/__cypress/tests?p=cypress/integration/testrail/login/login.feature-742:27066:28)
    at Object.<anonymous> (http://localhost:64786/__cypress/tests?p=cypress/integration/testrail/login/login.feature-742:1732:35)
    at Object.25./Users/thomasghenry/code/duke/tams/tams-react/node_modules/@cypress/browserify-preprocessor/node_modules/@babel/runtime/helpers/classCallCheck (http://localhost:64786/__cypress/tests?p=cypress/integration/testrail/login/login.feature-742:1761:4)
    at o (http://localhost:64786/__cypress/tests?p=cypress/integration/testrail/login/login.feature-742:1:265)
    at http://localhost:64786/__cypress/tests?p=cypress/integration/testrail/login/login.feature-742:1:316
    at Suite.<anonymous> (http://localhost:64786/__cypress/tests?p=cypress/integration/testrail/login/login.feature-742:52:1)
    at Object.1./Users/thomasghenry/code/duke/tams/tams-react/cypress/support/step_definitions/cypress/integration/examples/actions.spec.js (http://localhost:64786/__cypress/tests?p=cypress/integration/testrail/login/login.feature-742:29:3)
    at o (http://localhost:64786/__cypress/tests?p=cypress/integration/testrail/login/login.feature-742:1:265)
    at r (http://localhost:64786/__cypress/tests?p=cypress/integration/testrail/login/login.feature-742:1:431)
    at http://localhost:64786/__cypress/tests?p=cypress/integration/testrail/login/login.feature-742:1:460
Thomas G Henry
@a22183nj are you using picklejs?
@ThomasGHenry no, just cucumberjs
Abhinaba Ghosh

Hey @channel, I know running a single cucumber scenario gives you so much trouble in VSCode- you need to tag a scenario specifically and then call that tag explicitly from CLI. Very troublesome, right?
What if, you could just right-click a scenario and execute that? What if you just run a whole feature file just by clicking a button? Sounds good, right.

I have published a beta version of that dream just now. I hope you will play with it and help me enhance it by finding bugs.

Here it is: https://marketplace.visualstudio.com/items?itemName=AbhinabaGhosh.cucumberquick

does anyone have cucumber.js report report working when the test fails.
I am using the test script as follows in package json
"test" : "node_modules/.bin/cucumber-js --world-parameters "{\"POB\": \"1\", \"ENV\": \"UAT\"}" features/Smoke.feature --require features/*/.js --require-module @babel/register --require-module @babel/polyfill -f json:out.json -f progress --tags @test--unhandled-rejections=strict && node index.js"
It generate the report when test passes but it doesn't generate the report when the test fails.
node index.js at the end of the script since I am following this, https://www.npmjs.com/package/cucumber-html-reporter. I want to try calling node index.js from afterall but I don't know how to do that yet
Can someone help me here please?
Per-Bjørnar Iversen
hi. anyone knows how to automatically generate step definitions from feature files? I know how to do it in intellij / mvn, but not javascript / vs code