playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature]: check locator handlers while retrying during `locator.waitFor`

Open SUSAltd opened this issue 1 year ago • 0 comments

🚀 Feature Request

(more of an enhancement than a feature)

According to the doc, locator handlers are checked when retrying actions with actionability checks, or auto-retrying assertions. I think this should also include locator.waitFor, since they are very similar to auto-retrying assertions.

Example

I often use locator.waitFor in situations where using an expect would not be appropriate, e.g. in page fixtures (separation of "test logic" using page object model). However since waitFor does not trigger the locator handler check, I am forced to either replace it with an expect (which I prefer to avoid using in page fixtures) or something like locator.click({ trial: true }) (which feels weird and out-of-place).

Motivation

I originally was surprised to find that waitFor is not expected to trigger the locator handler check, and in my opinion it feels like a bit of an oversight. Checking locator handlers during waitFor would help make the behavior of addLocatorHandler more consistent and predictable, especially since waitFor is so functionally similar to auto-retrying assertions.

SUSAltd avatar Aug 21 '24 23:08 SUSAltd