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:
@@ -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
|
||||
|
||||
@@ -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}'"
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user