Commit Graph

9 Commits

Author SHA1 Message Date
Cacie Prins
a50012b892 perf: reduce the initial timeout for proxy connections, make configurable (#31283)
* use cached preflight response on subsequent cloud requests that require a preflight

* introduce env var to skip initial proxy-api request

* rename env to CYPRESS_INTERNAL prefix

* change noproxy timeout default to 5 seconds

* fix

* rm internal

* changelog

* Update packages/server/test/unit/cloud/api/api_spec.js

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>

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

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

* fix ts

---------

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
2025-04-17 10:00:46 -04:00
Jennifer Shehane
6b28356878 chore: convert cache.js file within server to TypeScript (#31471)
* chore: convert cache.js file within server to TypeScript

* update cache calls and await them

* updates to imports and switching cache calls to await

* remove Partial from Allowed State

* change cache calls back to not await

* Remove dead code

* update memo.push return
2025-04-10 15:02:58 -04:00
Ryan Manuel
0daf7e639f chore: support studio lifecycle in protocol (#31239)
* update url with studio params

* updates

* spec updates

* adding tests

* updating changelog

* skip adding visit log during start

* update url support

* cy origin tests

* fix tests

* updates

* update origin test

* chore: support studio lifecycle in protocol

* merge changes

* fix types

* fix tests

* fix tests

* fix tests

* fix more tests

* fix more tests

* fix more tests

* fix test

* fix bugs

* fix tests

* attempt to fix test

* further fixes

* improve cloud studio enablement

* refactoring

* remove new dom link

* fix last test

* Update packages/app/cypress/e2e/studio/studio.cy.ts

* Update packages/server/lib/project-base.ts

* Update packages/proxy/lib/http/request-middleware.ts

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

* PR comments

* fix build

* fix build

* update

* Update packages/server/lib/project-base.ts

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

* fix unit test

* rework save logic

---------

Co-authored-by: Matthew Schile <mschile@cypress.io>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2025-03-13 20:30:29 -05:00
Cacie Prins
bbd7efc0dd refactor: begin to use axios for cloud api requests (#31041)
* patch axios for v8 snapshots

* export httpsAgent and httpAgent discretely

* set up axios interceptors for logging and error response transformation

* use unified error transform fn

* create instance api reqs, timeouts, tests

* move axios middleware to its own dir & refactor

* refactor error handling, enable retries in createInstance

* fix invocation of createInstance - not caught by ts because record.js is js

* retry on 500 - according to system test, this is expected behavior

* resolve snapshots, report retries to stdout

* fix cdp connection usage of shouldRetry due to newly unknown error type

* axios doesnt fully follow RequestOptions shape when adding request to https agent

* note why uri is treated as optional

* hail mary on getting axios to work with v8 snapshots

* update lockfile, force no-rewrite on more axios files

* attempt to fix v8 snapshots

* add verbose debugging to api request logging

* enable verbose api debugging on server unit tests

* fix nock pattern for createInstance

* remove request logging unit test - sinon/mocha does not assert correctly

* fix a few unit tests

* use runAllAsync rather than waiting an arbitrary time for sinon fake timer

* move create_instance spec to ts file, remove redundant test

* rm debug on ci

* clarify comment on change inpackages/network

* correct .uri property on patched RequestOptions to be optional

* rm unused log_requests.ts, DRY error messages

* resolve types with record.ts migration

---------

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
2025-03-10 10:58:09 -04:00
Ryan Manuel
bd4774fb57 chore: pass file preprocesor override to protocol as debug data (#31171)
* chore: set up sharing of react via module federation in studio

* chore: add ability to load types from the studio bundle

* fix build

* fix build

* fix build

* chore: pass file preprocesor override to protocol as debug data

* fix tests

* PR comments

* PR comment

* update types
2025-03-03 12:52:01 -06:00
Ryan Manuel
0975b2f07f feat: update the protocol to be able to flex logic based on project config (#30594)
* feat: update the protocol to be able to flex logic based on project config

* slight refactor

* Update cli/CHANGELOG.md

* Update packages/types/src/protocol.ts

* fix ts
2024-11-13 15:42:11 -06:00
Matt Schile
1b1a39e9c2 feat: (protocol) setup protocol with projectId and cloud api (#30066) 2024-08-22 09:45:59 -06: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
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