Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow per-snapshot configuration of discovery.networkIdleTimeout #1360

Open
Conduitry opened this issue Aug 31, 2023 · 2 comments
Open

Allow per-snapshot configuration of discovery.networkIdleTimeout #1360

Conduitry opened this issue Aug 31, 2023 · 2 comments
Labels
✨ enhancement New feature or request

Comments

@Conduitry
Copy link

If I have just a couple of snapshots that are flaky because the default discovery network idle timeout is too low, it would be convenient to be able to specify an increased value specifically for those snapshots - without increasing it unnecessarily for all snapshots, slowing down the build.

As far as I can tell, this is not supported. Is there another way to achieve a similar result?

@itsjwala
Copy link
Contributor

itsjwala commented Sep 1, 2023

Currently, there isn't a way if you're using percy exec -- based SDK

though if you're using percy snapshot ... there is a workaround where you can pass in execute function OR waitForTimeout which would be executed before taking snapshot.

serve: './'

snapshots:
- name: sample snapshot
  url: /sample.html
  widths: [1280]
  waitForTimeout: 2000
  execute: |
    async () => {
        function sleep(time) {
          return new Promise((resolve) => setTimeout(resolve, time));
        }
        await sleep(2000);
    }

@itsjwala itsjwala added the ✨ enhancement New feature or request label Sep 1, 2023
@itsjwala
Copy link
Contributor

itsjwala commented Sep 1, 2023

we'd be happy to receive a PR, it will require change here - ref { and associated readme and tests)

we'll need to add networkIdleTimeout entry there, post which we can pass like below to make it work

with percy snapshot ...

serve: './'

snapshots:
- name: sample snapshot
  url: /sample.html
  widths: [1280]
  discovery:
    networkIdleTimeout: 500

or if using percy exec ...

await percySnapshot(page, 'sample snapshot', {
   discovery: {
    networkIdleTimeout: 500
   }
});

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

No branches or pull requests

2 participants