summaryrefslogtreecommitdiff
path: root/test/monkey_driver.py
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2020-05-22 09:15:27 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-05-22 09:15:27 +0100
commitee054db071170fadf4108d7b282d2e4518987d8d (patch)
tree06f652a51ab6ee670172fc230084590052b2483d /test/monkey_driver.py
parente6c666d4f432d51ff449bbd4dfd137107c9e774c (diff)
downloadnetsurf-ee054db071170fadf4108d7b282d2e4518987d8d.tar.gz
netsurf-ee054db071170fadf4108d7b282d2e4518987d8d.tar.bz2
monkey: Excise sslcert and add loading blocking support
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'test/monkey_driver.py')
-rwxr-xr-xtest/monkey_driver.py70
1 files changed, 5 insertions, 65 deletions
diff --git a/test/monkey_driver.py b/test/monkey_driver.py
index fe904d3bf..507464049 100755
--- a/test/monkey_driver.py
+++ b/test/monkey_driver.py
@@ -35,7 +35,6 @@ class DriverBrowser(Browser):
def __init__(self, *args, **kwargs):
super(DriverBrowser, self).__init__(*args, **kwargs)
self.auth = []
- self.cert = []
def add_auth(self, url, realm, username, password):
self.auth.append((url, realm, username, password))
@@ -87,46 +86,6 @@ class DriverBrowser(Browser):
print("401: No candidate found, cancelling login box")
logwin.destroy()
- def add_cert(self, url):
- # add sll certificate error exception
- self.cert.append(url)
-
- def remove_cert(self, url):
- keep = []
-
- def matches(first, second):
- if first is None or second is None:
- return True
- return first == second
-
- for iurl in self.cert:
- if not matches(url, iurl):
- keep.append(iurl)
- self.cert = keep
-
- def handle_ready_sslcert(self, cwin):
-
- def matches(first, second):
- if first is None or second is None:
- return True
- return first == second
-
- candidates = []
- for url in self.cert:
- score = 0
- if matches(url, cwin.url):
- score += 1
- if score > 0:
- candidates.append((score, url))
- if candidates:
- candidates.sort()
- (score, url) = candidates[-1]
- print("SSLCert: Found candidate {} with score {}".format(url, score))
- cwin.go()
- else:
- print("SSLCert: No candidate found, cancelling sslcert box")
- cwin.destroy()
-
def print_usage():
print('Usage:')
@@ -212,19 +171,19 @@ def conds_met(ctx, conds):
elif 'window' in cond.keys():
status = cond['status']
window = cond['window']
- assert status == "complete" # TODO: Add more status support?
+ assert status == "complete" or status == "loading" # TODO: Add more status support?
if window == "*all*":
# all windows must be not throbbing
throbbing = False
for win in ctx['windows'].items():
if win[1].throbbing:
throbbing = True
- if not throbbing:
- return True
+ # throbbing and want loading => true
+ # not throbbing and want complete => true
+ return (status == "loading") == throbbing
else:
win = ctx['windows'][window]
- if win.throbbing is False:
- return True
+ return win.throbbing == (status == "loading")
else:
raise AssertionError("Unknown condition: {}".format(repr(cond)))
@@ -576,23 +535,6 @@ def run_test_step_action_remove_auth(ctx, step):
step.get("username"), step.get("password"))
-def run_test_step_action_add_cert(ctx, step):
- print(get_indent(ctx) + "Action:" + step["action"])
- assert_browser(ctx)
- browser = ctx['browser']
- browser.add_cert(step.get("url"))
-
-
-def run_test_step_action_remove_cert(ctx, step):
-
- # pylint: disable=locally-disabled, invalid-name
-
- print(get_indent(ctx) + "Action:" + step["action"])
- assert_browser(ctx)
- browser = ctx['browser']
- browser.remove_cert(step.get("url"))
-
-
def run_test_step_action_clear_log(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
assert_browser(ctx)
@@ -666,8 +608,6 @@ STEP_HANDLERS = {
"wait-loading": run_test_step_action_wait_loading,
"add-auth": run_test_step_action_add_auth,
"remove-auth": run_test_step_action_remove_auth,
- "add-cert": run_test_step_action_add_cert,
- "remove-cert": run_test_step_action_remove_cert,
"clear-log": run_test_step_action_clear_log,
"wait-log": run_test_step_action_wait_log,
"js-exec": run_test_step_action_js_exec,