Skip to content

Mock provider media requests in Playwright tests #615

Open

Description

Blocked until WordPress/openverse-frontend#881 is merged

Problem

When running e2e tests, we make network requests for media files. This can make the tests non-deterministic and slower than necessary.
Currently, in e2e tests we block the requests for images based on their extensions, and all the requests with to jamendo:
https://github.com/WordPress/openverse-frontend/blob/99a803542c46b20b7cac36bc7d421ffcaa8398af/test/e2e/utils.js#L64-L66
Audio requests for jamendo files don't have an extension that we could use, so we block all the requests with jamendo in the domain:
https://github.com/WordPress/openverse-frontend/blob/99a803542c46b20b7cac36bc7d421ffcaa8398af/test/e2e/search-query-server.spec.js#L19
We are probably missing some network requests that also need to be blocked.

Description

We need to audit what requests are being made and block them. This does not include requests to the Openverse API, which are handled by a proxy that already stops network requests and uses the pre-recorded responses in the repository in test/tapes folder.

Alternatives

We could also set up proxies for all providers, but I suspect that it would be untenable.

Additional context

It would be nice to have a way to monitor the network requests made during the e2e tests in the CI, and fail the PRs that add new un-handled network requests.

Implementation

  • 🙋 I would be interested in implementing this feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    ✨ goal: improvementImprovement to an existing user-facing feature💻 aspect: codeConcerns the software code in the repository🟩 priority: lowLow priority and doesn't need to be rushed🧱 stack: frontendRelated to the Nuxt frontend

    Type

    No type

    Projects

    • Status

      📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions