-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
WebDriver Bidi tests with new Py3 WebSockets dependencies #27195
Conversation
To run the test, I believe still need to do Actually, use python3 wpt run ... instead. |
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.
Hi Shengfa, thanks for the PR! I've started to take a look at it, but a quick question:
The actual dependencies for the WebSockets lib[2] [...] are not included in this PR. They are installed locally using pip install.
Is this comment (from the description) still accurate? It looks like you vendored websockets
into third_party
and added it to localpaths.py
so I wasn't sure.
Thanks for looking at it. That's not true anymore. I will modify the description tomorrow. |
Is it possible to clean up the commits here to make reviewing easier? In particular it would be great to have a single initial commit that vendors in third party code, and then one or more subsequent commits with the additional changes. |
Hi James, |
Trying to rebase a set of changes which include a |
Hi James, |
Baiscally I want all the commits that vendor in libraries first and then either a single commit with your changes or a number of logically seperate commits with your changes, with no merge commits except those from subtree. The use case is to be able to filter out all the vendored code when doing the review. |
Got it, thanks for the clarification. |
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.
This is really nearly ready to merge. I'm very excited for this to be landed!
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.
await session.websocket_transport.send("test_bidi_session_1") | ||
await session.websocket_transport.close() | ||
|
||
# bidi session following a bidi session with the same capabilities |
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.
This makes the test dependent on a strict order, and test_bidi_session_1
being enabled. To get rid of this all the code should be put into a single test.
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.
One of the reasons for the tests is testing the behavior from re-using websocket_transport between tests with/without capability change. I don't think I can achieve that with a single test.
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.
We might need a similar new_session
fixture for BiDi so that you can create multiple new sessions with different capabilities within a single test.
Reverted the latest commit for dedicated bidi_session fixture but kept the new bidi test folder. Will open another issue for remaining opened conservations after merge for
|
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.
I'm ok with moving the remaining parts to a new issue / PR. @jgraham mind doing a review pass yourself?
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.
OK, I'm happy for this to land to get things unblocked, but I agree that the proposed followups will create a nicer API.
I think think one needs to be landed by manual push to preserve the merge commits? |
Yes, I believe so. I will own syncing with Shengfa to get this landed (I'm not sure what permissions we'll need, but I assume I have them and he might not...) |
Use git add -f tools/third_party/pytest to include version file. This includes _version.py and pytest.egg-info folder.
Test establishing a Bidirectional Session capability support
Test connecting to WebDriver session using websockets and send a message in async/await style
1. Added a BidiSession class in bidi.py under tools/webdriver/webdriver that will preset capability for websocket connection. Created async versions of start and end for the class to handle establishing and closing websocket connection. 2. Modify session fixture to take an extra boolean argument "bidi" for creating bidi session. Change the fixture to async and use await when dealing with bidi session start/end. 3. Set event loop scope to session(assuming it would reuse the same event loop for all tests) to avoid event loop is closed error when closing websocket connection. 4. Added tests for different bidi/classic session creation scenario and tested connect/send/close.
I have manually pushed the two |
Created a prototype involving WebDriver Bidi client according to [1].
The dependencies for the WebSockets lib[2] is added in third party lib. Added the dependency for pytest-asyncio[3] in this PR as well.
Later versions of pytest[4] and pluggy[5] are needed for pytest-asyncio and they are included here. Pluggy is also needed and it's already included from rebase.
The change includes:
A simple WebDriver Bidi capabilities test to demonstrate enabling WebSockets according to the protocol.
Upgraded pytest and pluggy third party dependencies
Added an async style test that enables WebSocket by directly specifying the corresponding capability.
Add BidiSession class in WebDriver client for use in fixture to conveniently create a Bidi Session and tests to demonstrate behavior between tests.
[1] #26015 (comment)
[2] https://github.com/aaugustin/websockets
[3] https://github.com/pytest-dev/pytest-asyncio
[4] https://github.com/pytest-dev/pytest
[5] https://github.com/pytest-dev/pluggy