Closed VJose6 closed 4 years ago
any update on this please?
I have same issue ! Cant make cucumber autocomplete work ! "Was unable to find steps for ..."
@c-magri @Cubo25 could you please provide step definition, gherkin line examples, and config file? I'm unable to reproduce the original issue, so this info would help.
@alexkrechik this happens to me only when i use vscode workspace
i have a file myapp.workspace which has the following
{
"folders": [
{
"name": "E2E App",
"path": "apps/e2e"
},
{
"name": "Root App",
"path": "apps/e2e"
}],
"settings": {
"cucumberautocomplete.steps": [
"apps/e2e/src/step_definitions/*.ts"
],
"cucumberautocomplete.syncfeatures": "apps/e2e/src/features/*.feature",
"cucumberautocomplete.strictGherkinCompletion": true,
}
}
I'll also try to create a sample repo for this
After debugging your extenstion I managed to figure out what was the issue, basically the "Root App" inside the workspace need to be the first one in the folders
or else the paths will be wrong
This works:
{
"folders": [
{
"name": "Root App",
"path": "."
},
{
"name": "E2E App",
"path": "apps/e2e"
},
],
This doesn't work:
{
"folders": [
{
"name": "E2E App",
"path": "apps/e2e"
},
{
"name": "Root App",
"path": "."
},
],
@alexkrechik what might make sense is that part of the cucumberautocomplete
an optional rootDir
would be added so it would make it easier. Any thoughts?
The settings section in my workspace file was empty. When i add the cucumber extension settings there, my steps get underlined with yellow. So, unlike before, now it recognizes that step definitions are defined but is pointing to the wrong directory. Knowing how absolute location, of step definitions, is resolved in the above workspace configuration would help here. Also, not sure why the project settings was not identified in the workspace configuration. Ideally, project settings should supersede workspace setting. Not sure if it is due to the extension or the design of VSCode IDE.
After debugging your extenstion I managed to figure out what was the issue, basically the "Root App" inside the workspace need to be the first one in the
folders
or else the paths will be wrongThis works:
{ "folders": [ { "name": "Root App", "path": "." }, { "name": "E2E App", "path": "apps/e2e" }, ],
This doesn't work:
{ "folders": [ { "name": "E2E App", "path": "apps/e2e" }, { "name": "Root App", "path": "." }, ],
@alexkrechik what might make sense is that part of the
cucumberautocomplete
an optionalrootDir
would be added so it would make it easier. Any thoughts?
If the issue still valid, could you please open it as a separate ticket?
The settings section in my workspace file was empty. When i add the cucumber extension settings there, my steps get underlined with yellow. So, unlike before, now it recognizes that step definitions are defined but is pointing to the wrong directory. Knowing how absolute location, of step definitions, is resolved in the above workspace configuration would help here. Also, not sure why the project settings was not identified in the workspace configuration. Ideally, project settings should supersede workspace setting. Not sure if it is due to the extension or the design of VSCode IDE.
All the paths should be related to the project root. Please reopen this issue or comment here, if there are some problems with them.
Hopefully this may help someone but we found (by adding some debug info into the extension) that the 'root' of the docker container based workspace project in the extension was /workspaces/projectName/.vscode/
As such we had to 'go up' one level in the steps globs:
"cucumberautocomplete.steps": [
"../client/src/*.steps.ts",
"../client/src/**/*.steps.ts",
"../server/src/*.steps.ts",
"../server/src/**/*.steps.ts"
],
@alexkrechik - minor suggestion of, if no steps/feature files are found perhaps you could log the full resolved paths being used? PS Awesome plugin.
@alexkrechik Hey there. Is there any dump location for the logs? Thanks
@alexkrechik Hey there. Is there any dump location for the logs? Thanks
Looks like that no. Usually I'm using separate procedure (server attaching) to see whats happens under the hood.
@combmag
This was the fix for me. I had to switch the folder in my workspace to get it working. It is hacky, but it worked. Thank you!
This link does not work any longer: https://github.com/cucumber/cucumber-js/blob/master/docs/nodejs_example.md
Describe the bug I am unable to get autocomplete working with simple example in https://github.com/cucumber/cucumber-js/blob/master/docs/nodejs_example.md
To Reproduce Steps to reproduce the behavior:
4 scenarios (4 passed) 12 steps (12 passed) 0m00.001s
{ "cucumberautocomplete.steps": [ "features/support/.js" ], "cucumberautocomplete.syncfeatures": "features/feature", "cucumberautocomplete.strictGherkinCompletion": true, "cucumberautocomplete.strictGherkinValidation": true, "cucumberautocomplete.smartSnippets": true, "cucumberautocomplete.stepsInvariants": true, "cucumberautocomplete.pages": { "users": "test/features/page_objects/users.storage.js", "pathes": "test/features/page_objects/pathes.storage.js", "main": "test/features/support/page_objects/main.page.js" }, "cucumberautocomplete.skipDocStringsFormat": true, "cucumberautocomplete.formatConfOverride": { "And": 3, "But": "relative", }, "cucumberautocomplete.onTypeFormat": true, "editor.quickSuggestions": { "comments": false, "strings": true, "other": true }, "cucumberautocomplete.gherkinDefinitionPart": "(Given|When|Then)\(", "cucumberautocomplete.stepRegExSymbol": "'" }
// features/support/steps.js const { Given, When, Then } = require("cucumber"); const { expect } = require("chai");
Given("a variable set to {int}", function(number) { this.setTo(number); });
When("I increment the variable by {int}", function(number) { this.incrementBy(number); });
Then("the variable should contain {int}", function(number) { expect(this.variable).to.eql(number); });
// features/support/world.js const { setWorldConstructor } = require("cucumber");
class CustomWorld { constructor() { this.variable = 0; }
setTo(number) { this.variable = number; }
incrementBy(number) { this.variable += number; } }
setWorldConstructor(CustomWorld);
features/simple_math.feature
Feature: Simple maths In order to do maths As a developer I want to increment variables