🚀 Feature Request
I'd like to propose adding an option retry: boolean to test steps.
This way a whole group of actions could be retried instead of only individual ones, using steps would also enforcing a title on what they're doing.
If retry is set to true playwright would automatically retry the whole step until it passes or the timeout is exceeded.
Example
test("Reply to message", async ({ page }) => {
// If clicking the element fails, hovering will be retried as well
test.step("Reply to message", async () => {
const messageItem = page.getByText("Test Message");
await messageItem.hover({ timeout: 2_000 });
await messageItem.getByRole("button", { name: "Reply" }).click({ timeout: 2_000 });
}, { box: true, retry: true, timeout: 20_000 });
});
Motivation
I recently came across the issue that I needed to hover an element and then click a button inside the tooltip which would appear during hover. However, in some cases it could happen that the hovered element would move, closing the tooltip. Playwrights automatic retries are amazing for making single interactions retrieable but lack the option to create custom "transactions" containing multiple actions.
Creating such transactions is already possible by utilizing expect().toPass(), but it always feels "hacky" to use an assertion just to retry something.
With this proposal creating transactions would be possible without the need to create an assertion for them.
Please let me know what you think, I'm also open for other syntax suggestions on how this might be archived. :)
🚀 Feature Request
I'd like to propose adding an option
retry: booleanto test steps.This way a whole group of actions could be retried instead of only individual ones, using steps would also enforcing a title on what they're doing.
If
retryis set to true playwright would automatically retry the whole step until it passes or the timeout is exceeded.Example
Motivation
I recently came across the issue that I needed to hover an element and then click a button inside the tooltip which would appear during hover. However, in some cases it could happen that the hovered element would move, closing the tooltip. Playwrights automatic retries are amazing for making single interactions retrieable but lack the option to create custom "transactions" containing multiple actions.
Creating such transactions is already possible by utilizing
expect().toPass(), but it always feels "hacky" to use an assertion just to retry something.With this proposal creating transactions would be possible without the need to create an assertion for them.
Please let me know what you think, I'm also open for other syntax suggestions on how this might be archived. :)