I have the following Gherkin Scenario Outline:
Scenario: Links on main page
When I visit the main page
Then there is a link to "<site>" on the page
Examples:
|site |
|example.com |
|stackoverflow.com|
|nasa.gov |
and the respective test.py:
from pytest_bdd import scenario, given, when, then
@scenario("test.feature", "Links on main page")
def test_links():
pass
In my conftest.py
, I perform a login and logout at startup/teardown respectively:
@pytest.fixture(autouse=True, scope="function")
def login_management(driver, page_url, logindata):
login()
yield
logout()
However, I don't want the browser to log out and log in between checking every link - I would rather all the links were checked on one page visit. I also would prefer to keep this tabular syntax instead of writing a dozen of steps to the tune of
And there is a link to "example.com"
And there is a link to "stackoverflow.com"
And there is a link to "nasa.gov"
Is there any way to signal that for this test only, all of the scenarios in this outline should be performed without the teardown?