Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/1951c0f8094ab74abd1873e622a8a79f2627c7fc
...commit
http://git.netsurf-browser.org/netsurf.git/commit/1951c0f8094ab74abd1873e622a8a79f2627c7fc
...tree
http://git.netsurf-browser.org/netsurf.git/tree/1951c0f8094ab74abd1873e622a8a79f2627c7fc
The branch, master has been updated
via 1951c0f8094ab74abd1873e622a8a79f2627c7fc (commit)
via c90bd806a68a4d5e80ff985ad626e14cc8605204 (commit)
from c1dc4e61bd87abdfc120888e79c2da6bad8ce26b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=1951c0f8094ab74abd1873e622a8a79f2627c7fc
commit 1951c0f8094ab74abd1873e622a8a79f2627c7fc
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
allow repeat loops to specify values and navigation to use them
diff --git a/test/monkey_driver.py b/test/monkey_driver.py
index 03906d8..091540e 100755
--- a/test/monkey_driver.py
+++ b/test/monkey_driver.py
@@ -228,12 +228,21 @@ def run_test_step_action_window_close(ctx, step):
def run_test_step_action_navigate(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
assert_browser(ctx)
- assert(step.get('url') is not None)
+ if 'url' in step.keys():
+ url = step['url']
+ elif 'repeaturl' in step.keys():
+ repeat = ctx['repeats'].get(step['repeaturl'])
+ assert(repeat is not None)
+ assert(repeat.get('values') is not None)
+ url = repeat['values'][repeat['i']]
+ else:
+ url = None
+ assert(url is not None)
tag = step['window']
- print(get_indent(ctx) + " " + tag + " --> " + step['url'])
+ print(get_indent(ctx) + " " + tag + " --> " + url)
win = ctx['windows'].get(tag)
assert(win is not None)
- win.go(step['url'])
+ win.go(url)
def run_test_step_action_stop(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
@@ -284,17 +293,32 @@ def run_test_step_action_repeat(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
tag = step['tag']
assert(ctx['repeats'].get(tag) is None)
- ctx['repeats'][tag] = {
- "i": step["min"],
- "step": step["step"],
- "loop": True,
- }
+ ctx['repeats'][tag] = { "loop": True, }
+
+ if 'min' in step.keys():
+ ctx['repeats'][tag]["i"] = step["min"]
+ else:
+ ctx['repeats'][tag]["i"] = 0
+
+ if 'step' in step.keys():
+ ctx['repeats'][tag]["step"] = step["step"]
+ else:
+ ctx['repeats'][tag]["step"] = 1
+
+ if 'values' in step.keys():
+ ctx['repeats'][tag]['values'] = step["values"]
+ else:
+ ctx['repeats'][tag]['values'] = None
+
while ctx['repeats'][tag]["loop"]:
ctx['repeats'][tag]["start"] = time.time()
ctx["depth"] += 1
for s in step["steps"]:
run_test_step(ctx, s)
ctx['repeats'][tag]["i"] += ctx['repeats'][tag]["step"]
+ if ctx['repeats'][tag]['values'] is not None:
+ if ctx['repeats'][tag]["i"] >= len(ctx['repeats'][tag]['values']):
+ ctx['repeats'][tag]["loop"] = False
ctx["depth"] -= 1
def run_test_step_action_plot_check(ctx, step):
@@ -340,7 +364,7 @@ def run_test_step_action_timer_restart(ctx, step):
assert_browser(ctx)
assert(ctx['timers'].get(timer) is not None)
taken = time.time() - ctx['timers'][timer]["start"]
- print(get_indent(ctx) + " {} restarted at: {:.2f}s".format(timer,
taken))
+ print("{} {} restarted at: {:.2f}s".format(get_indent(ctx), timer,
taken))
ctx['timers'][timer]["taken"] = taken
ctx['timers'][timer]["start"] = time.time()
@@ -350,7 +374,7 @@ def run_test_step_action_timer_stop(ctx, step):
assert_browser(ctx)
assert(ctx['timers'].get(timer) is not None)
taken = time.time() - ctx['timers'][timer]["start"]
- print(get_indent(ctx) + " " + timer + " took: " + str(taken) + "s")
+ print("{} {} took: {:.2f}s".format(get_indent(ctx), timer, taken))
ctx['timers'][timer]["taken"] = taken
def run_test_step_action_timer_check(ctx, step):
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=c90bd806a68a4d5e80ff985ad626e14cc8605204
commit c90bd806a68a4d5e80ff985ad626e14cc8605204
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
make the timer-start and timer-restart action name the timer in the same way
diff --git a/test/monkey-tests/cache-test.yaml
b/test/monkey-tests/cache-test.yaml
index d8c4571..372c5a1 100644
--- a/test/monkey-tests/cache-test.yaml
+++ b/test/monkey-tests/cache-test.yaml
@@ -4,7 +4,7 @@ steps:
- action: launch
language: en
- action: timer-start
- tag: timer1
+ timer: timer1
- action: window-new
tag: win1
- action: navigate
@@ -17,7 +17,7 @@ steps:
- action: timer-stop
timer: timer1
- action: timer-start
- tag: timer2
+ timer: timer2
- action: window-new
tag: win2
- action: navigate
diff --git a/test/monkey_driver.py b/test/monkey_driver.py
index 16f286a..03906d8 100755
--- a/test/monkey_driver.py
+++ b/test/monkey_driver.py
@@ -301,7 +301,10 @@ def run_test_step_action_plot_check(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
assert_browser(ctx)
win = ctx['windows'][step['window']]
- checks = step['checks']
+ if 'checks' in step.keys():
+ checks = step['checks']
+ else:
+ checks = {}
all_text = []
bitmaps = []
for plot in win.redraw():
@@ -310,23 +313,22 @@ def run_test_step_action_plot_check(ctx, step):
if plot[0] == 'BITMAP':
bitmaps.append(plot[1:])
all_text = " ".join(all_text)
- if checks is not None:
- for check in checks:
- if 'text-contains' in check.keys():
- print("Check {} in
{}".format(repr(check['text-contains']),repr(all_text)))
- assert(check['text-contains'] in all_text)
- elif 'text-not-contains' in check.keys():
- print("Check {} NOT in
{}".format(repr(check['text-not-contains']),repr(all_text)))
- assert(check['text-not-contains'] not in all_text)
- elif 'bitmap-count' in check.keys():
- print("Check bitmap count is
{}".format(int(check['bitmap-count'])))
- assert(len(bitmaps) == int(check['bitmap-count']))
- else:
- raise AssertionError("Unknown check: {}".format(repr(check)))
+ for check in checks:
+ if 'text-contains' in check.keys():
+ print("Check {} in
{}".format(repr(check['text-contains']),repr(all_text)))
+ assert(check['text-contains'] in all_text)
+ elif 'text-not-contains' in check.keys():
+ print("Check {} NOT in
{}".format(repr(check['text-not-contains']),repr(all_text)))
+ assert(check['text-not-contains'] not in all_text)
+ elif 'bitmap-count' in check.keys():
+ print("Check bitmap count is
{}".format(int(check['bitmap-count'])))
+ assert(len(bitmaps) == int(check['bitmap-count']))
+ else:
+ raise AssertionError("Unknown check: {}".format(repr(check)))
def run_test_step_action_timer_start(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
- tag = step['tag']
+ tag = step['timer']
assert_browser(ctx)
assert(ctx['timers'].get(tag) is None)
ctx['timers'][tag] = {}
-----------------------------------------------------------------------
Summary of changes:
test/monkey-tests/cache-test.yaml | 4 +-
test/monkey_driver.py | 76 +++++++++++++++++++++++++------------
2 files changed, 53 insertions(+), 27 deletions(-)
diff --git a/test/monkey-tests/cache-test.yaml
b/test/monkey-tests/cache-test.yaml
index d8c4571..372c5a1 100644
--- a/test/monkey-tests/cache-test.yaml
+++ b/test/monkey-tests/cache-test.yaml
@@ -4,7 +4,7 @@ steps:
- action: launch
language: en
- action: timer-start
- tag: timer1
+ timer: timer1
- action: window-new
tag: win1
- action: navigate
@@ -17,7 +17,7 @@ steps:
- action: timer-stop
timer: timer1
- action: timer-start
- tag: timer2
+ timer: timer2
- action: window-new
tag: win2
- action: navigate
diff --git a/test/monkey_driver.py b/test/monkey_driver.py
index 16f286a..091540e 100755
--- a/test/monkey_driver.py
+++ b/test/monkey_driver.py
@@ -228,12 +228,21 @@ def run_test_step_action_window_close(ctx, step):
def run_test_step_action_navigate(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
assert_browser(ctx)
- assert(step.get('url') is not None)
+ if 'url' in step.keys():
+ url = step['url']
+ elif 'repeaturl' in step.keys():
+ repeat = ctx['repeats'].get(step['repeaturl'])
+ assert(repeat is not None)
+ assert(repeat.get('values') is not None)
+ url = repeat['values'][repeat['i']]
+ else:
+ url = None
+ assert(url is not None)
tag = step['window']
- print(get_indent(ctx) + " " + tag + " --> " + step['url'])
+ print(get_indent(ctx) + " " + tag + " --> " + url)
win = ctx['windows'].get(tag)
assert(win is not None)
- win.go(step['url'])
+ win.go(url)
def run_test_step_action_stop(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
@@ -284,24 +293,42 @@ def run_test_step_action_repeat(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
tag = step['tag']
assert(ctx['repeats'].get(tag) is None)
- ctx['repeats'][tag] = {
- "i": step["min"],
- "step": step["step"],
- "loop": True,
- }
+ ctx['repeats'][tag] = { "loop": True, }
+
+ if 'min' in step.keys():
+ ctx['repeats'][tag]["i"] = step["min"]
+ else:
+ ctx['repeats'][tag]["i"] = 0
+
+ if 'step' in step.keys():
+ ctx['repeats'][tag]["step"] = step["step"]
+ else:
+ ctx['repeats'][tag]["step"] = 1
+
+ if 'values' in step.keys():
+ ctx['repeats'][tag]['values'] = step["values"]
+ else:
+ ctx['repeats'][tag]['values'] = None
+
while ctx['repeats'][tag]["loop"]:
ctx['repeats'][tag]["start"] = time.time()
ctx["depth"] += 1
for s in step["steps"]:
run_test_step(ctx, s)
ctx['repeats'][tag]["i"] += ctx['repeats'][tag]["step"]
+ if ctx['repeats'][tag]['values'] is not None:
+ if ctx['repeats'][tag]["i"] >= len(ctx['repeats'][tag]['values']):
+ ctx['repeats'][tag]["loop"] = False
ctx["depth"] -= 1
def run_test_step_action_plot_check(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
assert_browser(ctx)
win = ctx['windows'][step['window']]
- checks = step['checks']
+ if 'checks' in step.keys():
+ checks = step['checks']
+ else:
+ checks = {}
all_text = []
bitmaps = []
for plot in win.redraw():
@@ -310,23 +337,22 @@ def run_test_step_action_plot_check(ctx, step):
if plot[0] == 'BITMAP':
bitmaps.append(plot[1:])
all_text = " ".join(all_text)
- if checks is not None:
- for check in checks:
- if 'text-contains' in check.keys():
- print("Check {} in
{}".format(repr(check['text-contains']),repr(all_text)))
- assert(check['text-contains'] in all_text)
- elif 'text-not-contains' in check.keys():
- print("Check {} NOT in
{}".format(repr(check['text-not-contains']),repr(all_text)))
- assert(check['text-not-contains'] not in all_text)
- elif 'bitmap-count' in check.keys():
- print("Check bitmap count is
{}".format(int(check['bitmap-count'])))
- assert(len(bitmaps) == int(check['bitmap-count']))
- else:
- raise AssertionError("Unknown check: {}".format(repr(check)))
+ for check in checks:
+ if 'text-contains' in check.keys():
+ print("Check {} in
{}".format(repr(check['text-contains']),repr(all_text)))
+ assert(check['text-contains'] in all_text)
+ elif 'text-not-contains' in check.keys():
+ print("Check {} NOT in
{}".format(repr(check['text-not-contains']),repr(all_text)))
+ assert(check['text-not-contains'] not in all_text)
+ elif 'bitmap-count' in check.keys():
+ print("Check bitmap count is
{}".format(int(check['bitmap-count'])))
+ assert(len(bitmaps) == int(check['bitmap-count']))
+ else:
+ raise AssertionError("Unknown check: {}".format(repr(check)))
def run_test_step_action_timer_start(ctx, step):
print(get_indent(ctx) + "Action: " + step["action"])
- tag = step['tag']
+ tag = step['timer']
assert_browser(ctx)
assert(ctx['timers'].get(tag) is None)
ctx['timers'][tag] = {}
@@ -338,7 +364,7 @@ def run_test_step_action_timer_restart(ctx, step):
assert_browser(ctx)
assert(ctx['timers'].get(timer) is not None)
taken = time.time() - ctx['timers'][timer]["start"]
- print(get_indent(ctx) + " {} restarted at: {:.2f}s".format(timer,
taken))
+ print("{} {} restarted at: {:.2f}s".format(get_indent(ctx), timer,
taken))
ctx['timers'][timer]["taken"] = taken
ctx['timers'][timer]["start"] = time.time()
@@ -348,7 +374,7 @@ def run_test_step_action_timer_stop(ctx, step):
assert_browser(ctx)
assert(ctx['timers'].get(timer) is not None)
taken = time.time() - ctx['timers'][timer]["start"]
- print(get_indent(ctx) + " " + timer + " took: " + str(taken) + "s")
+ print("{} {} took: {:.2f}s".format(get_indent(ctx), timer, taken))
ctx['timers'][timer]["taken"] = taken
def run_test_step_action_timer_check(ctx, step):
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org