Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Wait for tooltips after scrolling stuff into view #19279

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
martinpitt marked this conversation as resolved.
Show resolved Hide resolved
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")
Expand Down
13 changes: 12 additions & 1 deletion test/verify/check-metrics
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,18 @@ class TestHistoryMetrics(testlib.MachineCase):
b.wait_in_text("#metrics-hour-1597662000000:not(.metrics-hour-compressed) .metrics-events-hour-header-expanded .spikes_count", "3 spikes")
b.wait_in_text("#metrics-hour-1597662000000:not(.metrics-hour-compressed) .metrics-events-hour-header-expanded .spikes_info", "1 Memory, 1 Disk I/O, 1 Network I/O")

b.assert_pixels(".metrics", "metrics-history-expanded-hour", ignore=[".spikes_count"])
# There is something really funny going on with the navigation
# bar in the mobile layout; it sometimes appears in a random
# position in the screenshot. We fix that by adding an extra
# delay after switching to "mobile".

b.assert_pixels(".metrics", "metrics-history-expanded-hour", ignore=[".spikes_count"],
skip_layouts=["mobile"])
b.set_layout("mobile")
time.sleep(1.0)
b.assert_pixels_in_current_layout(".metrics", "metrics-history-expanded-hour",
ignore=[".spikes_count"])
b.set_layout("desktop")

b.click("#metrics-hour-1597662000000 button.metrics-events-expander")
b.wait_in_text("#metrics-hour-1597662000000.metrics-hour-compressed", "1:00")
Expand Down
4 changes: 3 additions & 1 deletion test/verify/check-system-info
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ class TestSystemInfo(packagelib.PackageCase):
# strips empty lines, but not leading spaces
b.wait_text('#motd', " Hello\n World")

b.assert_pixels("#motd-box", "motd")
# For some reason, switching to RTL takes a long time
# here. Let's increase the delay.
b.assert_pixels("#motd-box", "motd", wait_delay=2.0)

b.click('#motd-box button:not(#motd-box-edit)')
b.wait_not_present('#motd-box')
Expand Down