diff --git a/test/common/testlib.py b/test/common/testlib.py index a7741ec4bda8..2aa232c2028d 100644 --- a/test/common/testlib.py +++ b/test/common/testlib.py @@ -994,7 +994,8 @@ def assert_pixels_in_current_layout(self, selector: str, key: str, mock: Optional[Dict[str, str]] = None, sit_after_mock: bool = False, scroll_into_view: Optional[str] = None, - wait_animations: bool = True): + wait_animations: bool = True, + wait_delay: float = 0.5): """Compare the given element with its reference in the current layout""" if ignore is None: @@ -1033,6 +1034,7 @@ def assert_pixels_in_current_layout(self, selector: str, key: str, # wait half a second to and side-step all that complexity. if wait_animations: + time.sleep(wait_delay) self.wait_js_cond('ph_count_animations(%s) == 0' % jsquote(selector)) rect = self.call_js_func('ph_element_clip', selector) @@ -1178,13 +1180,13 @@ def assert_pixels(self, selector: str, key: str, for layout in self.layouts: if layout["name"] not in skip_layouts: self.set_layout(layout["name"]) - time.sleep(wait_delay) if "rtl" in self.current_layout["name"]: self._set_direction("rtl") self.assert_pixels_in_current_layout(selector, key, ignore=ignore, mock=mock, sit_after_mock=sit_after_mock, scroll_into_view=scroll_into_view, - wait_animations=wait_animations) + wait_animations=wait_animations, + wait_delay=wait_delay) if "rtl" in self.current_layout["name"]: self._set_direction("ltr")