Skip to content

Conversation

cacieprins
Copy link
Contributor

@cacieprins cacieprins commented Oct 2, 2025

  • Closes

Additional details

System tests currently fetch typescript definitions and example payloads for API endpoints when they run. This ensures our api calls are supported properly by the server.

This adds the same functionality to packages/server, so we can make sure our api functions use up-to-date typedefs from Cypress Cloud

Steps to test

How has the user experience changed?

PR Tasks


Note

Switches server Cloud API to typed request/response models from Cloud validations and adds scripts to sync/ensure those types, with minor runtime guards and error-handling refactors.

  • Type safety via Cloud validations:
    • Replace inlined types with Cloud validation types in lib/cloud/api/index.ts and lib/cloud/api/create_instance.ts (e.g., PostRun*, PostRunInstance*, PostInstance*, PutInstance*).
    • Tighten method signatures/return types (e.g., createRun, createInstance, postInstanceTests, postInstanceResults, updateInstanceStdout, updateInstanceArtifacts, utilities like ping, getAuthUrls).
  • Build/tooling:
    • Add scripts/sync-cloud-validations.sh to fetch cloudValidations.d.ts from Cloud and annotate with ETag.
    • Wire scripts: sync-cloud-validations, ensure-cloud-validations; run on postinstall, build-prod, and check-ts in packages/server/package.json.
    • Add zod dependency; ignore generated lib/validations in .gitignore.
  • Runtime changes:
    • Only prepare protocol when script exists and testingType is e2e or component.
    • Refactor _postInstanceTests and its caller to async/await with try/catch; on failure, log and allow browser to hang without invoking callback.

Written by Cursor Bugbot for commit 5ff0444. This will update automatically on new commits. Configure here.

Copy link

cypress bot commented Oct 2, 2025

cypress    Run #66389

Run Properties:  status check failed Failed #66389  •  git commit d7e2dd8939: Merge branch 'develop' into chore/use-api-typedefs
Project cypress
Branch Review chore/use-api-typedefs
Run status status check failed Failed #66389
Run duration 16m 42s
Commit git commit d7e2dd8939: Merge branch 'develop' into chore/use-api-typedefs
Committer Cacie Prins
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 11
Tests that did not run due to a failure in a mocha hook  Skipped 4
Tests that passed  Passing 677
View all changes introduced in this branch ↗︎

Warning

Partial Report: The results for the Application Quality reports may be incomplete.

UI Coverage  27.27%
  Untested elements 8  
  Tested elements 3  
Accessibility  97.1%
  Failed rules  1 critical   1 serious   0 moderate   0 minor
  Failed elements 3  

Tests for review

Failed  cypress/e2e/studio/studio.cy.ts • 1 failed test • app-e2e

View Output

Test Artifacts
Cypress Studio > updates an existing test with assertions Test Replay Screenshots
Flakiness  runner/runner.ui.cy.ts • 1 flaky test • app-e2e

View Output

Test Artifacts
src/cypress/runner > reporter interaction > user can stop test execution Test Replay Screenshots
Flakiness  cypress-origin-communicator.cy.ts • 1 flaky test • app-e2e

View Output

Test Artifacts
Cypress In Cypress Origin Communicator > primary origin memory leak prevention > cleans up the primaryOriginCommunicator events when navigating away from the /specs to /runs Test Replay Screenshots

@cacieprins cacieprins marked this pull request as ready for review October 3, 2025 15:09
@cacieprins cacieprins self-assigned this Oct 3, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

.catch((err: any) => {
onError(err)

return responseDidFail
Copy link
Contributor

Choose a reason for hiding this comment

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

do we no longer need this logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's still there, just without the boolean flag. This "hanging" behavior is further down in the catch block that BugBot is complaining about.

"dev": "node index.js",
"docker": "cd ../.. && WORKING_DIR=/packages/server ./scripts/run-docker-local.sh",
"postinstall": "patch-package",
"postinstall": "patch-package && yarn sync-cloud-validations",
Copy link
Contributor

Choose a reason for hiding this comment

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

if we are doing this at the package level, do we still need to call it in CI after the build? Would be nice to get rid of this https://github.com/cypress-io/cypress/blob/develop/.circleci/src/pipeline/@pipeline.yml#L201

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a fully separate cloud validations download, combining them was out of scope for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants