diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index e0be254009cd..fd4fe2a5b4d7 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -7,6 +7,10 @@ _Released 2/25/2025 (PENDING)_ - Firefox versions 135 and up are now automated with [WebDriver BiDi](https://www.w3.org/TR/webdriver-bidi/) instead of [Chrome Devtools Protocol](https://chromedevtools.github.io/devtools-protocol/). Addresses [#30220](https://github.com/cypress-io/cypress/issues/30220). +**Bugfixes:** + +- Fixed the calculation of upload throughput units when displaying the 'stream stalled' error message during Test Replay archive uploads. Fixes [#31075](https://github.com/cypress-io/cypress/issues/31075). Addressed in [#31160](https://github.com/cypress-io/cypress/pull/31160). + **Misc:** - Viewport width, height, and scale now display in a badge above the application under test. The dropdown describing how to set viewport height and width has been removed from the UI. Additionally, component tests now show a notice about URL navigation being disabled in component tests. Addresses [#30999](https://github.com/cypress-io/cypress/issues/30999). Addressed in [#31119](https://github.com/cypress-io/cypress/pull/31119). diff --git a/packages/errors/__snapshot-html__/CLOUD_PROTOCOL_UPLOAD_STREAM_STALL_FAILURE.html b/packages/errors/__snapshot-html__/CLOUD_PROTOCOL_UPLOAD_STREAM_STALL_FAILURE.html index 12d1c1da3408..e90fe847b734 100644 --- a/packages/errors/__snapshot-html__/CLOUD_PROTOCOL_UPLOAD_STREAM_STALL_FAILURE.html +++ b/packages/errors/__snapshot-html__/CLOUD_PROTOCOL_UPLOAD_STREAM_STALL_FAILURE.html @@ -36,12 +36,12 @@
Warning: We encountered slow network conditions while uploading the Test Replay recording for this spec.
 
-The upload transfer rate fell below 102.4kbps over a sampling period of 5000ms.
+The upload transfer rate fell below 6.4kbps over a sampling period of 10 seconds.
 
 To prevent long CI execution durations, this Test Replay recording will not be uploaded.
 
 The results for this spec will not display Test Replay recordings.
 
-If this error occurs often, the sampling period may be configured by setting the CYPRESS_TEST_REPLAY_UPLOAD_SAMPLING_INTERVAL environment variable to a higher value than 5000.
+If this error occurs often, the sampling period may be configured by setting the CYPRESS_TEST_REPLAY_UPLOAD_SAMPLING_INTERVAL environment variable to a higher value than 10000.
 
 
\ No newline at end of file diff --git a/packages/errors/src/errors.ts b/packages/errors/src/errors.ts index 7fdfb518abb7..702ce8d5eb97 100644 --- a/packages/errors/src/errors.ts +++ b/packages/errors/src/errors.ts @@ -604,13 +604,14 @@ export const AllCypressErrors = { ${fmt.highlightSecondary(error)}` }, - CLOUD_PROTOCOL_UPLOAD_STREAM_STALL_FAILURE: (error: Error & { chunkSizeKB: number, maxActivityDwellTime: number }) => { - const kbpsThreshold = (error.chunkSizeKB * 8) / (error.maxActivityDwellTime / 1000) + CLOUD_PROTOCOL_UPLOAD_STREAM_STALL_FAILURE: (error: Error & { chunkSizeBytes: number, maxActivityDwellTime: number }) => { + const dwellTimeSeconds = error.maxActivityDwellTime / 1000 + const kbpsThreshold = (error.chunkSizeBytes / 1024) / dwellTimeSeconds return errTemplate`\ Warning: We encountered slow network conditions while uploading the Test Replay recording for this spec. - The upload transfer rate fell below ${fmt.highlightSecondary(`${kbpsThreshold}kbps`)} over a sampling period of ${fmt.highlightSecondary(`${error.maxActivityDwellTime}ms`)}. + The upload transfer rate fell below ${fmt.highlightSecondary(`${kbpsThreshold}kbps`)} over a sampling period of ${fmt.highlightSecondary(`${dwellTimeSeconds} seconds`)}. To prevent long CI execution durations, this Test Replay recording will not be uploaded. diff --git a/packages/errors/test/unit/visualSnapshotErrors_spec.ts b/packages/errors/test/unit/visualSnapshotErrors_spec.ts index 70b00d81e01a..5f9512adf1d7 100644 --- a/packages/errors/test/unit/visualSnapshotErrors_spec.ts +++ b/packages/errors/test/unit/visualSnapshotErrors_spec.ts @@ -697,10 +697,10 @@ describe('visual error templates', () => { }, CLOUD_PROTOCOL_UPLOAD_STREAM_STALL_FAILURE: () => { // @ts-expect-error - const err: Error & { chunkSizeKB: number, maxActivityDwellTime: number } = new Error('stream stall') + const err: Error & { chunkSizeBytes: number, maxActivityDwellTime: number } = new Error('stream stall') - err.chunkSizeKB = 64 - err.maxActivityDwellTime = 5000 + err.chunkSizeBytes = 65536 + err.maxActivityDwellTime = 10000 return { default: [err], diff --git a/packages/server/lib/cloud/upload/stream_activity_monitor.ts b/packages/server/lib/cloud/upload/stream_activity_monitor.ts index e1d6a6b2e869..e861fd987b03 100644 --- a/packages/server/lib/cloud/upload/stream_activity_monitor.ts +++ b/packages/server/lib/cloud/upload/stream_activity_monitor.ts @@ -31,7 +31,7 @@ const debugVerbose = Debug('cypress-verbose:server:cloud:stream-activity-monitor * */ -const DEFAULT_FS_READSTREAM_CHUNK_SIZE = 64 * 1024 // Kilobytes +const DEFAULT_FS_READSTREAM_CHUNK_SIZE_BYTES = 64 * 1024 // 64 kB export class StreamActivityMonitor { private streamMonitor: Transform | undefined @@ -78,7 +78,7 @@ export class StreamActivityMonitor { debug('marking activity interval') clearTimeout(this.activityTimeout) this.activityTimeout = setTimeout(() => { - this.controller?.abort(new StreamStalledError(this.maxActivityDwellTime, DEFAULT_FS_READSTREAM_CHUNK_SIZE)) + this.controller?.abort(new StreamStalledError(this.maxActivityDwellTime, DEFAULT_FS_READSTREAM_CHUNK_SIZE_BYTES)) }, this.maxActivityDwellTime) } } diff --git a/packages/server/lib/cloud/upload/stream_stalled_error.ts b/packages/server/lib/cloud/upload/stream_stalled_error.ts index 04b8c76558a0..e2608ae0c7a1 100644 --- a/packages/server/lib/cloud/upload/stream_stalled_error.ts +++ b/packages/server/lib/cloud/upload/stream_stalled_error.ts @@ -5,9 +5,9 @@ export class StreamStalledError extends Error { constructor ( public readonly maxActivityDwellTime: number, - public readonly chunkSizeKB: number, + public readonly chunkSizeBytes: number, ) { - super(`Stream stalled: failed to transfer ${chunkSizeKB} kilobytes over the previous ${maxActivityDwellTime}ms`) + super(`Stream stalled: failed to transfer ${chunkSizeBytes} bytes over the previous ${maxActivityDwellTime}ms`) } public static isStreamStalledError (error: Error & {kind?: any}): error is StreamStalledError {