playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature]: Set poll interval of assertion

Open chris13524 opened this issue 1 year ago • 3 comments
trafficstars

🚀 Feature Request

Ability to set the frequency of polling to something fine-grained e.g. 50ms. For example testing if an element is visible or not.

Example

No response

Motivation

We are using Playwright to measure the performance of our app. But it appears that Playwright polls elements in some cases very slowly upwards of 1s to notice a change. This leads to random changes in the perceived performance of our app. But we want to be able to measure the performance very granularly in order to detect small regressions.

chris13524 avatar Aug 22 '24 16:08 chris13524

Hi! What exact function in our API are you using for that? Where would you want to set the frequency? Feel free to share an example code snippet with the API you care about and the addition you propose.

Also, we wouldn't recommend to run assertions as part of performance testing.

Skn0tt avatar Aug 23 '24 10:08 Skn0tt

What exact function in our API are you using for that?

Just standard expects. It's a test case to run through a flow, but then we are measuring the time it takes between some (or all) of the steps.

Where would you want to set the frequency?

I was thinking on the expect level, but I'd probably want it everywhere in order for everything to be reliably fast.

we wouldn't recommend to run assertions as part of performance testing

Is there an alternative to assertions you are thinking about?

chris13524 avatar Aug 26 '24 17:08 chris13524

As a workaround, you can use expect.toPass where you can set retry intervals manually.

fdm-mateco avatar Aug 27 '24 09:08 fdm-mateco

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