Commit 2d261db4 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Central method to get a user webdriver

After this change, no test gets a webdriver directly
from the dict on Heptapod object, opening the road to
make webdriver initialization lazy.
parent 5f5ce18ee546
......@@ -117,6 +117,9 @@ class Heptapod:
else:
return selenium.webdriver.Chrome(options=options)
def get_user_webdriver(self, user_name):
return self.users[user_name]['webdriver']
def wait_startup(self, first_response_timeout=INITIAL_TIMEOUT,
wait_after_first_response=None):
"""Wait for Heptapod to be ready after startup.
......
......@@ -167,7 +167,7 @@ class Project(object):
@property
def owner_webdriver(self):
return self.heptapod.users[self.owner]['webdriver']
return self.heptapod.get_user_webdriver(self.owner)
@property
def url(self):
......@@ -817,7 +817,7 @@ class Project(object):
"""Create a new project with the webdriver for given user
"""
group = UserNameSpace(heptapod=heptapod, user_name=user_name)
driver = heptapod.users[user_name]['webdriver']
driver = heptapod.get_user_webdriver(user_name)
driver.get('{url}/projects/new'.format(url=heptapod.url))
cls.webdriver_new_project_submit(driver, project_name)
project = cls.api_retrieve(heptapod, user_name, group, project_name)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment