diff options
author | Vincent Sanders <vince@kyllikki.org> | 2020-03-19 20:57:37 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2020-03-23 17:40:53 +0000 |
commit | 19dded8cfa7a7772d5a6ece3e5b975c142e85456 (patch) | |
tree | 2078e14af6c96987e8cc6eddbaf9708ff8d3ac60 /test/monkey_driver.py | |
parent | 4cbdcc4aae940065d027157c1bce2dbfc7d59c3b (diff) | |
download | netsurf-19dded8cfa7a7772d5a6ece3e5b975c142e85456.tar.gz netsurf-19dded8cfa7a7772d5a6ece3e5b975c142e85456.tar.bz2 |
add ability for monkey farmer to launch browser with environment variables set
Diffstat (limited to 'test/monkey_driver.py')
-rwxr-xr-x | test/monkey_driver.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/monkey_driver.py b/test/monkey_driver.py index 0a9e29abc..a0f4f368f 100755 --- a/test/monkey_driver.py +++ b/test/monkey_driver.py @@ -22,6 +22,7 @@ runs tests in monkey as defined in a yaml file # pylint: disable=locally-disabled, missing-docstring +import os import sys import getopt import time @@ -232,18 +233,35 @@ def conds_met(ctx, conds): def run_test_step_action_launch(ctx, step): print(get_indent(ctx) + "Action: " + step["action"]) + + # ensure browser is not already launched assert ctx.get('browser') is None assert ctx.get('windows') is None + + # build command line switches list monkey_cmd = [ctx["monkey"]] for option in step.get('launch-options', []): monkey_cmd.append("--{}".format(option)) print(get_indent(ctx) + " " + "Command line: " + repr(monkey_cmd)) + + # build command environment + monkey_env = os.environ.copy() + for envkey, envvalue in step.get('environment', {}).items(): + monkey_env[envkey] = envvalue + print(get_indent(ctx) + " " + envkey + "=" + envvalue) + if 'language' in step.keys(): + monkey_env['LANGUAGE'] = step['language'] + + # create browser object ctx['browser'] = DriverBrowser( monkey_cmd=monkey_cmd, + monkey_env=monkey_env, quiet=True, wrapper=ctx.get("wrapper")) assert_browser(ctx) ctx['windows'] = dict() + + # set user options for option in step.get('options', []): print(get_indent(ctx) + " " + option) ctx['browser'].pass_options(option) |