This instance will be upgraded to Heptapod 0.26.0rc1 on 2021-10-25 at 14:00 UTC+2 (a few minutes of down time)

Commit 81c0c65d authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

session,Heptapod: standardisation of login sequence

- the webdriver is no longer created either by the `Heptapod`
  method or by the `session` module. An expected benefit is
  to avoid webdriver process leaks in case of failed logins
- the special case of the `root` user is handled transparently by
parent c49a65be9f69
......@@ -168,17 +168,9 @@ class Heptapod:"Initializing a signed-in webdriver for user %r",
if user_name == 'root':
driver = self.new_webdriver()
# guaranteeing driver to be available for teardown
# as soon as created
session.login_as_root(driver, self, user.password)
# TODO should init webdriver from here and store it before login
# attempt as well
driver = session.make_webdriver(self, user_name, user.password)
user.webdriver = driver
return driver
# guaranteeing driver to be available for teardown as soon as created
user.webdriver = self.new_webdriver()
return session.login(user)
def wait_startup(self, first_response_timeout=INITIAL_TIMEOUT,
......@@ -101,11 +101,18 @@ def ensure_user(heptapod, name, password=None, fullname=None):
return user
def make_webdriver(heptapod, user_name, password):
start = time.time()
driver = heptapod.new_webdriver()
webdriver_wait_get(heptapod, driver, relative_uri='/users/sign_in')
sign_in_page_login(driver, heptapod, user_name, password=password)"Made signed-in webdriver for user %s in %.2f seconds",
user_name, time.time() - start)
def login(user):
"""Perform login for user.
This assumes user.webdriver is already created.
heptapod, driver, name = user.heptapod, user.webdriver,
if name == 'root':
login_as_root(driver, heptapod, user.password)
start = time.time()
webdriver_wait_get(heptapod, driver, relative_uri='/users/sign_in')
sign_in_page_login(driver, heptapod,, password=user.password)"Signed in user %s in %.2f seconds",, time.time() - start)
return driver
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