-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
[py][bidi] Route navigation commands through BiDi #17715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shossain786
wants to merge
3
commits into
SeleniumHQ:trunk
Choose a base branch
from
shossain786:py-bidi-navigation
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+109
β4
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
py/test/selenium/webdriver/common/bidi_navigation_tests.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # Licensed to the Software Freedom Conservancy (SFC) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The SFC licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| """Tests that the classic navigation commands are routed through WebDriver BiDi. | ||
|
|
||
| These run under the ``--bidi`` pytest flag, which sets ``web_socket_url = True`` | ||
| on the options. With BiDi enabled, ``driver.get()``, ``back()``, ``forward()`` | ||
| and ``refresh()`` are expected to go through the BiDi ``browsingContext`` module | ||
| instead of the Classic HTTP endpoints, while preserving the same behaviour. | ||
| """ | ||
|
|
||
| from selenium.webdriver.common.bidi.browsing_context import ReadinessState | ||
|
|
||
|
|
||
| def test_bidi_is_enabled(driver): | ||
| """The driver should report BiDi as enabled when web_socket_url is set.""" | ||
| assert driver._is_bidi_enabled() is True | ||
|
|
||
|
|
||
| def test_get_navigates_via_bidi(driver, pages): | ||
| """driver.get() should load the page through BiDi and block until complete.""" | ||
| url = pages.url("simpleTest.html") | ||
| driver.get(url) | ||
| assert driver.current_url == url | ||
| assert "Hello WebDriver" in driver.title | ||
|
|
||
|
|
||
| def test_back_and_forward_via_bidi(driver, pages): | ||
| """back()/forward() should traverse history through BiDi.""" | ||
| first = pages.url("simpleTest.html") | ||
| second = pages.url("formPage.html") | ||
|
|
||
| driver.get(first) | ||
| driver.get(second) | ||
| assert driver.current_url == second | ||
|
|
||
| driver.back() | ||
| assert driver.current_url == first | ||
|
|
||
| driver.forward() | ||
| assert driver.current_url == second | ||
|
|
||
|
|
||
| def test_refresh_via_bidi(driver, pages): | ||
| """refresh() should reload the current context through BiDi.""" | ||
| url = pages.url("formPage.html") | ||
| driver.get(url) | ||
| driver.refresh() | ||
| assert driver.current_url == url | ||
|
|
||
|
|
||
| def test_page_load_readiness_default_is_complete(driver): | ||
| """With no explicit pageLoadStrategy, readiness should default to COMPLETE.""" | ||
| assert driver._page_load_readiness() == ReadinessState.COMPLETE | ||
|
Comment on lines
+29
to
+68
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. bidi_navigation_tests missing type hints New pytest test functions were added without parameter type annotations and without explicit `-> None` return annotations. This violates the requirement that new function signatures include full type annotations. Agent Prompt
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5. Back/forward blocking changed
π BugβΌ ReliabilityAgent Prompt
β Copy this prompt and use it to remediate the issue with your preferred AI generation tools