Skip to content

test: port the upstream tests by registry id - #3269

Closed
Pavel Feldman (pavelfeldman) wants to merge 1 commit into
microsoft:mainfrom
pavelfeldman:test-registry
Closed

Pavel Feldman (pavelfeldman) wants to merge 1 commit into
microsoft:mainfrom
pavelfeldman:test-registry

Conversation

@pavelfeldman

Copy link
Copy Markdown
Member

Summary

  • Port every test in upstream's tests/registry.md to tests/async and tests/sync, named test_<ID>_<title>, or list it in tests/upstream_not_ported.txt with the reason (3699 ported, 1234 not ported).
  • scripts/check_test_registry.py checks the coverage; CI runs it in the lint job.
  • Sync tests/assets with upstream; extend the test server, fixtures and helpers that the ported tests need.
  • Mark Python client bugs that the ported tests find as strict xfails (reason="python: ...").
  • Move the older tests to tests/{async,sync}/legacy.

@pavelfeldman
Pavel Feldman (pavelfeldman) force-pushed the test-registry branch 4 times, most recently from 7453f2c to 0805ec6 Compare October 18, 2026 03:18
Port every test in upstream's tests/registry.md to tests/async and
tests/sync, 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 older tests move
to tests/{async,sync}/legacy.

Fix the client bugs that the ports found, so that the same tests pass
as with Node.js, and roll the driver to 1.65.0-alpha-2026-10-17.
CI runs the tests in parallel with pytest-xdist, on fewer bots.
test.sh runs the library tests under xvfb.
artifacts_dir: Optional[Union[str, Path]],
) -> Browser:
# Port of BrowserType.connectOverCDP() in client/browserType.ts.
if self.name != "chromium" and self.name != "webkit":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I'd prefer checks like this on the server side.

headers: Optional[Dict[str, str]],
expose_network: Optional[str],
) -> Browser:
# Like @apiCall() in client/browserType.ts: the errors that the client

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why not use the actual @apiCall?

return_when=asyncio.FIRST_COMPLETED,
)
def close_connection() -> None:
# Port of connection.close() in client/connection.ts, which also closes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are quite a few useless comments 😄

_PLAYWRIGHT_MODULE_PATH = os.path.join(str(Path(playwright.__file__).parents[0]), "")


def _non_user_code_dirs() -> Tuple[str, ...]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a separate PR, it is a behavior change. Also, stack parsing in python historically was a performance-sensitive place.

raise Error(error)
failed: asyncio.Future = self._loop.create_future()
failed.set_exception(Error(error))
await waiter.wait_for_future(failed)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is "raise Error" not enough here?

_MAX_IDLE_YIELDS = 100


async def _yield_until_idle() -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is worth a separate PR for sure!


def _json_stringify(value: str) -> str:
# JSON.stringify() of a string.
return json.dumps(value, ensure_ascii=False)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is "no ascii" important here? Why not use a shared one from 'helper'?

return resolved, case_insensitive_prefix
except Exception:
# new URL(givenURL, baseURL); None where it throws.
url = parse_url(given_url, base_url)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This place has a loaded history, most likely will lead to regressions.

@@ -26,32 +28,48 @@


class Waiter:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unclear what's going on in this file. Perhaps it fixes some tests, but there is no way to know which ones.

_DEVIATION_CHARACTERS = re.compile("(" + "|".join(map(chr, (0xDF, 0x3C2))) + ")")


class URL:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what we are trying to achieve here. Again, seeing some tests will at least hint at what's going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants