Monkey: Properly support reload in farmer and driver

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
Daniel Silverstone 2019-08-02 12:24:14 +01:00
parent 095a0639d3
commit 5c9d54d05b
2 changed files with 14 additions and 2 deletions

View File

@ -299,6 +299,15 @@ def run_test_step_action_stop(ctx, step):
win.stop()
def run_test_step_action_reload(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
assert_browser(ctx)
tag = step['window']
win = ctx['windows'].get(tag)
assert win is not None
win.reload()
def run_test_step_action_sleep_ms(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
conds = step['conditions']
@ -540,6 +549,7 @@ STEP_HANDLERS = {
"window-new": run_test_step_action_window_new,
"window-close": run_test_step_action_window_close,
"navigate": run_test_step_action_navigate,
"reload": run_test_step_action_reload,
"stop": run_test_step_action_stop,
"sleep-ms": run_test_step_action_sleep_ms,
"block": run_test_step_action_block,

View File

@ -426,8 +426,10 @@ class BrowserWindow:
def stop(self):
self.browser.farmer.tell_monkey("WINDOW STOP %s" % (self.winid))
def reload(self):
self.browser.farmer.tell_monkey("WINDOW RELOAD %s" % self.winid)
def reload(self, all=False):
all = " ALL" if all else ""
self.browser.farmer.tell_monkey("WINDOW RELOAD %s%s" % (self.winid, all))
self.wait_start_loading()
def js_exec(self, src):
self.browser.farmer.tell_monkey("WINDOW EXEC WIN %s %s" % (self.winid, src))