diff --git a/tests/e2e/test_nav_home_feed.py b/tests/e2e/test_nav_home_feed.py index fb228b2..1c8ad3d 100644 --- a/tests/e2e/test_nav_home_feed.py +++ b/tests/e2e/test_nav_home_feed.py @@ -66,9 +66,12 @@ def test_home_feed_post_author_extraction(make_real_device_with_image): assert result is not None, "Visual discovery returned None for 'tap post author username'" - # Exclude system UI or bottom nav - y_center = result.y1 + (result.y2 - result.y1) / 2 - assert y_center < 2000, "VLM hallucinated the author in the bottom navigation bar!" + rid = (result.resource_id or "").lower() + desc = (result.content_desc or "").lower() + text = (result.text or "").lower() + + is_author = "row_feed_photo_profile_name" in rid or "millionlords" in desc or "millionlords" in text + assert is_author, f"VLM picked wrong element! Selected id='{rid}', desc='{desc}', text='{text}'" @pytest.mark.live_llm diff --git a/tests/e2e/test_nav_reels.py b/tests/e2e/test_nav_reels.py index 94e5326..0024192 100644 --- a/tests/e2e/test_nav_reels.py +++ b/tests/e2e/test_nav_reels.py @@ -140,10 +140,14 @@ def test_reel_post_author_selects_username(make_real_device_with_image): assert result is not None, "Visual discovery returned None for author username on Reel" rid = (result.resource_id or "").lower() + desc = (result.content_desc or "").lower() + text = (result.text or "").lower() - # Must be the author info component, NOT the top action bar - assert "action_bar" not in rid, ( - f"VLM selected the action bar instead of the author username!\n" f" Selected: id='{result.resource_id}'" + # Must be the author info component or username, NOT the top action bar + is_author = "author" in rid or "cappadocia.cowboy" in desc or "cappadocia.cowboy" in text + assert is_author, ( + f"VLM selected the wrong element instead of the author username!\n" + f"Selected id='{rid}', desc='{desc}', text='{text}'" )