Skip to content

Fix assertion to match actual cart page content#779

Open
mendral-app[bot] wants to merge 2 commits intomainfrom
mendral/fix-agent-fallback-assertion
Open

Fix assertion to match actual cart page content#779
mendral-app[bot] wants to merge 2 commits intomainfrom
mendral/fix-agent-fallback-assertion

Conversation

@mendral-app
Copy link
Copy Markdown

@mendral-app mendral-app Bot commented Apr 22, 2026

Summary

  • Fix false-negative assertion failure in test_agent_fallback by replacing the 'added to cart' string check with 'the cap', which actually appears on the cart page where session.observe() captures content after the agent completes.

Context

Insight: test_agent_fallback: assertion checks for 'added to cart' but page lands on cart view

The test was asserting "added to cart" in page_content, but after the fallback agent finishes, session.observe() captures the cart page (/cart), not the product page. The cart page shows '1 item in your cart for $35.00' and 'the cap' — but never the string 'added to cart'.

The underlying action (adding the cap to cart) succeeds every time — only the assertion was wrong.

Changes

  • tests/integration/sdk/test_agent_fallback.py:46-51: Replace assert "added to cart" in page_content with assert "the cap" in page_content, which verifies the correct item was added to cart by checking for the product name on the cart page.

Failure evidence

5 occurrences across runs 24213104872, 24482491956, 24804410046 and others — all showing the same pattern: cart page content contains 'the cap' and '$35.00' but not 'added to cart'.


Note

Created by Mendral. Tag @mendral-app with feedback or questions.

Greptile Summary

Fixes a false-negative in test_agent_fallback by correcting the post-action assertion to check for 'the cap' instead of 'added to cart'. After the fallback agent finishes, session.observe() captures the cart page (/cart), which displays the product name but not the literal string 'added to cart', causing the test to fail despite the underlying action succeeding.

Confidence Score: 5/5

Safe to merge — single-line test assertion fix with clear evidence backing the change.

The only change is replacing a wrong assertion string with one that actually appears on the observed page. The PR description provides solid failure evidence from multiple CI runs, the .lower() normalization is already in place, and no production code is touched.

No files require special attention.

Important Files Changed

Filename Overview
tests/integration/sdk/test_agent_fallback.py Fix false-negative assertion: replaces 'added to cart' (not present on cart page) with 'the cap' (product name actually shown on cart page after agent completes)

Reviews (2): Last reviewed commit: "style: apply ruff format to assertion" | Re-trigger Greptile

mendral-app Bot added 2 commits April 22, 2026 15:02
The test_agent_fallback test asserted 'added to cart' in page content,
but after the agent completes, session.observe() captures the cart page
(/cart) which shows the product name and quantity — not an 'added to cart'
toast. Replace with assertion for 'the cap' which verifies the correct
item was added to cart.
@mendral-app mendral-app Bot marked this pull request as ready for review April 22, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants