Created
April 4, 2017 21:49
-
-
Save jrbenny35/08b97c261d00bd078282072df20c85fa to your computer and use it in GitHub Desktop.
Test of dynamic fixture loading based on pytest_base_url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.fixture(scope='function') | |
def my_base_url(base_url, request): | |
""" | |
Base url used to start the 'live_server'. | |
:returns: Base Url or live_server url. | |
""" | |
if base_url or 'PYTEST_BASE_URL' in os.environ: | |
return base_url or os.environ.get('PYTEST_BASE_URL') | |
else: | |
return request.getfixturevalue("live_server").url | |
@pytest.mark.nondestructive | |
def test_there_are_ten_most_popular_extensions(my_base_url, selenium, request): | |
"""Ten most popular add-ons are listed""" | |
if 'localhost' in my_base_url: | |
request.getfuncargvalue("initial_data") | |
page = Home(selenium, my_base_url).open() | |
assert len(page.most_popular.extensions) == 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment