Commit Graph

4 Commits

Author SHA1 Message Date
Saurav Panda
44e7b1f082 fix(tests): patch TimeoutWrappedCDPClient at its new construction site
Earlier commit 9a09c4d7 swapped the CDPClient construction in
browser_use/browser/session.py from the raw cdp_use.CDPClient to our
TimeoutWrappedCDPClient subclass. test_cdp_headers.py patches the
CDPClient symbol in session.py's namespace to assert headers/User-Agent
propagate — but since the code now instantiates TimeoutWrappedCDPClient,
the patch no longer intercepts the call and the mock.assert_called_once
check fails with 'Called 0 times'.

Point the patches at session.TimeoutWrappedCDPClient instead so the
assertions match what the code actually constructs. Header propagation
still works end-to-end because TimeoutWrappedCDPClient forwards
*args/**kwargs to super().__init__.
2026-04-20 17:45:35 -07:00
reformedot
ad41865559 Refactor User-Agent assertion in CDP headers test
- Updated the assertion for the User-Agent header in the /json/version endpoint test to improve readability by using a multi-line format.
- This change enhances the clarity of the test's intent while maintaining the existing validation logic.

These modifications contribute to better maintainability of the test code.
2026-03-20 00:47:59 -07:00
reformedot
f64f587d09 Enhance header validation in CDP client tests
- Improved assertions in tests to ensure all user-provided headers are present in the additional_headers.
- Added checks to confirm that the User-Agent header is injected for remote connections, ensuring consistent behavior across tests.
- Updated the test for the /json/version endpoint to validate the presence and format of the User-Agent header.

These changes enhance the reliability of header handling in the CDP client tests.
2026-03-20 00:43:15 -07:00
mertunsall
ad1c9b070e fix 2025-11-26 10:33:06 -08:00