spyoungtech / behave-webdriver

Selenium webdriver step library for use with the behave BDD testing framework
MIT License
62 stars 21 forks source link

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

Open mbt-eric-b opened 1 year ago

mbt-eric-b commented 1 year ago

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.

spyoungtech commented 1 year ago

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.

mbt-eric-b commented 1 year ago

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