summaryrefslogtreecommitdiff
path: root/tests/functional/features/environment.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-08-16 11:28:21 -0400
committerKali Kaneko <kali@leap.se>2017-08-30 16:18:46 -0400
commit6cb13e80a5e0ea1ab614d51e7ed831d6ec251306 (patch)
treed7bf94376370d35d04d9d6be01cbd17a62ac6d1c /tests/functional/features/environment.py
parente074c4bd23f4386519dae02d5687270ba294f636 (diff)
[tests] prepare to run behave against bundle
Diffstat (limited to 'tests/functional/features/environment.py')
-rw-r--r--tests/functional/features/environment.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/functional/features/environment.py b/tests/functional/features/environment.py
index ae72b496..5b179cd5 100644
--- a/tests/functional/features/environment.py
+++ b/tests/functional/features/environment.py
@@ -12,9 +12,27 @@ from leap.common.config import get_path_prefix
DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S = 10
HOME_PATH = os.path.abspath('./tmp/bitmask-test')
+VIRTUALENV = 'virtualenv'
+BUNDLE = 'bundle'
+BUNDLE_CI = 'bundle-ci'
+
+MODE = VIRTUALENV
+
+
+def set_mode(mode):
+ global MODE
+ if mode not in (VIRTUALENV, BUNDLE, BUNDLE_CI):
+ raise ValueError('Unknown test mode: %s' % mode)
+ MODE = mode
+ return mode
+
def before_all(context):
os.environ['HOME'] = HOME_PATH
+ mode = os.environ.get('TEST_MODE', 'virtualenv')
+ set_mode(mode)
+ context.mode = mode
+
_setup_webdriver(context)
userdata = context.config.userdata
context.host = userdata.get('host', 'http://localhost')
@@ -30,6 +48,16 @@ def before_all(context):
print('TEST_USERNAME or TEST_PASSWORD not set')
sys.exit(0)
+ if MODE == BUNDLE:
+ next_version = open('pkg/next-version').read().strip()
+ context.bundle_path = os.path.abspath(
+ os.path.join('dist', 'bitmask-' + next_version))
+ elif MODE == BUNDLE_CI:
+ # TODO set path to artifact XXX ---
+ context.bundle_path = None
+ else:
+ context.bundle_path = None
+
def _setup_webdriver(context):
chrome_options = Options()
@@ -45,7 +73,8 @@ def _setup_webdriver(context):
def after_all(context):
context.browser.quit()
- commands.getoutput('bitmaskctl stop')
+ if MODE == VIRTUALENV:
+ commands.getoutput('bitmaskctl stop')
def after_step(context, step):