diff --git a/test/monkey-tests/inserted-script.yaml b/test/monkey-tests/inserted-script.yaml index b2f8fbf64..ac7bb0f7f 100644 --- a/test/monkey-tests/inserted-script.yaml +++ b/test/monkey-tests/inserted-script.yaml @@ -10,7 +10,14 @@ steps: window: win1 - action: navigate window: win1 - url: file:///home/dsilvers/dev-netsurf/workspace/netsurf/test/js/inserted-script.html + url: about:blank +- action: block + conditions: + - window: win1 + status: complete +- action: js-exec + window: win1 + cmd: location.assign("file:///home/dsilvers/dev-netsurf/workspace/netsurf/test/js/inserted-script.html") - action: block conditions: - window: win1 diff --git a/test/monkey_driver.py b/test/monkey_driver.py index 9f33160fe..c39d5e6a9 100755 --- a/test/monkey_driver.py +++ b/test/monkey_driver.py @@ -315,6 +315,18 @@ def run_test_step_action_wait_log(ctx, step): win.wait_for_log(source=source, foldable=foldable, level=level, substr=substr) +def run_test_step_action_js_exec(ctx, step): + print(get_indent(ctx) + "Action: " + step["action"]) + assert_browser(ctx) + browser = ctx['browser'] + tag = step['window'] + cmd = step['cmd'] + print(get_indent(ctx) + " " + tag + " Run " + cmd) + win = ctx['windows'].get(tag) + assert(win is not None) + win.js_exec(cmd) + + def run_test_step_action_quit(ctx, step): print(get_indent(ctx) + "Action: " + step["action"]) assert_browser(ctx) @@ -338,6 +350,7 @@ step_handlers = { "remove-auth": run_test_step_action_remove_auth, "clear-log": run_test_step_action_clear_log, "wait-log": run_test_step_action_wait_log, + "js-exec": run_test_step_action_js_exec, "quit": run_test_step_action_quit, } diff --git a/test/monkeyfarmer.py b/test/monkeyfarmer.py index 6cc7ec143..0bae027a2 100644 --- a/test/monkeyfarmer.py +++ b/test/monkeyfarmer.py @@ -306,7 +306,10 @@ class BrowserWindow: def reload(self): self.browser.farmer.tell_monkey("WINDOW RELOAD %s" % self.winid) - + + def js_exec(self, src): + self.browser.farmer.tell_monkey("WINDOW EXEC WIN %s %s" % (self.winid, src)) + def handle(self, action, *args): handler = getattr(self, "handle_window_" + action, None) if handler is not None: