test: Add delay to firewall zone services dialog pixel test
On our loaded CI machines, the dialog needs some time to set up after changing resolutions. This is not covered by the usual "wait for animations" loop. Without this, the test almost always fails due to a broken dialog layout in the pixel test. Introduce a generic `wait_delay` kwarg to assert_pixels(), which can override the default 0.5s.
This commit is contained in:
parent
e27d58ea95
commit
9591ec2864
|
@ -975,7 +975,8 @@ class Browser:
|
|||
def assert_pixels_in_current_layout(self, selector: str, key: str,
|
||||
ignore: List[str] = [],
|
||||
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 not (Image and self.pixels_label):
|
||||
|
@ -1005,7 +1006,7 @@ class Browser:
|
|||
# But we know that tooltips fade in within 300ms, so we just
|
||||
# wait half a second to and side-step all that complexity.
|
||||
|
||||
time.sleep(0.5)
|
||||
time.sleep(wait_delay)
|
||||
if wait_animations:
|
||||
self.wait_js_cond('ph_count_animations(%s) == 0' % jsquote(selector))
|
||||
|
||||
|
@ -1119,7 +1120,8 @@ class Browser:
|
|||
ignore: List[str] = [],
|
||||
skip_layouts: List[str] = [],
|
||||
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 all layouts"""
|
||||
|
||||
if not (Image and self.pixels_label):
|
||||
|
@ -1131,7 +1133,8 @@ class Browser:
|
|||
self.set_layout(layout["name"])
|
||||
self.assert_pixels_in_current_layout(selector, key, ignore=ignore,
|
||||
scroll_into_view=scroll_into_view,
|
||||
wait_animations=wait_animations)
|
||||
wait_animations=wait_animations,
|
||||
wait_delay=wait_delay)
|
||||
self.set_layout(previous_layout)
|
||||
|
||||
def assert_no_unused_pixel_test_references(self):
|
||||
|
|
|
@ -242,7 +242,8 @@ class TestFirewall(NetworkCase):
|
|||
b.wait_visible(".pf-c-modal-box .service-list #firewall-service-imap")
|
||||
b.wait_visible(".pf-c-modal-box .service-list #firewall-service-pop3")
|
||||
|
||||
b.assert_pixels(".pf-c-modal-box", "firewall-add-services-to-zone-modal")
|
||||
# HACK: the dialog needs some time to set up after resizing
|
||||
b.assert_pixels(".pf-c-modal-box", "firewall-add-services-to-zone-modal", wait_delay=3)
|
||||
|
||||
# don't select anything in the dialog
|
||||
b.click(f"#add-services-dialog footer .{self.btn_primary}")
|
||||
|
|
Loading…
Reference in New Issue