diff --git a/docs/expectation.rst b/docs/expectation.rst index 76aeb49c0dc985..6a0c77684a3b83 100644 --- a/docs/expectation.rst +++ b/docs/expectation.rst @@ -203,6 +203,10 @@ When used for expectation data, manifests have the following format: the (sub)test is disabled and should either not be run (for tests) or that its results should be ignored (subtests). + * A key ``restart-after`` which can be set to any value to indicate that + the runner should restart the browser after running this test (e.g. to + clear out unwanted state). + * Variables ``debug``, ``os``, ``version``, ``processor`` and ``bits`` that describe the configuration of the browser under test. ``debug`` is a boolean indicating whether a build is a debug diff --git a/wptrunner/manifestexpected.py b/wptrunner/manifestexpected.py index b46a1ef9597574..c0e22a843fdfeb 100644 --- a/wptrunner/manifestexpected.py +++ b/wptrunner/manifestexpected.py @@ -29,10 +29,10 @@ def data_cls_getter(output_node, visited_node): raise ValueError -def disabled(node): - """Boolean indicating whether the test is disabled""" +def bool_prop(name, node): + """Boolean property""" try: - return node.get("disabled") + return node.get(name) except KeyError: return None @@ -109,7 +109,11 @@ def url(self): @property def disabled(self): - return disabled(self) + return bool_prop("disabled", self) + + @property + def restart_after(self): + return bool_prop("restart-after", self) @property def tags(self): @@ -123,7 +127,11 @@ def prefs(self): class DirectoryManifest(ManifestItem): @property def disabled(self): - return disabled(self) + return bool_prop("disabled", self) + + @property + def restart_after(self): + return bool_prop("restart-after", self) @property def tags(self): @@ -164,7 +172,11 @@ def id(self): @property def disabled(self): - return disabled(self) + return bool_prop("disabled", self) + + @property + def restart_after(self): + return bool_prop("restart-after", self) @property def tags(self): diff --git a/wptrunner/testrunner.py b/wptrunner/testrunner.py index b5617827a40125..77d2a88508347e 100644 --- a/wptrunner/testrunner.py +++ b/wptrunner/testrunner.py @@ -524,7 +524,8 @@ def test_ended(self, test, results): self.test = None - restart_before_next = (file_result.status in ("CRASH", "EXTERNAL-TIMEOUT") or + restart_before_next = (test.restart_after or + file_result.status in ("CRASH", "EXTERNAL-TIMEOUT") or subtest_unexpected or is_unexpected) if (self.pause_after_test or diff --git a/wptrunner/wpttest.py b/wptrunner/wpttest.py index f721f86aecc3f2..9832f72654ea8e 100644 --- a/wptrunner/wpttest.py +++ b/wptrunner/wpttest.py @@ -166,6 +166,14 @@ def disabled(self, subtest=None): return disabled return None + @property + def restart_after(self): + for meta in self.itermeta(None): + restart_after = meta.restart_after + if restart_after is not None: + return True + return False + @property def tags(self): tags = set()