Open jofrly opened 2 months ago
Yeah, I think it will be a nice addition to have auto retries for playwright assertions. Feel free to send a PR (if you think you can work on it), or else I will pick it up in some free time.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
How would you feel about implementing the assertions with @playwright/test
's expect
?
It would make it rather easy to implement waiting behaviour to a many - if not all - of the assertions.
Yeah, this part has to be improved. Would you like to give a try and create a PR for the same?
Yeah, this part has to be improved. Would you like to give a try and create a PR for the same?
If you don't mind that I use expect
from @playwright/test
to do the underlying implementation, then I'd gladly give it a shot.
Yeah I think we can use it. I don't see any downsides of using it
Yeah I think we can use it. I don't see any downsides of using it
I made a draft PR for this. Let me know what you think.
👍 We ran into this recently as well. Having auto-retrying assertions (or access to @playwright/test
's expect
) would be super great.
Hi there,
I'm trying out adonisjs which uses japa. I wrote a test for deleting an element in a list view:
It does not behave as I would expect though. I would expect the second line to retry until the expectation is met or a timeout is exceeded. However it does not attempt to retry and instead checks once immediately after the click and then fails:
One thing that worked was adding the following line between
await page.waitForLoadState('networkidle')
(orwaitForTimeout(100)
). I don't think this should be necessary though.The playwright assertions have built in auto retries: https://playwright.dev/docs/test-assertions#auto-retrying-assertions :
await expect(locator).toHaveCount()
.The only mentions of retries in the documentation regard retrying a whole test. How should I modify my code to achieve the desired behavior?