playwright icon indicating copy to clipboard operation
playwright copied to clipboard

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

Open Az8th opened this issue 1 year ago • 1 comments

🚀 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 avatar Oct 16 '24 10:10 Az8th

The same could also be done with to toHaveCount

Az8th avatar Oct 16 '24 10:10 Az8th

Just stumbled upon another usecase : checking an element color, it would be nice to be able to click on the element, and select from a color palette, with the current one selected as default

Az8th avatar Oct 31 '24 14:10 Az8th

Why was this issue closed?

Thank you for your involvement. This issue was closed due to limited engagement (upvotes/activity), lack of recent activity, and insufficient actionability. To maintain a manageable database, we prioritize issues based on these factors.

If you disagree with this closure, please open a new issue and reference this one. More support or clarity on its necessity may prompt a review. Your understanding and cooperation are appreciated.

pavelfeldman avatar Sep 04 '25 01:09 pavelfeldman