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

Suggestion: use @step instead of more specific decorators #98

Open
mbt-eric-b opened this issue Apr 12, 2023 · 2 comments
Open

Suggestion: use @step instead of more specific decorators #98

mbt-eric-b opened this issue Apr 12, 2023 · 2 comments
Labels
enhancement ✨ an improvement to an existing feature/asset good first issue 🐣

Comments

@mbt-eric-b
Copy link

Step definitions in expectations.py are using the decorator @then
This makes it mandatory to use the keyword Then in the scenario for these steps.
Why not simply use @step instead of @then, so that the scenario can be written with any of the keywords?

For instance:
@step('I wait on element "([^"]*)?"(?: for (\d+)ms)*(?: to( not)* (be checked|be enabled|be selected|be visible|contain a text|contain a value|exist))*')
makes it possible to write
When I wait on element "myButton" to be enabled
but also
And I wait on element "myButton" to exist
or
Then I wait on element "myButton" to exist

while the current implementation only allows the last syntax.

@mbt-eric-b mbt-eric-b changed the title Suggestion: use @step insted of more specific decorators Suggestion: use @step instead of more specific decorators Apr 12, 2023
@spyoungtech
Copy link
Owner

spyoungtech commented Apr 13, 2023

Sounds reasonable to me. I'd be happy to accept a PR to this effect.

IIRC, the steps are setup to match the webdriverIO steps but I don't think there is a problem expanding this, as far as I can tell.

@spyoungtech spyoungtech added enhancement ✨ an improvement to an existing feature/asset good first issue 🐣 labels Apr 13, 2023
mbt-eric-b added a commit to mbt-eric-b/behave-webdriver that referenced this issue Apr 17, 2023
rather than @given, @when, and @then
because those are restrincting the Gherkin keyword you might use
to Given, When, Then respectively.

@step let's you free to pick the Gherkin keyword that fits best
@mbt-eric-b
Copy link
Author

Here you go: #99
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ an improvement to an existing feature/asset good first issue 🐣
Projects
None yet
Development

No branches or pull requests

2 participants