Commit Graph

59 Commits

Author SHA1 Message Date
Cacie Prins 3c28109185 fix: non-JSON response body display for upload errors (#29801)
* WIP - system test snapshots

* bolster error output for response body potential on upload network errors

* edit error output for readability

* changelog

* Update packages/server/lib/cloud/artifacts/upload_artifacts.ts

Co-authored-by: Matt Schile <mschile@cypress.io>

* fix partial rename

* fix system test for single upload error vs aggregate

---------

Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2024-07-12 14:52:40 -04:00
Cacie Prins 5f2236e6cc fix: do not re-use readstreams when retry an upload of the test replay recording (#29745)
* custom async retry for any async fn

* "proxied" fetch for PUT, throwing http errors

* cleans up put_fetch return types & parsing

* move protocol upload logic to put_protocol_artifact, rm upload_stream

* changelog

* changelog

* manually fix wsp in snapshot

* reorganizes a little, properly tests retryable logic

* removes 408 as a non-retriable error in unit test

* make expectation to be resolved more clear

* rm unnecessary type coercion

* changelog

* Update cli/CHANGELOG.md

* asyncRetry only throws Aggregate errors if there is more than one attempt

* Update packages/server/test/unit/cloud/network/is_retryable_error_spec.ts

Co-authored-by: Matt Schile <mschile@cypress.io>

* Update packages/server/test/unit/cloud/network/is_retryable_error_spec.ts

---------

Co-authored-by: Matt Schile <mschile@cypress.io>
2024-07-08 09:30:05 -04:00
Emily Rohrbough 5c3a8dc7fc fix: [protocol] throw error verifying sig (#29603)
* [protocol] throw error verifying sig

Not throwing is surfacing as an upload error when it's a download error.

* adds system test snapshot for invalid signature

* changelog

* pending

* Update cli/CHANGELOG.md

---------

Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com>
Co-authored-by: Cacie Prins <cacie@cypress.io>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2024-06-11 14:18:15 -04:00
Cacie Prins cec7a1b098 misc: receive afterSpec durations from app capture code, and report them to the Cloud API (#29500)
* misc: report protocol capture afterSpec duration to cloud

* WIP: collecting afterSpec durations, TODO: system test scaffolding

* push all afterSpec timings to cloud

* push afterSpecTotal instead of afterSpec property

* changelog

* fix trailing slash in readme

* fix afterspec duration unit test

* correct return signature of afterSpec; add debug

* changelog

* Update packages/server/lib/cloud/api/index.ts

Co-authored-by: Ryan Manuel <ryanm@cypress.io>

* Update packages/server/lib/cloud/protocol.ts

* fix ts check

* fix unit tests re: expected afterSpec sig

* fix return sig of protocol afterSpec stub for system tests

* use env var directly in tests for capture error codepath, rather than override var

* rm unused param

* bump cache

* changelog

* remove pending runnables duration from afterspec report

---------

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2024-06-11 13:31:54 -04:00
Cacie Prins b62fc3fdbc fix: no longer use capture script url as default upload url for test replay recordings (#29512)
* fix: no longer attempt to upload to capture script location

* changelog
2024-05-17 11:27:31 -04:00
Cacie Prins fc88764ad5 feat: more informative error messages when Test Replay fails to capture (#29312)
* new error messages

* errors for initialization and capturing test replay

* messaging the case where no protocol instance but also no fatal error

* adds suggested remedies to initialization errors

* differentiation between network and http errors, initial work on db missing error

* improve db not found error

* add new error type to schema

* rm commented dead code

* clean up network error creation in uploadStream

* make artifact confirmation error msg more general

* test display of put instance artifacts failure

* changelog

* ensure we are displaying errors even in quiet mode

* fix pending changelog

* new snapshots for protocol errors

* improve aggregate error

* resolved html error snapshots

* fix check-ts

* fix test

* sanitize temp dir in CLOUD_PROTOCOL_CAPTURE_FAILURE error msg

* changelog

* fix double entry of certain network errors, error message prop for network errors

* fix url arg for network error

* Update packages/server/lib/cloud/artifacts/upload_artifacts.ts

Co-authored-by: Ryan Manuel <ryanm@cypress.io>

* rm extra formatting from debug

* snapshot whitespace

* changelog update

* +pending

* Update cli/CHANGELOG.md

* resolve snapshots?

* does moving the stack trace fix whitespace in snapshots in ci?

* maybe fixes whitespace on electron now?

* fully normalize stack traces

* remove full normalization

* maybe debug stack normalization

* rm stack traces from error messages

---------

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
2024-05-01 14:32:53 -04:00
Cacie Prins 79a267c7f8 refactor: extract artifact upload process from lib/modes/record.js (#29240)
* refactor record.js to extract upload logic into ts
- streamlines the main uploadArtifact fn
- extracts artifact specific logic to artifact classes
- fully defines types for upload processing and reporting

* tweak refactors so system tests produce same snapshots

* some todos, fixes exports/imports from api/index.ts

* fix api export so it can be imported by ts files

* cleans up types

* extracting artifact metadata from options logs to debug but does not throw if errors are encountered

* fix type imports in print-run

* fix debug formatting for artifacts

* fix reporting successful protocol uploads

* change inheritence to strategy

* rm empty file

* Update packages/server/lib/cloud/artifacts/upload_artifacts.ts

* makes protocolManager optional to uploadArtifacts, fixes conditional accessor in protocol fatal error report

* missed a potentially undef

* convert to frozen object / keyof instead of string composition for artifact kinds

---------

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2024-04-12 09:20:54 -04:00
Ryan Manuel 1ae7c9ef42 fix: re-initialize DOM subscriptions from a full snapshot on cdp reconnect (#29210)
* fix: re-initialize DOM subscriptions from a full snapshot on cdp reconnect

* add test

* add changelog

* Update cli/CHANGELOG.md

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* Update CHANGELOG.md

---------

Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2024-03-29 17:04:32 -05:00
Cacie Prins 3a739f3f4f perf: improve replay upload resiliency (#29174)
* tbd

* workable templated filestream uploader

* clean up async assertions

* upload stream uses activity monitor to detect start timeouts and stalls

* makes uploadStream retryable

* filesize detection, enoent errors, and testable retry delays

* extract fs logic to putProtocolArtifact, impl putProtocolArtifact

* aggregate errors for retryable upload streams

* fixes imports from moving api.ts, uses new upload mechanism in protocol.ts

* use spec_helper in StreamActivityMonitor_spec due to global sinon clock changes

* fix putProtocolArtifact specs when run as a part of the unit test suite

* fix return type of ProtocolManager.uploadCaptureArtifact

* convert from whatwg streams back to node streams

* extract HttpError

* ensure system test snapshots

* changelog

* more changelog

* fix unit tests

* fix api ref in integration test

* fix refs to api in snapshotting and after-pack

* small edits

* Update packages/server/lib/cloud/api/HttpError.ts

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* Update packages/server/lib/cloud/upload/uploadStream.ts

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* camelcase -> snakeCase filenames

* improve docs for StreamActivityMonitor

* added documentation to: upload_stream, put_protocol_artifact_spec

* move stream activity monitor params to consts - no magic numbers. docs.

* Update packages/server/lib/cloud/api/http_error.ts

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* Update packages/server/test/unit/cloud/api/put_protocol_artifact_spec.ts

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* fix check-ts

* fix imports in put_protocol_artifact_spec

* Update packages/server/test/unit/cloud/upload/stream_activity_monitor_spec.ts

Co-authored-by: Ryan Manuel <ryanm@cypress.io>

* api.ts -> index.ts

* fix comment style, remove confusingly inapplicable comment about whatwg streams

---------

Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
2024-03-29 12:22:57 -04:00
Cacie Prins 006faaa3ae chore: additional context on protocol upload network errors (#28986)
* chore: add additional context to messaging when network errors occur in protocol uploads

* reduce total attempts for uploading capture artifacts from 8 to 3
2024-03-06 12:49:16 -05:00
Cacie Prins 7ba92b91e5 misc: persist upload timings to cy cloud (#28418)
* feat: report artifact upload durations to cy cloud for monitoring

* round upload durations to nearest ms

* update changelog

* revert changelog, fix typo in comment

* no longer round uploadDuration - api now accepts floats

* updates changelog

* update api spec for refactored signature on api.updateInstanceArtifacts

* Update CHANGELOG.md

* Update system-tests/test/record_spec.js

Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>

* rm defunct comment

* rm non-null accessors, this spec is not ts

---------

Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
2023-11-29 15:33:35 -05:00
Ryan Manuel dbd213926c fix: issue with proxy correlations and web/shared workers (#28105) 2023-10-23 22:26:21 -05:00
Jim Hays 34c8b1f884 refactor: Spellcheck (#27964)
Co-authored-by: Matthew Schile <mschile@cypress.io>
2023-10-11 10:06:10 -04:00
Ryan Manuel 078dc0a81e fix: support proxy correlation timeout notifications and additional proxy data (#27976) 2023-10-10 16:19:37 -05:00
Ryan Manuel 311001b7d1 chore: improve logging on retried upload failures (#27847) 2023-09-20 16:23:42 -05:00
Ryan Manuel d8b48211c0 fix: ensure that fatal protocol errors are only limited to the spec they occurred on (#27720) 2023-08-31 11:01:50 -05:00
Ryan Manuel 7072f3c168 fix: make CDP errors non fatal (#27709) 2023-08-30 14:47:11 -05:00
Ryan Manuel af12aa01e0 fix merge 2023-08-25 10:19:35 -05:00
Cacie Prins 626550e9f6 chore: add mountVersion to props passed to protocol setup (#27645)
* add mountVersion to metadata passed to set up protocol capture

* chore: pass mount version to protocol setup

* update tests
2023-08-25 09:30:15 -04:00
Ryan Manuel 43821bf53d feat: handle empty response bodies by communicating them to the protocol from the proxy (#27606) 2023-08-21 19:31:40 -05:00
Cacie Prins b7b95e922d chore: fix artifact report schema (#27596)
* ensure fatal error reports for protocol include a url entry, even if not applicable

* inconsequential debug msg change to alleviate semantic commit check warning
2023-08-21 19:03:29 -04:00
Ryan Manuel 462ee04df9 feat: enable the protocol to retrieve response bodies from the network proxy (#27462)
Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Cacie Prins <cacie@cypress.io>
Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
fix: do not correlate cached requests in the proxy (#27525)
2023-08-15 13:41:36 -05:00
Cacie Prins 47b18d2268 chore: additional metadata for protocol capture errors (#27507)
* split protocol errors into fatal/nonfatal

* change test stubs to implement capture protocol iface

* attach spec and project metadata to nonfatal error reports

* starting to test error reporting

* properly report fatal errors to artifact endpoint

* more meaningful error reporting

* better error reporting for protocol download + initialization errors

* refactgor protocol stubs for easier instantiation and use

* tests for beforeSpec error state

* fixes api spec tests

* code review comments

* revert import style for routes to appease tscheck

* update snapshots

* fix typedef for ArtifactLike, set error message on beforeSpec stub
2023-08-15 10:37:59 -04:00
Matt Schile 9bfa454ad3 chore: updating protocol to support test isolation off (#27523) 2023-08-14 13:02:06 -06:00
Ryan Manuel 6ac7febe2d feat: remove protocol environment variable from binary (#27506) 2023-08-11 16:02:32 -05:00
Cacie Prins fff74900fb feat: protocol terminal output (#27402)
* uploading initiation & legit no upload messaging

* report errors

* makes upload reporting uniform across artifact types

* retrieve capture meta from correct cloud endpoint

* moves skipped artifact insertion to more reasonable point

* rm unneccessary paren around Promise.all on upload

* improve zipped filesize determination for protocol uploads, clean up get db signature in protocol manager

* changelog

* add url onto protocol failure report

* rm unused err.cause consts

* ensure artifact PUT server mock resolves in system tests

* extract terminal output logic from upload flow, mask filepaths and filesizes in system tests

* update return shape for postRun when test replay is enabled

* pad beginning of liine for upload reports

* update upload messaging snapshots for record spec

* improve trailing whitespace for artifact upload terminal output

* since we are now waiting for artifact report, must include urls in test assertion

* respect quiet mode

* address correct index of reqs for api reordering specs test

* updates snapshots & adds missing artifacts PUT req for api skips specs not in parallel

* updates tests for skipping specs in parallel

* update snapshot for no upload when video disabled test

* update snapshot for update instance 500

* updates snapshot for postInstanceTests 500

* update instance stdout 500 snapshot update

* improve message format when error on uploading, update snapshots

* snapshot for api retry on error

* update snapshot for sendPreflight system tests

* update snapshots for api interaction private tests limit warning

* update snapshots when over tests limit

* updates snapshots for protocol retrieval, bypass stub verification in test mode

* set gzip header on stubbed capture code server endpoint so client can verify

* accept BROWSER env var to reduce screenshot dimension difference from local to ci

* adds artifacts PUT to manifest for stdout 500 system test

* fixes snapshot browser workaround; updates url manifest for record system tests

* fix whitespace between filesize and path in upload manifest

* manually update snapshots for video_compression

* adds system tests for disabled message from server, file size exceeded

* additional tests, bugfixes

* add logging to determine source of ci error with db files

* ensure protocol tmp dir is created before tests

* rm test env force return of failed sig check on protocol runtime

* code review comments

* fix priority nums on artifact readout

* rm commented code from protocol stub
2023-08-10 13:49:13 -04:00
Ryan Manuel cf0209d9a9 feat: defer protocol manager initialization to after script load (#27347) 2023-07-26 11:02:52 -04:00
Ryan Manuel 94648cc2f4 chore: ensure that beforeTest awaits (#27274)
* chore: ensure that beforeTest awaits

* oops
2023-07-12 09:49:54 -05:00
Ryan Manuel 0dedccfcd1 feat: sync up protocol manager on after test (#27039) 2023-06-15 13:59:48 -05:00
Ryan Manuel 4d46845512 fix: disable all aspects of protocol in non chromium browsers (#26995) 2023-06-14 19:24:35 -05:00
Ryan Manuel c91358e6e7 fix: do not swallow errors on upload and handle timeouts (#26993) 2023-06-12 10:33:55 -05:00
Ryan Manuel 53b242ba7f chore: only send errors if we are not in local development mode (#26939) 2023-06-05 16:24:23 -05:00
Matt Henkes c4ad4253ef fix: Remove usage of vm2 (#26863)
* fix performance stuff -- run ci

* Update cypress.config.ts

* remove dep, add tests

* clean up

* m does not exist

* vm2 is everywhere

---------

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
2023-05-25 13:55:33 -05:00
Ryan Manuel bd5a4d02ee feat: enable crypto calls in protocol to enable hashing response bodies (#26829) 2023-05-23 16:30:27 -05:00
Matt Schile 20b5bb08d6 chore: resetting the test when top changes (#26797) 2023-05-23 08:53:26 -06:00
Matt Schile 569197c4fb chore: adding support for page:loading event (#26779) 2023-05-18 16:30:18 -06:00
Tim Griesser d2ef2c1393 feat: capture protocol delivery (#26421)
Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: David Rowe <95636404+davidr-cy@users.noreply.github.com>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
2023-05-15 14:06:27 -05:00
Ryan Manuel 435556da01 chore: add performance methods to protocol interface (#26679) 2023-05-09 09:06:48 -05:00
Matt Schile a990bec854 chore: update afterSpec to be async (#26562) 2023-04-26 09:12:40 -06:00
Matt Schile c7193d0c0c chore: adding support for url:changed (#26519) 2023-04-18 12:53:04 -06:00
Matt Schile a11a376a54 chore: adding viewport:changed to protocol (#26508) 2023-04-18 09:29:55 -06:00
Ryan Manuel 2d3650902d chore: merge develop to feat/protocol 2023-04-13 09:58:32 -05:00
Matt Henkes 62f58e00ec chore: Add open telemetry to cypress to allow us to monitor the performance of the app overtime (#26305)
* initial commit, a kinda working prototype

* Ready to test in CI

* "SyntaxError: Cannot use import statement outside a module" I blame VS code for always inserting the wrong dependency

* try using built js instead of the ts file

* typescript fixes?

* get version correctly, don't use optional chaining in child process.

* trying this, idk

* try running telemetry for driver-integration-tests-chrome

* fix missing spans, add more attributes for some spans

* fix missing spans and add suite spans

* types

* Remove un-used require

* remove spans for describe blocks in favor of the full title for tests

* migrate to sync resource discovery, start new custom exporters for spans

* encrypted

* localhost

* don't do things on child process

* latest changes

* update server start span time / add v8 snapshot span & update command span names

* prepare for sync

* don't send blank key

* make telemetry work again for sending directly to honeycomb

* web-socket exporter

* Add in IPC exporter and message the child process before disconnecting

* Use the cloud api by default

* move cloud span exporter into telemetry package

* shutdown fixes

* fix enabled

* improve types

* run in ci

* yml is the worst

* type!

* add spans for timing insights for visible areas of improvement

* type errors

* lets try sending data to staging

* types

* types again

* remove problematic attributes

* clean up exporters

* i like this better even though it doesn't seem to matter much

* some self review cleanup

* Update comment

* add debug messages

* mocha tests

* actually exit with the right code... oops

* simple mistake... have to look into how to fix with ts...

* try this i guess

* don't return undefined

* read me diagram

* color?

* no rect

* moar diagram

* docs!

* formatting

* build more binaries

* Supposedly fix cypress in cypress test failures

* test 'fixes'

* try this instead

* do not transpile cypress packages dir

* lets try escaping our regex string

* Add some diagnostics to help test the built binary....

* try a more complex solution

* fix tests probably

* just ignore the specific file

* fix unit tests

* cr updates

* Apply suggestions from code review

Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Bill Glesias <bglesias@gmail.com>

* Pr updates

* don't change the command queue

* move encoding and decoding telemetry context for ipc to the telemetry package

* build darn it

* plead for mercy from the testing gods, i merely wished to have named test reports, but clearly i have overreached.

* pr updates, send record key

* pr review

* optional chaining fails tests

* Apply suggestions from code review

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* tests for cloud-span-exporter

* bad merge

* adding tests for the remaining exporters

* note

* docs

* Correctly set test under the current run span for component testing

* gate sending the message.

* pr updates

* finally, fingers crossed.

---------

Co-authored-by: Emily Rohrbough <emilyrohrbough@yahoo.com>
Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
2023-04-08 21:18:02 -05:00
Matt Schile 7f639b8d6b chore: adding wallClockUpdatedAt to log for protocol (#26450) 2023-04-07 08:55:02 -06:00
Matt Schile c2273627fe chore: adding command log to protocol (#26387) 2023-04-05 09:41:40 -05:00
Ryan Manuel c08b827f95 chore: add schema infrastructure and switch CDP client to be passed into protocol directly (#26222)
Co-authored-by: Matt Schile <mschile@cypress.io>
2023-03-29 20:30:20 -05:00
Matt Schile eed04d57ea chore: adding beforeTest and AfterTest to protocol (#26216) 2023-03-27 11:14:46 -06:00
Matt Schile 530397f600 chore: adding runnables to protocol (#26171) 2023-03-23 18:21:29 -06:00
Ryan Manuel bbe90abee7 chore: add better-sqlite3 dependency (#26168)
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2023-03-23 12:01:13 -05:00
Ryan Manuel 32a73f740f chore: initial protocol api work (#26080)
Co-authored-by: Matt Schile <mschile@cypress.io>
2023-03-13 16:32:09 -05:00