0
// signin.test.js
...
this.Then(/^I should be redirected to my dashboard$/, function() {
  var self = this;
  return this.browser
    .getUrl().then(function(eUrl) {
      eUrl.should.be.equal(self.url);
    })
    .end();
});
...

And this is the exactly same step for sign-up feature.

// signup.test.js
...
this.Then(/^I should be redirected to my dashboard$/, function() {
  var self = this;
  return this.browser
    .getUrl().then(function(eUrl) {
      eUrl.should.be.equal(self.url);
    })
    .end();
});
...

Running the test, I got this error for sign-in feature:

enter image description here

However, the test will run properly if I

  • Option 1: comment out the above js part of signin.test.js or signup.test.js.
  • Option 2: change the description to another text to make them different, e.g I should be redirected to my dashboard 12345.

Is that a bug of cucumberjs?

Is there anyway to workaround this problem.

haotang
  • 5,520
  • 35
  • 46

1 Answers1

0

Are you certain that the error is indicating an undefined step definition? It seems more likely to me that it's reporting an ambiguous step definition. As of v0.9.0, ambiguous step definitions are no longer allowed:

0.9.0

Breaking changes

* catch ambiguous step definitions (Charlie Rudolph)
* remove use of domain (Charlie Rudolph)

In any case, implementing identical blocks of code is a bad practice that you should try to avoid. See the DRY Principle. I would suggest you take Option 1 and delete the duplicate step definition entirely.

Nathan Thompson
  • 2,354
  • 1
  • 23
  • 28