Commit Graph

752 Commits

Author SHA1 Message Date
Magnus Müller
1655751f8a Add test for true cross-origin iframe element clicking
- Introduced a new test to verify the ability to click elements inside true cross-origin iframes, specifically targeting external domains like example.com.
- Implemented a fixture to create a browser session with cross-origin iframe support, enhancing the test's reliability and clarity.
- The test checks for the presence of elements from different CDP targets and ensures that at least one element from the cross-origin iframe can be successfully clicked.

This addition aims to improve the coverage of cross-origin iframe interactions in the browser automation framework, ensuring robust functionality in real-world scenarios.
2025-10-27 17:26:02 -07:00
Magnus Müller
c3db6cff02 Refactor cross-origin iframe handling in tests and serializer
- Updated the DOMTreeSerializer to remove debug code related to cross-origin iframe detection, enhancing clarity and maintainability.
- Adjusted test cases to replace the cross-origin iframe source with a placeholder (about:blank) for improved test isolation and reliability.
- Updated comments and descriptions in tests to reflect the changes in iframe handling, ensuring accurate documentation of test behavior.

This change aims to streamline the handling of cross-origin iframes in both the serializer and tests, improving overall robustness and maintainability.
2025-10-27 17:19:03 -07:00
Magnus Müller
f3c7070506 Refactor cross-origin iframe click test for improved clarity and functionality
- Updated test to verify clicking elements inside iframes in different CDP targets, enhancing the description for better understanding.
- Replaced the previous cross-origin iframe setup with a more controlled iframe content for testing.
- Adjusted assertions to ensure at least one element from the iframe is found, improving test reliability.
- Cleaned up comments and print statements for clarity, ensuring the test accurately reflects its purpose.

This change aims to enhance the robustness and maintainability of tests involving iframe interactions in the browser automation framework.
2025-10-27 17:14:30 -07:00
Magnus Müller
c886eacb42 Increase wait time for cross-origin iframe loading in tests
- Updated the sleep duration from 3 to 5 seconds to accommodate potential network delays in CI environments.
- Enhanced the comment to clarify that cross-origin iframe extraction is enabled when getting the DOM state.

This change aims to improve the reliability of tests involving cross-origin iframes by allowing sufficient time for them to load before interaction.
2025-10-27 00:06:29 -07:00
Magnus Müller
3ad835a311 Linter 2025-10-27 00:00:32 -07:00
Magnus Müller
7c61bd4908 Add test for clicking elements inside cross-origin iframes
Verifies that:
- Cross-origin iframe DOM extraction works (finds multiple CDP targets)
- Elements from cross-origin iframes appear in the selector_map
- Elements inside cross-origin iframes can be clicked successfully
- Target/session switching works correctly for cross-origin actions

The test uses example.com as the cross-origin iframe source and
clicks the "Learn more" link inside the iframe to verify end-to-end
functionality.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 23:56:23 -07:00
Magnus Müller
04e987df99 Add stacked DOM elements test for complex scenarios
- Introduced a new HTML template for testing stacked DOM elements, including open and closed shadow DOMs, same-origin and cross-origin iframes, and a final button.
- Implemented a test case to validate click functionality through these stacked elements, ensuring that all interactive elements are clickable and that the click counter reflects the expected number of clicks.
- Enhanced the browser session configuration to accommodate a taller window size for better visibility of stacked elements.

This update aims to improve the robustness of DOM interaction tests and ensure comprehensive coverage of complex scenarios in the browser automation framework.
2025-10-26 23:16:06 -07:00
Magnus Müller
4258546098 Add DOM serializer test templates and improve logging
- Introduced new HTML templates for DOM serializer tests, including a main page and an iframe template.
- Enhanced logging in the BrowserSession to provide clearer insights when fetching the CDP client for target nodes, improving traceability during debugging.
- Updated tests to utilize the new HTML templates, ensuring better structure and maintainability.

This update aims to enhance the robustness of the DOM serializer tests and improve error handling in session management.
2025-10-26 22:44:42 -07:00
Magnus Müller
adcac19259 Fix test to properly check for click failures
- Added check for failure messages in extracted_content
- Now catches both error field and 'not available'/'failed' in content
- Test will now fail in CI as expected, revealing click issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 21:39:15 -07:00
Magnus Müller
f09df1a326 Add DOM serializer test with shadow DOM, iframes, and click functionality
- Tests DOM serializer extracts elements from:
  - Regular DOM (buttons, inputs, links)
  - Shadow DOM (elements inside shadow roots)
  - Same-origin iframes
  - Cross-origin iframes
- Tests clicking elements using tools.click(index) for each category
- Test fails if clicks don't work (currently failing - needs fix)
- Verifies 12 total interactive elements are found

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 17:34:50 -07:00
Magnus Müller
f57a350098 Add integration tests for screenshot functionality in the agent with vision enabled. This includes setting up a mock HTTP server for testing, capturing screenshots during navigation, and verifying the existence and content of the captured screenshots in the agent's history. 2025-10-26 17:12:11 -07:00
Magnus Müller
0ad363cb29 Tab test 2025-10-26 17:05:00 -07:00
Magnus Müller
f29be2aa58 Change browser session fixture scope from 'module' to 'function' in navigation tests for improved isolation and reliability. 2025-10-26 16:39:51 -07:00
Magnus Müller
135664432c Broken nav 2025-10-26 16:35:01 -07:00
Magnus Müller
3a1db137bb api key not required 2025-10-25 18:00:18 -07:00
Magnus Müller
9313097a84 Remove openrouter 2025-10-25 10:27:06 -07:00
Magnus Müller
16d8833048 Api key rename 2025-10-25 10:24:40 -07:00
Magnus Müller
3742377fa3 Linter 2025-10-25 10:20:40 -07:00
Magnus Müller
f60fedb01d Env 2025-10-25 10:20:31 -07:00
Magnus Müller
6e31a05acd Split model tests 2025-10-25 10:16:46 -07:00
Magnus Müller
5b481ac5ee Linter 2025-10-25 09:59:37 -07:00
Magnus Müller
ba79f4df88 Linter 2025-10-25 09:59:30 -07:00
Magnus Müller
a991e19d75 Remove some models 2025-10-25 09:58:59 -07:00
Magnus Müller
a8cb8bae12 Remove deepseek 2025-10-25 09:56:38 -07:00
Magnus Müller
19df83f7ab Linter 2025-10-25 09:51:07 -07:00
Magnus Müller
8ac418b17f No api key fails in github 2025-10-25 09:50:59 -07:00
Magnus Müller
c342442a0b Linter 2025-10-25 09:38:28 -07:00
Magnus Müller
8a76853837 Basic model test 2025-10-25 09:36:56 -07:00
Magnus Müller
4db51f9e24 Ci cd test update 2025-10-25 09:12:15 -07:00
Magnus Müller
c1982936c9 Organize tests 2025-10-25 09:09:54 -07:00
Magnus Müller
90e4569125 Remove old 2025-10-25 08:46:40 -07:00
Magnus Müller
22b24723bf Cache 2025-10-24 23:53:56 -07:00
Magnus Müller
17db15320d Cloud browser 2025-10-24 23:53:50 -07:00
Magnus Müller
a00a999bdc Remove sleep 2025-10-24 23:47:36 -07:00
Magnus Müller
8d3f30da80 Patch api key 2025-10-24 23:47:01 -07:00
Magnus Müller
56badd6ca8 Move to interaction tests 2025-10-24 23:45:13 -07:00
Magnus Müller
763a7b325b Remove more 2025-10-24 23:43:17 -07:00
Magnus Müller
01dd419eaf Remove event tests because inside tools 2025-10-24 23:36:41 -07:00
Magnus Müller
b36b85715d Longer wait in actor press 2025-10-24 23:36:27 -07:00
Magnus Müller
daa74ddcfe Tests 2025-10-24 23:29:38 -07:00
Magnus Müller
bb8b801b5a Remove test 2025-10-24 23:23:26 -07:00
Magnus Müller
dd6ec0bf03 Delete files 2025-10-24 23:21:25 -07:00
Magnus Müller
096b29c9f7 Remove tab 2025-10-24 23:15:53 -07:00
Magnus Müller
5a8f30d378 Refactor tests to utilize direct action calls in Tools
- Simplified test implementations by replacing ActionModel usage with direct calls to Tools methods (e.g., navigate, click, upload_file).
- Enhanced readability and maintainability of test code by removing unnecessary model definitions.
- Utilized new helper methods for element lookup by ID, improving efficiency in finding elements during tests.

This change aligns with recent updates to the Tools API, making tests cleaner and more intuitive.
2025-10-24 23:08:21 -07:00
Magnus Müller
8fa6efa0c9 Tests simplified 2025-10-24 23:00:42 -07:00
Magnus Müller
95716350ef Linter 2025-10-24 19:03:42 -07:00
Magnus Müller
36c0405b4a Linter 2025-10-24 19:02:08 -07:00
Magnus Müller
f41da2d3b4 Fix dropdown selection for Vue.js and reactive frameworks (#3415)
Fixes dropdown selections not persisting in Vue.js, React, and other
reactive frameworks. The issue was that only 'change' events were
dispatched, but Vue's v-model requires 'input' events to register changes.

**Root Cause:**
Dropdown selection handler only dispatched 'change' events, missing the
'input' event required by reactive frameworks.

**Solution:**
Enhanced event dispatching sequence in default_action_watchdog.py:
1. Focus element first
2. Set value and selected state
3. Dispatch 'input' event (critical for Vue v-model and React)
4. Dispatch 'change' event (standard for select elements)
5. Blur element for validation

**Tests:**
Added comprehensive integration tests in tests/ci/interaction/:
- test_dropdown_vue_submit.py: Vue.js 3 with v-model
- test_dropdown_react_submit.py: React 18 with controlled components

Both tests verify dropdown selections persist through the reactive
framework's state management and form submission works correctly.

Closes #3415

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 18:54:57 -07:00
Magnus Müller
672e749d0f fix evaluate test 2025-10-24 14:17:48 -07:00
Magnus Müller
3cbea6fbf6 Add env key 2025-10-24 02:13:27 -07:00