From 936da47f6155dad7d5257121831b996dd90ead13 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Sat, 2 May 2026 22:40:52 +0200 Subject: [PATCH] test: SAE execution loop coverage --- tests/e2e/test_system_sae.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/e2e/test_system_sae.py b/tests/e2e/test_system_sae.py index b520c34..080b58b 100644 --- a/tests/e2e/test_system_sae.py +++ b/tests/e2e/test_system_sae.py @@ -134,3 +134,30 @@ class TestSAECompression: compressed = sae._compress_xml(broken_xml) assert "PACKAGES: com.instagram.android" in compressed assert "TEXTS: Hello" in compressed + + +class TestSAELoop: + """Tests the higher-level engine loops.""" + + def test_ensure_clear_screen_returns_true_immediately_if_normal(self, sae): + """If the screen is NORMAL, the SAE should return True without taking actions.""" + xml_dump = ''' + + + + ''' + # Bypass dump_hierarchy + sae.device.dump_hierarchy = lambda: xml_dump + assert sae.ensure_clear_screen(max_attempts=3) is True + assert sae._consecutive_failures == 0 + + def test_is_instagram_foreground(self, sae): + xml_dump = ''' + + + + ''' + assert sae.is_instagram_foreground(xml_dump=xml_dump) is True + + foreign_xml = '' + assert sae.is_instagram_foreground(xml_dump=foreign_xml) is False