90poe / vscode-cy-helper

VS Code IDE Extension for Cypress.io

Home Page:https://marketplace.visualstudio.com/items?itemName=Shelex.vscode-cy-helper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I always get error when I try to use the plugin, by clicking "Cypress: Step Definition All References" from editor menu

avaiyarasi opened this issue · comments

Describe the bug
I always get the following error when I try to use the plugin, by clicking "Cypress: Step Definition All References" from editor menu: Not found usage for step: "undefined"

To Reproduce
Steps to reproduce the behavior:

  1. Open file with commands usage
  2. Select command 'Cypress: Step Definition All References' from menu
  3. See error: Not found usage for step: "undefined"

Expected behavior
It should take me to the feature file associated with the step definition

Environment (please complete the following information):

  • Extension version: 0.5.2
  • VS Code version: 1.45
  • OS: Mac

** Developer Tools Console Output **

Hello @avaiyarasi !
Thank you for posting an issue.

Could you please provide text on line from which you are calling references? As for now it uses regex to find step definition name inside quotes, double quotes or backsticks.
Another reason may be if you have step definitions described with regex - this option is not supported yet.

So based on your response I would be able to check if there is case where regex mathing not worked or add support for regex step definitions.

@avaiyarasi Just published extension version 0.6.0 with better regex steps detection. Could you please check if it solves your case?

commented

Hi @Shelex , here is the text from which I am calling the references:

Given(/The user lauches the url/, () => { cy.visit("/") })

I have installed the latest version of the plugin, I still get the same error. As you said, it works if I use single quotes, double quotes or backsticks. So I think it doesn't support the regex. Is it possible to provide support for regex as well?
Thank you in advance .

Hi @Shelex , here is the text from which I am calling the references:

Given(/The user lauches the url/, () => { cy.visit("/") })

I have installed the latest version of the plugin, I still get the same error. As you said, it works if I use single quotes, double quotes or backsticks. So I think it doesn't support the regex. Is it possible to provide support for regex as well?
Thank you in advance .

Thank you for information.
There is a reason why regexp steps in extension are recognized only with anchors ^ and $.
When in future you want to add step with text "The user lauches the url for page2", it will consume a lot of time to debug "why my new step is not executed".
In case you are using regex matching string without anchors for sort of flexibility - sure, this logic could be changed.

commented

Thank you @Shelex . I think I can use the regex steps with ^ and $. So this is resolved now. You can close this.