Closed osmolyar closed 6 years ago
The matching is done on the regular expression only, without any reference to the number of arguments that the step definition method take.
It is not a bug in wdio-cucumber-framework. You may ask in cucumber-js repo for additional explanation.
It appears that with wdio-cucumber-framework, it is not possible to create overloaded step definitions, such that one step definition expects a 'table' argument, and one does not.
Eg, we cannot for example define a step to use only default input options vs. one that takes data from a table as seen below. If both of the below steps are defined, a runtime error saying the step definitions are ambiguous occurs.
Instead, I would expect it to be able to resolve to the correct step definition depending on whether a data table is present following the step in the feature file.
`When(/^I create a user:$/, function () { options.login = GenericUtilities.addTimestamp(options.login); context.editUserPage=context.usersPage.createNewUser(options,context.userValidationOptions); });
vs.
When(/^I create a user:$/, function (table) { var myData=table.rowsHash(); options=context.userBusinessOptions=myData; if(options.login != '') { options.login = GenericUtilities.addTimestamp(options.login); } context.editUserPage=context.usersPage.createNewUser(options,context.userValidationOptions); }); `