Hello All ,
I have just started using cypress and was playing around with BDD : Scenario Outline feature.
hereby is my feature file :-
Scenario Outline: User success sign in
Given Should be able to run on <devicename>
Examples: | devicename| | iphone-6 |
And step definition is as follows:
Given(/^Should be able to run on {string}/, devicename => { viewportSize = devicename ; });
Where viewportSize is just a variable to be set as device name used within Examples.
Even though the step definition is implemented , I am getting an error stating:
cypress_runner.js:138498 Error: Step implementation missing for: Should be able to run on 'iphone-6'
Versions
Cypress version :- 3.0.1
Chrome browser version : 67
Note :- Other BDD scenarios including Scenario only are working fine. The problem is only with Scenario Outline.
It has to be Given("Should be able to run on {string}", ..)
otherwise it expects a regexp
@lgandecki - I tried your suggestion but it is still giving me same issue , hereby my updated feature file.
Feature File:
Scenario Outline: User success sign
Given Should be able to run on <devicename>
Examples:
| devicename|
| iphone-6 |
Step Definition file:
Given("Should be able to run on {string}", (devicename) => {
viewportSize = devicename ;
});
Error:
cypress_runner.js:138498 Error: Step implementation missing for: Should be able to run on 'iphone-6'
Should I create new issue to have this investigated or can we continue on this ?
further investigated and found an issue only to be with devicename , post removing this parameter I do not get step implementation error. It is something to do with the way string has to be defined in Feature file. I am using Webstorm , wondering if that is causing this issue.
Scenario Outline: User success sign
Given Should be able to run on "<devicename>"
Examples:
| devicename|
| iphone-6 |
matches step:
Given (/^Should be able to run on "(.*?)"$/, (devicename) => {
cy.log(devicename);
});
Scenario Outline: User success sign
Given Should be able to run on <devicename>
Examples:
| devicename|
| iphone-6 |
matches step:
Given (/^Should be able to run on iphone-6$/, () => {
cy.log('no string passed');
});
@haleagar - Thank you , your suggestion worked. Thanks a ton for your time and suggestion :-)
Most helpful comment
matches step:
matches step: