Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/cypress-io/cypress into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
jennifer-shehane committed Aug 12, 2024
2 parents 977038a + 54a8932 commit 2f54717
Show file tree
Hide file tree
Showing 26 changed files with 415 additions and 317 deletions.
3 changes: 2 additions & 1 deletion .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mainBuildFilters: &mainBuildFilters
- /^release\/\d+\.\d+\.\d+$/
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- 'update-v8-snapshot-cache-on-develop'
- 'remove-json-lint'
- 'jquery-patch-remove-unload'
- 'publish-binary'
- 'chore/use_build_docker_file_for_centos7'

Expand All @@ -55,6 +55,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'chore/use_build_docker_file_for_centos7', << pipeline.git.branch >> ]
- equal: [ 'jquery-patch-remove-unload', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down
4 changes: 2 additions & 2 deletions browser-versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"chrome:beta": "128.0.6613.18",
"chrome:stable": "127.0.6533.88",
"chrome:beta": "128.0.6613.27",
"chrome:stable": "127.0.6533.99",
"chrome:minimum": "64.0.3282.0"
}
5 changes: 5 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

_Released 8/13/2024 (PENDING)_

**Bugfixes:**

- A console error will no longer display in Chrome about a deprecated unload call originating from jQuery. Addressed in [#29944](https://github.com/cypress-io/cypress/pull/29944).
- Fixed an issue where certain Test Replay upload error messages were too vague. Connection failures now report the precise system error, and the stall error message is reported rather than the vague, "The user aborted a request." Addressed in [#29959](https://github.com/cypress-io/cypress/pull/29959).

**Misc:**

- Updated `cypress open` hints displayed after Cypress binary install. Addresses [#29935](https://github.com/cypress-io/cypress/issues/29935).
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"devDependencies": {
"@cypress-design/vue-button": "^0.11.6",
"@cypress-design/vue-icon": "^0.26.0",
"@cypress-design/vue-statusicon": "^0.5.0",
"@cypress-design/vue-statusicon": "^0.5.7",
"@cypress-design/vue-tabs": "^0.5.1",
"@graphql-typed-document-node/core": "^3.1.0",
"@headlessui/vue": "1.4.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"basic-auth": "2.0.1",
"blob-util": "2.0.2",
"bluebird": "3.5.3",
"body-parser": "1.19.0",
"bytes": "3.1.0",
"body-parser": "1.20.2",
"bytes": "3.1.2",
"chai": "4.2.0",
"chai-subset": "1.6.0",
"clone": "2.1.2",
Expand Down Expand Up @@ -67,7 +67,7 @@
"mime-types": "2.1.27",
"minimatch": "3.1.2",
"mocha": "7.0.1",
"multer": "1.4.2",
"multer": "1.4.4",
"ordinal": "1.0.3",
"react-15.6.1": "npm:[email protected]",
"react-16.0.0": "npm:[email protected]",
Expand Down
36 changes: 33 additions & 3 deletions packages/driver/patches/jquery+3.4.1.dev.patch
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,40 @@ index 411a859..0000000
-});
-```
diff --git a/node_modules/jquery/dist/jquery.js b/node_modules/jquery/dist/jquery.js
index 773ad95..9e6076f 100644
index 773ad95..84ca2f6 100644
--- a/node_modules/jquery/dist/jquery.js
+++ b/node_modules/jquery/dist/jquery.js
@@ -6534,69 +6534,100 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
@@ -1100,19 +1100,17 @@ setDocument = Sizzle.setDocument = function( node ) {
docElem = document.documentElement;
documentIsHTML = !isXML( document );

- // Support: IE 9-11, Edge
- // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
- if ( preferredDoc !== document &&
- (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
+ // Support: IE 9 - 11+, Edge 12 - 18+
+ // Accessing iframe documents after unload throws "permission denied" errors (see trac-13936)
+ // Support: IE 11+, Edge 17 - 18+
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
+ // two documents; shallow comparisons work.
+ // eslint-disable-next-line eqeqeq
+ if ( preferredDoc != document &&
+ ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {

- // Support: IE 11, Edge
- if ( subWindow.addEventListener ) {
- subWindow.addEventListener( "unload", unloadHandler, false );
-
- // Support: IE 9 - 10 only
- } else if ( subWindow.attachEvent ) {
- subWindow.attachEvent( "onunload", unloadHandler );
- }
+ // Support: IE 9 - 11+, Edge 12 - 18+
+ subWindow.addEventListener( "unload", unloadHandler );
}

/* Attributes
@@ -6534,69 +6491,100 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
return delta;
}

Expand Down Expand Up @@ -220,4 +250,4 @@ index 773ad95..9e6076f 100644
+ styles
)
) + "px";
}
}
10 changes: 5 additions & 5 deletions packages/errors/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,22 +599,22 @@ export const AllCypressErrors = {
${fmt.highlightSecondary(error)}`
},
CLOUD_PROTOCOL_UPLOAD_AGGREGATE_ERROR: (error: {
errors: (Error & { kind?: 'NetworkError', url: string } | Error & { kind: 'HttpError', url: string, status?: string, statusText?: string, responseBody?: string })[]
errors: (Error & { kind?: 'SystemError', url: string } | Error & { kind: 'HttpError', url: string, status?: string, statusText?: string, responseBody?: string })[]
}) => {
if (error.errors.length === 1) {
const firstError = error.errors[0]

if (firstError?.kind === 'NetworkError') {
if (firstError?.kind === 'SystemError') {
return AllCypressErrors.CLOUD_PROTOCOL_UPLOAD_NEWORK_FAILURE(firstError as Error & { url: string })
}

return AllCypressErrors.CLOUD_PROTOCOL_UPLOAD_HTTP_FAILURE(error.errors[0] as Error & { url: string, status: number, statusText: string, responseBody: string})
}

let networkErr = error.errors.find((err) => {
return err.kind === 'NetworkError'
let systemErr = error.errors.find((err) => {
return err.kind === 'SystemError'
})
const recommendation = networkErr ? errPartial`Some or all of the errors encountered are system-level network errors. Please verify your network configuration for connecting to ${fmt.highlightSecondary(networkErr.url)}` : null
const recommendation = systemErr ? errPartial`Some or all of the errors encountered are system-level network errors. Please verify your network configuration for connecting to ${fmt.highlightSecondary(systemErr.url)}` : null

const fmtUploadError = ({ message, responseBody }: { message: string, responseBody?: string }) => {
return `${message}${responseBody ? `:\n${responseBody}\n` : ''}`
Expand Down
12 changes: 6 additions & 6 deletions packages/errors/test/unit/visualSnapshotErrors_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ describe('visual error templates', () => {
// @ts-expect-error
const aggregateError: Error & { errors: any[] } = makeErr()
// @ts-expect-error
const aggregateErrorWithNetworkError: Error & { errors: any[] } = makeErr()
const aggregateErrorWithSystemError: Error & { errors: any[] } = makeErr()

const errOne = makeErr()
const errTwo = makeErr()
Expand All @@ -708,15 +708,15 @@ describe('visual error templates', () => {
aggregateError.errors = [errOne, errTwo, errThree]

// @ts-expect-error
const errNetworkErr: Error & { kind: string, url: string } = new Error('http://some/url: ECONNRESET')
const errSystemErr: Error & { kind: string, url: string } = new Error('http://some/url: ECONNRESET')

errNetworkErr.kind = 'NetworkError'
errNetworkErr.url = 'http://some/url'
aggregateErrorWithNetworkError.errors = [errNetworkErr, errTwo, errThree]
errSystemErr.kind = 'SystemError'
errSystemErr.url = 'http://some/url'
aggregateErrorWithSystemError.errors = [errSystemErr, errTwo, errThree]

return {
default: [aggregateError],
withNetworkError: [aggregateErrorWithNetworkError],
withSystemError: [aggregateErrorWithSystemError],
}
},
CLOUD_RECORD_KEY_NOT_VALID: () => {
Expand Down
6 changes: 2 additions & 4 deletions packages/server/lib/cloud/api/put_protocol_artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import { putFetch, ParseKinds } from '../network/put_fetch'
import { isRetryableError } from '../network/is_retryable_error'
const debug = Debug('cypress:server:cloud:api:protocol-artifact')

// the upload will get canceled if the source stream does not
// begin flowing within 5 seconds, or if the stream pipeline
// the upload will get canceled if the stream pipeline
// stalls (does not push data to the `fetch` sink) for more
// than 5 seconds
const MAX_START_DWELL_TIME = 5000
const MAX_ACTIVITY_DWELL_TIME = 5000

export const _delay = linearDelay(500)
Expand All @@ -25,7 +23,7 @@ export const putProtocolArtifact = asyncRetry(
throw new Error(`Spec recording too large: artifact is ${size} bytes, limit is ${maxFileSize} bytes`)
}

const activityMonitor = new StreamActivityMonitor(MAX_START_DWELL_TIME, MAX_ACTIVITY_DWELL_TIME)
const activityMonitor = new StreamActivityMonitor(MAX_ACTIVITY_DWELL_TIME)
const fileStream = fs.createReadStream(artifactPath)
const controller = activityMonitor.getController()

Expand Down
4 changes: 2 additions & 2 deletions packages/server/lib/cloud/artifacts/upload_artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { createScreenshotArtifactBatch } from './screenshot_artifact'
import { createVideoArtifact } from './video_artifact'
import { createProtocolArtifact, composeProtocolErrorReportFromOptions } from './protocol_artifact'
import { HttpError } from '../network/http_error'
import { NetworkError } from '../network/network_error'
import { SystemError } from '../network/system_error'

const debug = Debug('cypress:server:cloud:artifacts')

Expand Down Expand Up @@ -239,7 +239,7 @@ export const uploadArtifacts = async (options: UploadArtifactOptions) => {
// eslint-disable-next-line no-console
console.log('')
errors.warning('CLOUD_PROTOCOL_UPLOAD_HTTP_FAILURE', error)
} else if (NetworkError.isNetworkError(error)) {
} else if (SystemError.isSystemError(error)) {
// eslint-disable-next-line no-console
console.log('')
errors.warning('CLOUD_PROTOCOL_UPLOAD_NEWORK_FAILURE', error)
Expand Down
12 changes: 10 additions & 2 deletions packages/server/lib/cloud/network/is_retryable_error.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { NetworkError } from './network_error'
import { SystemError } from './system_error'
import { HttpError } from './http_error'
import Debug from 'debug'

const debug = Debug('cypress-verbose:server:is-retryable-error')

export const isRetryableError = (error?: Error) => {
debug('is retryable error? system error: %s, httperror: %s, status: %d',
error && SystemError.isSystemError(error),
error && HttpError.isHttpError(error),
(error as HttpError)?.status)

return error ? (
NetworkError.isNetworkError(error) ||
SystemError.isSystemError(error) ||
HttpError.isHttpError(error) && [408, 429, 502, 503, 504].includes(error.status)
) : false
}
15 changes: 0 additions & 15 deletions packages/server/lib/cloud/network/network_error.ts

This file was deleted.

29 changes: 16 additions & 13 deletions packages/server/lib/cloud/network/put_fetch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import crossFetch from 'cross-fetch'
import { NetworkError } from './network_error'
import { SystemError } from './system_error'
import { HttpError } from './http_error'
import { ParseError } from './parse_error'
import { agent } from '@packages/network'
Expand Down Expand Up @@ -62,21 +62,24 @@ export async function putFetch <
throw parseError
}
} catch (e) {
debug('Error: %O', e)
if (ParseError.isParseError(e)) {
throw e
} else if (HttpError.isHttpError(e)) {
throw e
const err = options.signal?.aborted ? options.signal.reason : e

debug('Error (sys error? %s) %O', err.errno || err.code, err)
if (ParseError.isParseError(err) || HttpError.isHttpError(err)) {
throw err
}

// if the error wasn't a parsing error, it's probably a Network error
const url = typeof input === 'string' ? input :
input instanceof URL ? input.href :
input instanceof Request ? input.url : 'UNKNOWN_URL'
// if the error has a syscall, it's a system error
if (err.errno || err.code) {
const url = typeof input === 'string' ? input :
input instanceof URL ? input.href :
input instanceof Request ? input.url : 'UNKNOWN_URL'
const sysError = new SystemError(err, url)

const networkError = new NetworkError(e, url)
sysError.stack = err.stack
throw sysError
}

networkError.stack = e.stack
throw networkError
throw err
}
}
17 changes: 17 additions & 0 deletions packages/server/lib/cloud/network/system_error.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Node doesn't expose its own internal system error, so we have to kind of ducktype it */

const SystemErrorKind = 'SystemError'

export class SystemError extends Error {
public readonly kind = SystemErrorKind
constructor (
public readonly originalError: Error,
public readonly url: string,
) {
super(originalError.message)
}

static isSystemError (error: Error & { url?: string, kind?: string }): error is SystemError {
return error?.kind === SystemErrorKind
}
}
Loading

0 comments on commit 2f54717

Please sign in to comment.