[py] Bidi py tests expansion#17193
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands Selenium Python BiDi test coverage (script/log/integration/error paths) in preparation for moving to CDDL-generated code.
Changes:
- Adds multiple new test suites for BiDi script execution behaviors, logging, integration scenarios, and error handling.
- Introduces new test modules:
bidi_log_tests.py,bidi_integration_tests.py, andbidi_errors_tests.py. - Applies some formatting refactors in existing BiDi script tests and appends additional script-oriented test classes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 32 comments.
| File | Description |
|---|---|
py/test/selenium/webdriver/common/bidi_script_tests.py |
Adds many new script tests and some formatting changes; introduces an unused import and has new blocks that will be reformatted by ruff format. |
py/test/selenium/webdriver/common/bidi_log_tests.py |
New BiDi logging tests; contains an unused import and at least one test that doesn’t assert behavior. |
py/test/selenium/webdriver/common/bidi_integration_tests.py |
New integration tests across modules; currently uses multiple non-existent/incorrect BiDi and WebDriver APIs (would fail at runtime/lint). |
py/test/selenium/webdriver/common/bidi_errors_tests.py |
New BiDi error-handling tests; currently calls many non-existent methods and incorrect signatures (would fail at runtime). |
|
nice 👍 |
|
below is the plan I have created and working against Selenium BiDi Test Coverage Plan - WPT ComparisonPrepared: 2026-03-07 Executive SummarySelenium currently has 10 BiDi test modules while WPT has 13 main test modules with an extensive sub-module structure. Key gaps include:
Detailed Module-by-Module Comparison✅ 1. Browser ModuleFile: WPT Sub-modules:
Selenium Test Coverage:
Missing Tests:
Estimated Gap: 5-10 tests✅ 2. Browsing Context ModuleFile: WPT Sub-modules (32 total):
Selenium Test Coverage:Covered (✓):
Missing/Gaps (✗):
Estimated Gap: 10-15 tests✅ 3. Emulation ModuleFile: WPT Sub-modules (10 total):
Selenium Test Coverage:Likely basic coverage of:
Missing/Gaps:
Estimated Gap: 8-12 tests✅ 4. Input ModuleFile: WPT Sub-modules (4 total):
Selenium Test Coverage:Likely basic coverage of:
Missing/Gaps:
Estimated Gap: 5-10 tests✅ 5. Network ModuleFile: WPT Sub-modules (18 total):
Selenium Test Coverage:Basic coverage likely includes:
Missing/Gaps:
Estimated Gap: 15-20 tests✅ 6. Script ModuleFile: WPT Sub-modules (8 total):
Selenium Test Coverage:Likely basic coverage:
Missing/Gaps:
Estimated Gap: 10-15 tests✅ 7. Session ModuleFile: WPT Sub-modules (5 total):
Selenium Test Coverage:Basic coverage likely includes:
Missing/Gaps:
Estimated Gap: 5-8 tests✅ 8. Storage ModuleFile: WPT Sub-modules (3 total):
Selenium Test Coverage:Basic coverage likely:
Missing/Gaps:
Estimated Gap: 8-12 tests✅ 9. Web Extension ModuleFile: WPT Sub-modules (2 total):
Selenium Test Coverage:Basic coverage:
Missing/Gaps:
Estimated Gap: 4-6 tests❌ Completely Missing Modules10. Errors ModuleFile: MISSING - WPT Content:
What It Should Test:
Estimated Tests Needed: 15-20 testsAction Items:
11. Integration ModuleFile: MISSING - WPT Content:
What It Should Test:
Estimated Tests Needed: 10-15 testsAction Items:
12. Log ModuleFile: MISSING - WPT Content:
What It Should Test:
Estimated Tests Needed: 12-18 testsAction Items:
13. External ModuleStatus: Unknown - appears in WPT but unclear if it contains tests What Needs Investigation:
Additional Module: PermissionsFile: WPT Coverage:Not found in WPT BiDi tests - appears to be Selenium-specific Current Status:
Recommendation:
Summary Table
Overall Gap AssessmentTotal Estimated Missing Tests
Priorities for Implementation🔴 High Priority (Blocks spec compliance)
🟡 Medium Priority (Improves coverage)
🟢 Low Priority (Nice to have)
Recommended Implementation PlanPhase 1: Critical Gaps (2-3 weeks)
Phase 2: Core Coverage Expansion (3-4 weeks)
Phase 3: Edge Cases & Polish (2-3 weeks)
Files to Create/ModifyNew Files to CreateFiles to ExpandBazel Integration - Automatic Test DiscoveryHow New BiDi Tests Are Automatically Picked UpThe Selenium build system automatically includes all BiDi test files without requiring changes to the Bazel configuration. Key Mechanism (py/BUILD.bazel:633): BIDI_TESTS = glob(["test/selenium/webdriver/common/**/*bidi*_tests.py"])This glob pattern automatically matches any file in
Test Target OrganizationNon-BiDi Tests (
BiDi Tests (
Naming Convention for New TestsTo ensure automatic inclusion, follow this pattern: Examples:
Test Execution# Run all BiDi tests for a browser
bazel test //py:test-chrome-bidi
bazel test //py:test-firefox-bidi
bazel test //py:test-edge-bidi
# Run with filter
bazel test //py:test-chrome-bidi --test_filter=test_specific_test_name
# Verify cache after creating new files
bazel clean && bazel test //py:test-chrome-bidiNo Bazel Configuration Changes Required ✅When creating the new test files (
Reference Links
Style and StandardsCode Style ComplianceAll new BiDi tests must follow the established style guide:
Key Style Points
Notes
|
🔗 Related Issues
💥 What does this PR do?
Add more tests to the Python Bidi code to improve coverage for when we move to the CDDL generated code
🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes