Last active
December 8, 2015 13:00
-
-
Save BeyondEvil/18c08869c31a1ef99eed to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import pytest | |
from tools import TestDataCollection | |
from representations import Project | |
@pytest.fixture(scope='function') | |
def test_driver(request, selenium): | |
from test_automation.tools.test_driver import TestDriver | |
return TestDriver(selenium) | |
@pytest.fixture(scope='module') | |
def test_db(request): | |
tdc = TestDataCollection() | |
request.addfinalizer(tdc.clear) | |
return tdc | |
@pytest.fixture(scope='function', autouse=True) | |
def clean_test_db(request, test_db): | |
def fin(): | |
test_db.clear(request.scope) | |
request.addfinalizer(fin) | |
@pytest.fixture(scope='module') | |
def mini_universe(request, test_db): | |
project = Project.create("My Project") | |
test_db.add(project, request.scope) | |
return test_db |
This file contains hidden or 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
import pytest | |
from representations import User | |
@pytest.fixture(scope='function') | |
def local_universe(request, mini_universe): | |
user = User.create("Ronny") | |
mini_universe.add(user, request.scope) | |
return mini_universe | |
class TestBoards: | |
def test_register_user(self, mini_universe, test_driver): | |
page = LoginPage(test_driver) | |
page.register_user("User Name", mini_universe.get('Project', 'My Project')) | |
assert "User Name" in page.get_registered_users() | |
def test_login_user(self, local_universe, test_driver): | |
page = LoginPage(test_driver) | |
page.login(local_universe.get('User', 'Ronny'), local_universe.get('Project', 'My Project')) | |
assert "Welcome {}!".format(user.name) in page.get_title() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment