fix: humanize not being provided on mouse.click actions inside WebElement#393
fix: humanize not being provided on mouse.click actions inside WebElement#393tiagogcampos wants to merge 4 commits intoautoscrape-labs:mainfrom
Conversation
An async fixture is not needed, since all we are doing is creating an AsyncMock, which in itself is a sync operation
📝 WalkthroughWalkthroughThe pull request fixes a bug where the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/test_web_element.py (1)
2031-2032: Avoid redefiningmock_connection_handlerin the same module.The second fixture definition overrides the first one, which can silently change setup behavior for unrelated tests and makes fixture resolution harder to reason about.
♻️ Proposed refactor
-@pytest.fixture -def mock_connection_handler(): +@pytest.fixture +def iframe_mock_connection_handler(): """Mock connection handler for WebElement tests.""" with patch('pydoll.connection.ConnectionHandler', autospec=True) as mock: handler = mock.return_value handler.execute_command = AsyncMock() handler._connection_port = 9222 yield handler -@pytest.fixture -def iframe_element(mock_connection_handler): +@pytest.fixture +def iframe_element(iframe_mock_connection_handler): """Iframe element fixture for iframe-related tests.""" attributes_list = ['id', 'test-iframe', 'tag_name', 'iframe'] return WebElement( object_id='iframe-object-id', - connection_handler=mock_connection_handler, + connection_handler=iframe_mock_connection_handler, method='css', selector='iframe#test-iframe', attributes_list=attributes_list, ) -@pytest.fixture -def element_in_iframe(mock_connection_handler): +@pytest.fixture +def element_in_iframe(iframe_mock_connection_handler): """Element inside an iframe (has _iframe_context set).""" attributes_list = ['id', 'button-in-iframe', 'tag_name', 'button'] element = WebElement( object_id='button-object-id', - connection_handler=mock_connection_handler, + connection_handler=iframe_mock_connection_handler, method='css', selector='button', attributes_list=attributes_list, )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/test_web_element.py` around lines 2031 - 2032, There are two fixtures both named mock_connection_handler which causes the latter to override the former; locate the duplicate fixture definitions of mock_connection_handler and either remove/merge the redundant one or rename the second fixture to a unique name (e.g., mock_connection_handler_alt) and update all tests that rely on the second fixture to use the new name; ensure the intended setup logic from both definitions is preserved by consolidating shared behavior into a single fixture function (or using helper functions) and update any imports/usages accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/test_web_element.py`:
- Around line 2031-2032: There are two fixtures both named
mock_connection_handler which causes the latter to override the former; locate
the duplicate fixture definitions of mock_connection_handler and either
remove/merge the redundant one or rename the second fixture to a unique name
(e.g., mock_connection_handler_alt) and update all tests that rely on the second
fixture to use the new name; ensure the intended setup logic from both
definitions is preserved by consolidating shared behavior into a single fixture
function (or using helper functions) and update any imports/usages accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c6f7e33f-e7cd-469a-b909-ee18563807a2
📒 Files selected for processing (3)
pydoll/elements/web_element.pytests/test_connection_handler.pytests/test_web_element.py
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Pull Request
Description
Provides humanize boolean to mouse.click actions performed on WebElement.
Related Issue(s)
Fixes #392
Type of Change
How Has This Been Tested?
Tested by executing the test suite.
Testing Checklist
Screenshots
Implementation Details
API Changes
Additional Info
Checklist before requesting a review
poetry run task lintand fixed any issuespoetry run task testand all tests passSummary by CodeRabbit
Bug Fixes
Tests