behave-webdriver icon indicating copy to clipboard operation
behave-webdriver copied to clipboard

Suggestion: use @step instead of more specific decorators

Open mbt-eric-b opened this issue 2 years ago • 2 comments

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 avatar Apr 12 '23 09:04 mbt-eric-b

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 avatar Apr 13 '23 09:04 spyoungtech

Here you go: https://github.com/spyoungtech/behave-webdriver/pull/99 Thanks.

mbt-eric-b avatar Apr 17 '23 13:04 mbt-eric-b