Closed mikelietz closed 5 years ago
By default, the 'parse' matcher is in use.
Defining a generic step for this use should be as simple as the following:
@then(u'I should see "{text}"')
def expect_some_text(context, text):
assert context.behave_driver.element_contains('body', text)
The problem you're encountering with the latter two steps is that, in order to use regex matching, you'd need to change the step matcher first.
So you could define the same kind of step using the regex matcher this way
from behave import use_step_matcher
use_step_matcher('re')
@then(u'I should see "([^"]*)?"')
def step_impl(context, value):
assert context.behave_driver.element_contains('body', value)
If you change the matcher, don't forget to change it back as needed, so your other steps don't unexpectedly stop working.
For more info, you can read about this more in the behave documentation
Thank you! I wasn't sure if this was better asked there or here.
I don't think this is a bug as much as lack of coding experience. I'm porting over some very rudimentary lettuce_webdriver features and steps, and I'm struggling for a clean replacement for "I should see..."
One such feature line for this is:
Of the three definitions below, only the first one works. The latter two are not recognized and behave suggests a snippet like the first one.