test(e2e): purge remaining lying asserts in home and reels tests

Replaced weak 'y_center < 2000' and 'not action_bar' assertions with hard structural and semantic validations for author username clicks.
We now explicitly verify that the VLM selected the correct resource-id or matching text/content-desc.
This commit is contained in:
2026-04-29 01:00:57 +02:00
parent 44fae37cc7
commit 073a90c38c
2 changed files with 13 additions and 6 deletions

View File

@@ -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

View File

@@ -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}'"
)