This is how I would write a SeleniumBase/pytest-bdd test:
ddg.feature:
Feature: Browse DuckDuckGo
Going to DuckDuckGo webpage.
Scenario: I can see the title
When I go to DuckDuckGo webpage
Then Duck is present in the title
test_ddg.py:
from seleniumbase import BaseCase
from pytest_bdd import scenarios, when, then
scenarios("./ddg.feature")
class MyTestClass(BaseCase):
@when("I go to DuckDuckGo webpage")
def go_to_ddg(self):
self.open('https://duckduckgo.com/')
@then("Duck is present in the title")
def is_title_present(self):
assert 'Duck' in self.get_title()
However, this is not working. scenarios() function cannot see the when and then descriptors.
Any idea how to make this work, if it is possible ?