Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot go to behave-webdriver step declaration in PyCharm (Professional) #75

Closed
grzywin opened this issue May 16, 2019 · 6 comments · Fixed by #76
Closed

Cannot go to behave-webdriver step declaration in PyCharm (Professional) #75

grzywin opened this issue May 16, 2019 · 6 comments · Fixed by #76

Comments

@grzywin
Copy link

grzywin commented May 16, 2019

I'm using behave-webdriver as a part of my BDD Python testing framework. It works very well, although I have a problem with going to step declaration in PyCharm. It will be best to explain it through example. Let's say I want to use "When I move to element" step. First thing is that when I want to use this sentence and I use PyCharm autocomplete it is autocompleted as
When I move to element "{element}"
This sentence is not recognizable by PyCharm autocomplete. I can fix it by removing backslashes:
When I move to element "{element}"
This one IS visible by PyCharm. I can use "go to declaration".
But, when I change variable element to any other name than "element" than again "go to declaration" is not working, e.g.:
When I move to element "{some_element}"

Any other BDD sentences with an argument, which were written by me are working correctly (go to the declaration is working), e.g.: Some step with "example_parameter"

Are you familiar with this issue? I'm guessing that it might be PyCharm problem, not behave-webdriver.

@spyoungtech
Copy link
Owner

spyoungtech commented May 17, 2019

Thank you for submitting this issue @Strasznik

I was able to reproduce the issue you were having. It appears that the PyCharm module responsible for identifying steps is identifying the characters in the step definitions meant for field replacements (e.g. { and }) literally (e.g. it will try to match for literal { or } characters in the feature file). I also noticed that regex steps/syntax are also plagued by this bug.

After some investigation, I discovered this is due to PyCharm not being able to detect steps using the custom matchers that are used by behave-webdriver. When installing behave-webdriver<0.2.0 (before I used custom matchers) steps using the parse matcher are once again identified appropriately.

I'll work towards a resolution on this for the next release. This might mean removing the custom transformation matchers from the library, which may have not been as great an idea as originally thought.

@spyoungtech
Copy link
Owner

Additionally, in some places I change the matcher in the middle of the step file. Even in v0.1.0, regex matcher steps defined after parse matcher steps in the same file are not detected correctly by PyCharm either.

@spyoungtech
Copy link
Owner

@Strasznik I've managed to come up with a workaround to this problem and believe I have a working solution in the pycharm-matching-patch branch. I've done some minimal testing and this appears to fix the problem,

If you could please test and let me know. You can install from the branch with pip by the following command:

pip install git+https://github.com/spyoungtech/behave-webdriver.git@pycharm-matching-patch

@grzywin
Copy link
Author

grzywin commented May 17, 2019

Spencer,

Thank you very much for such quick action. I just installed the version from branch pycharm-matching-patch and at first glance, it seems to work as expected. Awesome job! :)

@spyoungtech
Copy link
Owner

Glad to hear it. I should have this merged and on PyPI within the next day or so.

Cheers!

@spyoungtech
Copy link
Owner

spyoungtech commented May 22, 2019

Apologies for delay in getting this out to PyPI. I'm currently tracking the deployment problem in #77

Meantime, installing from master should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants