Closed emily25inGoFreight closed 4 months ago
Parentheses are used for optional text in cucumber expressions, and must be escaped in order for the parentheses to be matched literally.
So example step definition above should be:
@When("the user click 'Gross Weight \(SHPR)' for box\({box_index})")
def step_impl(context, box_index):
pass
However, even if the step definition is correct, the result is still the same. Cannot jump to the step definition with 'Go to Definition'.
As a workaround, I use regular expressions for step definitions in such cases.
I have similar issue in Java:
@When("a file named {string} is created")
Was unable to find step for "When a file named 'abc' is created.
@koichirok Can you please mention how you used regex in step definitions?
I have similar issue in Java:
@When("a file named {string} is created")
Was unable to find step for "When a file named 'abc' is created.@koichirok Can you please mention how you used regex in step definitions?
In this case, maybe you should add single quote around {string}
, like @When("a file named '{string}' is created")
Parentheses are used for optional text in cucumber expressions, and must be escaped in order for the parentheses to be matched literally.
So example step definition above should be:
@When("the user click 'Gross Weight \(SHPR)' for box\({box_index})") def step_impl(context, box_index): pass
However, even if the step definition is correct, the result is still the same. Cannot jump to the step definition with 'Go to Definition'.
As a workaround, I use regular expressions for step definitions in such cases.
Since changing all test case to regular expressions may require lots of effort, my current approach is add this in settings
"cucumberautocomplete.customParameters": [
{
"parameter":"(SHPR)",
"value":"\\(SHPR\\)"
}
]
But I'm still hoping that there could be an update for this.
Parentheses are used for optional text in cucumber expressions, and must be escaped in order for the parentheses to be matched literally. So example step definition above should be:
@When("the user click 'Gross Weight \(SHPR)' for box\({box_index})") def step_impl(context, box_index): pass
However, even if the step definition is correct, the result is still the same. Cannot jump to the step definition with 'Go to Definition'. As a workaround, I use regular expressions for step definitions in such cases.
Since changing all test case to regular expressions may require lots of effort, my current approach is add this in settings
"cucumberautocomplete.customParameters": [ { "parameter":"(SHPR)", "value":"\\(SHPR\\)" } ]
But I'm still hoping that there could be an update for this.
Thanks, it worked that way, However I made a long list as the plugin was catching braces in javadoc also. And its nearly impossible to change all test cases (1000+). Hope to get a fix for this.
Like the same with https://github.com/alexkrechik/VSCucumberAutoComplete/issues/222
Should be fixed with "cucumberautocomplete.pureTextSteps": true
option using after 2.16.0 release.
This issue is to be fixed or implemented in the 3.0.0 version of the extension. If this issue is unresolved or there are additional notes, please create a new ticket with the necessary details.
Describe the bug Unable to find step def. for step containing parentheses, e.g., When the user click 'Gross Weight (SHPR)' for box(2). For situation like parentheses in braces, it's fine. But when there are only parentheses, then it won't work. Whether there are quotes does not affect the result.
To Reproduce Steps to reproduce the behavior:
Expected behavior Expected to find the step definition.
Cucumberautocomplete part of VSCode settings:
Step definition: If applicable, add example of step definition:
Gherkin step line If applicable, add step line from gherkin file
When the user click 'Gross Weight (SHPR)' for box(2)