Skip to content

Instantly share code, notes, and snippets.

@BeyondEvil
Last active December 8, 2015 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BeyondEvil/18c08869c31a1ef99eed to your computer and use it in GitHub Desktop.
Save BeyondEvil/18c08869c31a1ef99eed to your computer and use it in GitHub Desktop.
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
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