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 controlling the time to wait for idle network #185

Closed
derevnjuk opened this issue Feb 2, 2023 · 0 comments · Fixed by #186
Closed

Allow controlling the time to wait for idle network #185

derevnjuk opened this issue Feb 2, 2023 · 0 comments · Fixed by #186
Assignees
Labels
Type: enhancement New feature or request.

Comments

@derevnjuk
Copy link
Member

derevnjuk commented Feb 2, 2023

Description
As a user, I would like the ability to control the amount of time the plugin waits for an idle network before saving a HAR file. Currently, the waiting time is fixed and cannot be adjusted to my needs.

Possible solution
Provide a user-adjustable setting for the time the plugin waits for an idle network before saving, allowing for greater flexibility and customization.

cy.saveHar({
  waitForIdle: true,
  idleThreshold: 1000,
  idleDuration: 20000,
});

Additional context
This feature would be particularly useful for users with varying network conditions and workloads, as it would allow for a more seamless and efficient user experience.

@derevnjuk derevnjuk added the Type: enhancement New feature or request. label Feb 2, 2023
@derevnjuk derevnjuk self-assigned this Feb 2, 2023
derevnjuk added a commit that referenced this issue Feb 2, 2023
derevnjuk added a commit that referenced this issue Feb 2, 2023
derevnjuk added a commit that referenced this issue Feb 3, 2023
derevnjuk added a commit that referenced this issue Feb 3, 2023
derevnjuk added a commit that referenced this issue Feb 3, 2023
derevnjuk added a commit that referenced this issue Feb 3, 2023
You can pass the `waitForIdle` option to wait for all pending requests
to complete before saving the HAR file:

```js
cy.saveHar({ waitForIdle: true });
```

This option is false by default. When set to true, the plugin will
monitor the count of pending requests and wait for it to reach zero
before proceeding with saving the HAR file. This ensures that all
responses have been received and the data in the file is complete and
accurate.

Additionally, you can pass the `maxWaitDuration` option to specify the
maximum time to wait for the pending requests to complete:

```js
cy.saveHar({ waitForIdle: true, maxWaitDuration: 20000 });
```

The `maxWaitDuration` option is set to 5000 milliseconds by default,
meaning it will wait for 5 seconds until all pending requests have
completed.

You can also pass the `minIdleDuration` option to specify the minimum
duration in milliseconds to wait for the network idle during the
`maxWaitDuration` time. The network is idle if there are no pending requests during this
time.

```js
cy.saveHar({ waitForIdle: true, minIdleDuration: 1000 });
```

The `minIdleDuration` option is set to 100 milliseconds by default.

closes #185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: enhancement New feature or request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant