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

feat: adding timeout option to writeFile command #19015

Merged
merged 31 commits into from
Dec 6, 2021

Conversation

tbiethman
Copy link
Contributor

@tbiethman tbiethman commented Nov 19, 2021

User facing changelog

A timeout option has been added to the writeFile command, with a default value of defaultCommandTimeout.
The default maxHttpBufferSize for the internal socket server has been increased to its maximum value.

Additional details

During the investigation of #3350, it was discovered that writing large files could take a long time and cause the command to fail due to a non-specific Mocha timeout error. Typically, this failure was the result of us spending a long time encoding a very large file or overflowing the maximum size of the HTTP buffer as defined by the socket server.

The writeFile command has been updated to receive an explicit timeout option to give users more direct control over the command timeouts. It also uses a custom timeout implementation rather than relying on the default Mocha timeout; this allows us to report a more accurate error message when a timeout does occur. The default timeout value remains the defaultCommandTimeout value from the Cypress config.

The readFile command already receives a timeout option, but it is only used as part of its associated assertion retry logic. I added a custom timeout for readFile as well to ensure that we can report the appropriate error messages when the readFile command itself times out. This doesn't require a user-facing API change.

How has the user experience changed?

Old error message:
Screen Shot 2021-12-02 at 10 26 58 AM

New error message:
Screen Shot 2021-12-02 at 10 23 07 AM

PR Tasks

  • Have tests been added/updated?
  • Has the original issue or this PR been tagged with a release in ZenHub?
  • Has a PR for user-facing changes been opened in cypress-documentation? Link
  • Have API changes been updated in the type definitions?
  • [na] Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Nov 19, 2021

Thanks for taking the time to open a PR!

@CLAassistant
Copy link

CLAassistant commented Nov 19, 2021

CLA assistant check
All committers have signed the CLA.

cli/types/cypress.d.ts Outdated Show resolved Hide resolved
@cypress
Copy link

cypress bot commented Nov 20, 2021



Test summary

18733 0 202 0Flakiness 1


Run details

Project cypress
Status Passed
Commit 6d6045b
Started Dec 6, 2021 6:19 PM
Ended Dec 6, 2021 6:31 PM
Duration 11:51 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/cypress/proxy-logging-spec.ts Flakiness
1 Proxy Logging > request logging > xhr log has response body/status code

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@tbiethman tbiethman self-assigned this Nov 29, 2021
@tbiethman tbiethman marked this pull request as ready for review November 29, 2021 17:26
@tbiethman tbiethman requested a review from a team as a code owner November 29, 2021 17:26
@tbiethman tbiethman requested review from jennifer-shehane and removed request for a team November 29, 2021 17:26
@jennifer-shehane jennifer-shehane removed their request for review November 29, 2021 17:27
mjhenkes
mjhenkes previously approved these changes Nov 30, 2021
@flotwig flotwig self-requested a review November 30, 2021 19:11
packages/driver/src/cy/commands/files.ts Outdated Show resolved Hide resolved
cli/types/cypress.d.ts Outdated Show resolved Hide resolved
@tbiethman tbiethman marked this pull request as ready for review December 3, 2021 23:33
@flotwig flotwig self-requested a review December 6, 2021 16:10
Copy link
Contributor

@flotwig flotwig left a comment

Choose a reason for hiding this comment

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

@tbiethman is there going to be a separate PR for #19142?

const verifyAssertions = () => {
return Cypress.backend('read:file', file, _.pick(options, 'encoding'))
return Cypress.backend('read:file', file, _.pick(options, 'encoding')).timeout(options.timeout)
Copy link
Contributor

Choose a reason for hiding this comment

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

So no server-side timeout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not with this PR, no. I'm going to log a separate issue to track and evaluate how we want to handle command/server timeouts and increase the determinism of those workflows.

@tbiethman
Copy link
Contributor Author

@flotwig regarding #19142, yes. #19275 has been opened in a draft state for testing

@tbiethman tbiethman merged commit 570f91d into develop Dec 6, 2021
@tbiethman tbiethman deleted the issue-3350-writefile-timeout branch December 6, 2021 21:31
@tbiethman tbiethman changed the title fix: adding timeout option to writeFile command feat: adding timeout option to writeFile command Dec 7, 2021
tgriesser added a commit that referenced this pull request Dec 8, 2021
…text

* 10.0-release: (45 commits)
  fix: various Nav Bar fixes (#19283)
  build: add patch package as a dev dependency for fe-shared
  chore: hoist is - fun with cached dependencies
  build: hoist is hard
  build: better hoisting strategy
  fix: remove windows and mac workflow from branch
  revert: remove change about node version 17
  build: remove testing of desktop-gui assets
  build: run window & mac CI in this branch
  build: more fixes
  build: remove toycode mdi from launchpad
  rename patch because of dev dep
  build: fix  merge issue in packages generation
  chore: update sass for windows compatibility
  fix: Do not crash when a ill formed URL request is proxied (#19274)
  fix: remove desktop-gui from circle.yml
  change whitepace in patch
  fix: adding timeout option to writeFile command (#19015)
  release 9.1.1
  fix: patch-package is not applied in dist'ed build (#19239)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants