From cfc636336464a278c10b8b2a7c12f71b73d945c7 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Mon, 9 Sep 2013 16:13:01 +0800 Subject: [PATCH] Behat option to force the download of Selenium --- extra/bash_completion | 2 +- lib/commands/behat.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/extra/bash_completion b/extra/bash_completion index 1417dd9..262a567 100644 --- a/extra/bash_completion +++ b/extra/bash_completion @@ -97,7 +97,7 @@ function _mdk() { OPTS="$(compgen -A file $CUR)" compopt -o nospace else - OPTS="--run --disable --feature --switch-completely --no-javascript --selenium --selenium-verbose --tags" + OPTS="--run --disable --feature --switch-completely --no-javascript --selenium --selenium-download --selenium-verbose --tags" OPTS="$OPTS $(_list_instances)" fi ;; diff --git a/lib/commands/behat.py b/lib/commands/behat.py index 4191f2c..7d759b4 100644 --- a/lib/commands/behat.py +++ b/lib/commands/behat.py @@ -89,6 +89,14 @@ class BehatCommand(Command): } ), ( + ['--selenium-download'], + { + 'action': 'store_true', + 'dest': 'seleniumforcedl', + 'help': 'force the download of the latest Selenium to the cache' + } + ), + ( ['--selenium-verbose'], { 'action': 'store_true', @@ -155,7 +163,7 @@ class BehatCommand(Command): seleniumPath = os.path.expanduser(os.path.join(self.C.get('dirs.mdk'), 'selenium.jar')) if args.selenium: seleniumPath = args.selenium - elif not nojavascript and not os.path.isfile(seleniumPath): + elif args.seleniumforcedl or (not nojavascript and not os.path.isfile(seleniumPath)): logging.info('Attempting to find a download for Selenium') url = urllib.urlopen('http://docs.seleniumhq.org/download/') content = url.read() @@ -166,7 +174,7 @@ class BehatCommand(Command): else: logging.warning('Could not locate Selenium server to download') - if not os.path.isfile(seleniumPath): + if not nojavascript and not os.path.isfile(seleniumPath): raise Exception('Selenium file %s does not exist') # Run cli -- 2.11.0