Skip to content

Commit

Permalink
test: Avoid focused host selector for pixel test
Browse files Browse the repository at this point in the history
TestHostSwitching.testBasic does pixel tests of the host selector menu,
which is the top left element at position (0, 0). Current Chromium
changes behaviour to always focus that element, and it's fairly
stubborn.

To avoid pixel testing the focused (light-gray) variant, move the mouse
away first.
  • Loading branch information
martinpitt committed Dec 9, 2024
1 parent 752289b commit 3ffafff
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/verify/check-shell-host-switching
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ class TestHostSwitching(testlib.MachineCase, HostSwitcherHelpers):
b.wait_not_present("#nav-system.interact")
b.set_layout("desktop")

# this looks different (focused) when the mouse is inside (default 0,0 possition), so move it away
# chromium is stubborn here, we *have* to move the real mouse, not just do this with synthetic MouseEvents
b.bidi("input.performActions", context=b.driver.context, actions=[{
"id": "move-away",
"type": "pointer",
"parameters": {"pointerType": "mouse"},
"actions": [{"type": "pointerMove", "x": 200, "y": 200, "origin": "viewport"}]
}])
b.assert_pixels("#hosts-sel", "hosts-sel-closed")

b.click("#hosts-sel button")
Expand Down

0 comments on commit 3ffafff

Please sign in to comment.