diff --git a/e2e/lib/komorebi_vm/core/scenarios/commands.py b/e2e/lib/komorebi_vm/core/scenarios/commands.py index d9a3087f..96e04caa 100644 --- a/e2e/lib/komorebi_vm/core/scenarios/commands.py +++ b/e2e/lib/komorebi_vm/core/scenarios/commands.py @@ -321,7 +321,14 @@ def sweep( ) -> None: """Runs every command of `commands` (`SWEEP`), and checks that it is understood and leaves the daemon healthy. `config` is the path, on the platform, of a file the daemon can be told to - load.""" + load. + + The sweep has commands that name the second monitor (`send-to-monitor 1`), so it needs two + displays: one is plugged in first if the platform has only one. + """ + if len(platform.displays()) < 2: + platform.add_display() + platform.wait_for(lambda: len(platform.state().monitors) >= 2, timeout=30) for line in commands: words = line.format(config=config).split() status, out = platform.komorebic_status(*words) diff --git a/e2e/lib/tests/test_focus_moving.py b/e2e/lib/tests/test_focus_moving.py index b6f3fc48..fa58aa83 100644 --- a/e2e/lib/tests/test_focus_moving.py +++ b/e2e/lib/tests/test_focus_moving.py @@ -202,3 +202,13 @@ def test_a_daemon_that_does_not_see_the_displays_fails_hotplug() -> None: clients = opened(platform, checks) hotplug.run(platform, checks, clients) assert any("a monitor for each display" in f for f in checks.failures) + + +def test_the_sweep_plugs_in_a_second_display_when_there_is_only_one() -> None: + platform = FakePlatform() + platform.display_count = 1 + checks = Checks() + clients = opened(platform, checks) + commands.sweep(platform, checks, clients, config="unused", commands=("focus right",)) + assert platform.display_count == 2 + assert checks.failed == 0, checks.failures