alexkrechik / VSCucumberAutoComplete

Cucumber (Gherkin) Full Support Extension for VSCode
https://marketplace.visualstudio.com/items?itemName=alexkrechik.cucumberautocomplete
MIT License
331 stars 82 forks source link

Was unable to find step for ... #317

Closed mi5ha closed 4 years ago

mi5ha commented 4 years ago

Describe the bug It can not find any of my step definitions.

I have these files:

features/01 Example.feature features-steps/example.ts

Screenshots

Screen Shot 2020-02-03 at 3 52 26 PM

Cucumberautocomplete part of VSCode settings:

{
    "cucumberautocomplete.steps": [
        "features-steps/*.ts"
    ],
    "cucumberautocomplete.syncfeatures": "features/*feature",
    "cucumberautocomplete.strictGherkinCompletion": true,
    "editor.quickSuggestions": {
        "comments": false,
        "strings": true,
        "other": true
    },
}

Step definition:

import { Given, When, Then } from "cucumber";
import expect from "expect";

// IMPORTED FROM THE APP
function addToBalance(balance: number, amount: number) {
    return balance + amount;
}

// TEST DATA
let bankAccountBalance = 100;
let amountToDeposit = 100;

// STEPS
Given("A bank account with starting balance of $100", function () {
    expect(bankAccountBalance === 100).toBeTruthy();
});

When('$100 is deposited', function () {
    expect(amountToDeposit === 100).toBeTruthy();
    // return 'pending';
});

Then('The bank account balance should be $200', function () {
    expect(addToBalance(bankAccountBalance, amountToDeposit)).toBeTruthy();
});
alexkrechik commented 4 years ago

Did you try any step without '$' symbol?

mi5ha commented 4 years ago

That was the problem, thank you! So any RE special character would produce this problem?

alexkrechik commented 4 years ago

You can try to escape such chars like:

"cucumberautocomplete.customParameters": [
        {
            "parameter":"$",
            "value":"\\$"
        }
    ]
mi5ha commented 4 years ago

Works but with that I turn of $ as RE character right?

alexkrechik commented 4 years ago

Right, but do you have any '$' regex symbol in your steps? How cucumber determine, that $ in 100$ is not 'regex end' character?

mi5ha commented 4 years ago

Yeah I see the conundrum... But I can always escape $ in step pattern so all good.

There is just one more thing I dont understand.

When step definition is {int} is deposited

In autocomplete I get: -?\d+ is deposited

What is -? for? \d+ is RE I guess.

It would be better if I got {int} selected as placeholder maybe?

alexkrechik commented 4 years ago

-?\d+ - is a regex part, which should exec integer, like '1120' or '-12'

spjagadeesh commented 4 years ago

Describe the bug: Curly lines are displayed in the feature file even when step definitions are available and properly mentioned in the settings.json file Go to step definitions and Peek Step definitions options aren't displayed Note: I'm literally unable to get help from anywhere apart from creating an bug.

Expected behavior: User should be displayed Curly lines only for steps which doesn't have step definitions and user should be able to Go to step definitions from feature files

Settings.json file:

{
    "cucumberautocomplete.steps": ["stepDefinitions/*.ts"],
    "cucumberautocomplete.syncfeatures": "featureFiles/*feature",
    "cucumberautocomplete.strictGherkinCompletion": true,
    "cucumberautocomplete.strictGherkinValidation": true,
    "cucumberautocomplete.smartSnippets": true,
    "cucumberautocomplete.stepsInvariants": true,
    "workbench.iconTheme": "vscode-icons",
    "files.autoSave": "afterDelay",
    "cucumberautocomplete.customParameters": [

    ]
}

Project structure:

-PROJECT NAME
  -featureFiles
    -features1.feature
    -features1.feature
  -stepDefinitions
    -stepDefintions_1.ts
    -stepDefintions_2.ts
    -stepDefintions_3.ts
  -pageObjects
  -logs
  -configFiles
  -commonUtlities
  -node_modules
  -reports
  -package.json
  -ts-config.json
alexkrechik commented 4 years ago

Describe the bug: Curly lines are displayed in the feature file even when step definitions are available and properly mentioned in the settings.json file Go to step definitions and Peek Step definitions options aren't displayed Note: I'm literally unable to get help from anywhere apart from creating an bug.

Expected behavior: User should be displayed Curly lines only for steps which doesn't have step definitions and user should be able to Go to step definitions from feature files

Settings.json file:

{
    "cucumberautocomplete.steps": ["stepDefinitions/*.ts"],
    "cucumberautocomplete.syncfeatures": "featureFiles/*feature",
    "cucumberautocomplete.strictGherkinCompletion": true,
    "cucumberautocomplete.strictGherkinValidation": true,
    "cucumberautocomplete.smartSnippets": true,
    "cucumberautocomplete.stepsInvariants": true,
    "workbench.iconTheme": "vscode-icons",
    "files.autoSave": "afterDelay",
    "cucumberautocomplete.customParameters": [

    ]
}

Project structure:

-PROJECT NAME
  -featureFiles
    -features1.feature
    -features1.feature
  -stepDefinitions
    -stepDefintions_1.ts
    -stepDefintions_2.ts
    -stepDefintions_3.ts
  -pageObjects
  -logs
  -configFiles
  -commonUtlities
  -node_modules
  -reports
  -package.json
  -ts-config.json

Could you please create a separate issue for this if it still valid?

alexkrechik commented 4 years ago

Closed due to looks like, that original issue was fixed.