Repository navigation
feat(v2): add playwright/_impl_v2, a line-by-line port of the JS client - #3275
Closed
Pavel Feldman (pavelfeldman) wants to merge 4 commits into
Closed
Pavel Feldman (pavelfeldman) wants to merge 4 commits into
Pavel Feldman (pavelfeldman) wants to merge 4 commits into
Conversation
Port every test in upstream's tests/registry.md at b335271c (the tests
are those of 6bbe2475b, its parent) to tests/{async,sync}/{page,library},
named after its id and title, or list it in tests/upstream_not_ported.txt
with the reason. scripts/check_test_registry.py checks this in CI.
The test assets, the test server and the certificates are upstream's.
The older tests move to tests/{async,sync}/legacy, with the changes that
the new files need: paths, keyboard.html, consolelog.html, the
certificate, the response headers of the server, and page.pause() in
upstream's test mode.
The ports are not collected yet: they run with the line-by-line port of
the client.
Port packages/playwright-core/src/client at b335271c (the client is the same as at 6bbe2475b) to playwright/_impl_v2, with its own ports of the isomorphic, protocol and utils code that it uses. From playwright/_impl it uses only the public error classes, FormData, the generated API types, the driver location and the protocol check. scripts/codegen/generate_protocol.py also writes its protocol channels, types and validator. PW_IMPL=v2 switches the async API to it, and tests/conftest.py then runs all of tests/async on it. CI does not run it yet. The tests are not marked: some of them fail.
- Raise the public error classes, so that `type(e) is TimeoutError` holds, and name the Python options in the validation errors. - The next API call raises the error of an event listener, as in v1. - Start the calls of the expect_*() methods eagerly, as a JS async function starts, and run the timers as macrotasks: a timer waits until the event loop is idle. - Name the API call of a coroutine that runs in a task of its own. - The validator sends None inside arrays as JSON null. - Device descriptors have the Python option names; expect.soft uses the scope that pytest-playwright opens. - Older tests that check v1 behavior where v2 follows upstream have a v1 variant (@only_v1) and a v2 variant (<test>_v2, @only_v2). - BT-046 waits for the WebSocket request as upstream does; DB-007 makes its internal call through the v2 client. - ST-011 is not ported: the driver replaces lone surrogates for clients other than JavaScript. - test.sh also runs v2.
…python - CI runs v2 on Ubuntu with Chromium and Python 3.12. - An older test that checks v1 behavior where v2 follows upstream is marked @only_v1 with the tests that cover v2: the port of the upstream test, or a Python-only test of v2 in tests/async/python, which v1 does not run. The v2 variants that repeated an upstream port are removed. - ST-011 is ported again, as an expected failure: the driver replaces lone surrogates with U+FFFD for clients other than JavaScript.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
playwright/_impl_v2: a line-by-line port of the JS client at b335271c, behindPW_IMPL=v2(async API only). The second commit is the raw port, the third has the fixes that the tests found; review commit by commit.playwright/_impl) is unchanged and runs the older tests. v2 runs all oftests/async; CI runs it on Ubuntu with Chromium.