Skip to content

[Feature]: Include timeouts for APIRequestContext maxRetries option #34207

Open
@bkappelstrive

Description

@bkappelstrive

🚀 Feature Request

Extend the use case of the maxRetries option on the APIRequestContext calls (which was added for Issue 30978) to include failures due to timeouts, either due to playwright's timeout option or server timeout. At the moment it only includes retries for ECONNRESET.

In my use case we are seeing random, inconsistent timeouts occur after 30s in github CI in our setup scripts against apis that should not take that long. They normally resolve after one or two restarts of the tests, but sometimes take more retries. It is an unsolved issue atm for our specific product, but the retries in playwright could help alleviate the time spent retriggering test suites.

Here is what the error looks like

Error: apiRequestContext.get: Request timed out after 30000ms
Call log:
  - → GET https://***
  -   user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/124.0.6367.29 Safari/537.36
  -   accept: */*
  -   accept-encoding: gzip,deflate,br
  -   cookie: access_token=***

Example

It should be used the same way it's used now, only with the extended use case of including timeouts as a signal to retry.

Motivation

This feature will help API automation be more reliable and shorten time spent retriggering tests.
We have already added custom retry logic to the requests in our setup, but it would be nice to have this baked into the request context in playwright.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions