Skip to content

✨ Do not wait for remote requests to idle during asset discovery#400

Merged
wwilsman merged 1 commit intomasterfrom
ww/no-remote-request-idle
Jun 30, 2021
Merged

✨ Do not wait for remote requests to idle during asset discovery#400
wwilsman merged 1 commit intomasterfrom
ww/no-remote-request-idle

Conversation

@wwilsman
Copy link
Copy Markdown
Contributor

What is this?

As described in #399, when requests will not be captured, they can clog up network idle and cause snapshots to take longer to process. However, if we were to untrack remote requests, as that issue suggests, pages might not yet be ready to snapshot when capturing the DOM ourselves since external resources are sometimes required by sites to load properly.

Instead, this PR adds a new feature to the network idle method to filter requests that are awaited on. This new filter can be used when not capturing our own DOM snapshot to only wait on requests from allowed hostnames.

I added a test for capturing lazy images as a precursor to a new test for not awaiting on remote resources (this test will timeout when failing). Lazy images are used in these tests because non-lazy images are normally awaited on via the document's load event, while lazy images are requested after the document's load event.

The test diff looks a little weird because I also removed an older test that was included here for coverage of the hostnameMatches function. That function now lives in @percy/client with its own tests, so the test here was unnecessary.

I'm labelling this as an enhancement as oppose to a bugfix since it's not necessarily a bug that we're waiting on all requests from the network, and this fixes #399 by further enhancing how we handle resources.

@wwilsman wwilsman added the ✨ enhancement New feature or request label Jun 29, 2021
@wwilsman wwilsman requested a review from Robdel12 June 29, 2021 23:03
Copy link
Copy Markdown
Contributor

@Robdel12 Robdel12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏁

@wwilsman wwilsman merged commit 7cdf61b into master Jun 30, 2021
@wwilsman wwilsman deleted the ww/no-remote-request-idle branch June 30, 2021 15:48
samarsault pushed a commit that referenced this pull request Mar 3, 2023
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not wait for network idle when in-flight requests will not be captured

2 participants