microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.41k stars 3.63k forks source link

[Feature]: [Codegen] Add expect(page).toHaveURL() capability to the toolbar #33139

Open Az8th opened 5 days ago

Az8th commented 5 days ago

🚀 Feature Request

Hello !

Since #17179, the automatic generation of URL assertions when using the test generator has been removed, so it's no longer possible to add them natively, unless doing so directly in the code, which is what codgen is supposed to avoid.

It would be then be nice to retreive this possibility without reverting back to unwanted checks.

I then propose to add a button to do so, in the same fashion than the current existing assert text, which would default to the actual URL as a placeholder (Maybe regex with subdirectories and path would be preferable ?)

Unfortunately, I don't have a sufficient understanding of the Playwright internal architecture to produce a pull request, but I would be happy to help and would be grateful to anyone who wants to do so ;)

Example

Image Image

Motivation

Would enhance code generation and reduce manipulations needed afterwards.

Az8th commented 5 days ago

The same could also be done with to toHaveCount