Skip to content

internal: (studio) make the protocol database accessible to studio #31443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ryanthemanuel
Copy link
Collaborator

@ryanthemanuel ryanthemanuel commented Apr 3, 2025

Additional details

This PR ensures that the new studio has access to the protocol database so that we can send snapshots of the DOM, etc. when requesting recommendations.

Steps to test

How has the user experience changed?

PR Tasks

Copy link

cypress bot commented Apr 3, 2025

cypress    Run #61421

Run Properties:  status check passed Passed #61421  •  git commit 89bb0aa178: Merge branch 'develop' into ryanm/feat/create-cdp-full-snapshot-at-timestamp
Project cypress
Branch Review ryanm/feat/create-cdp-full-snapshot-at-timestamp
Run status status check passed Passed #61421
Run duration 10m 03s
Commit git commit 89bb0aa178: Merge branch 'develop' into ryanm/feat/create-cdp-full-snapshot-at-timestamp
Committer Ryan Manuel
View all properties for this run ↗︎

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

Warning

No Report: Something went wrong and we could not generate a report for the Application Quality products.

@ryanthemanuel ryanthemanuel requested a review from Copilot April 3, 2025 15:18
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR makes the protocol database accessible to Studio by introducing new methods and properties across several modules. Key changes include:

  • Adding a setProtocolDb method to the StudioServer and StudioManager interfaces.
  • Introducing an optional database property in the ProtocolManager interface.
  • Updating unit tests to verify the new protocol database functionality.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/types/src/studio/studio-server-types.ts Adds a new method signature (setProtocolDb) to the server types.
packages/types/src/protocol.ts Introduces an optional database property in the protocol interface.
packages/server/test/unit/project_spec.js Updates tests to expect the setProtocolDb method being called.
packages/server/test/unit/cloud/studio_spec.ts Adds tests for the setProtocolDb functionality in StudioManager.
packages/server/test/unit/cloud/protocol_spec.ts Adds tests for the protocolManager.db getter.
packages/server/test/support/fixtures/cloud/studio/test-studio.ts Updates the test fixture to include a stub implementation for setProtocolDb.
packages/server/lib/project-base.ts Integrates the new protocol DB setting when available.
packages/server/lib/cloud/studio.ts Implements setProtocolDb in StudioManager and applies a TS bypass.
packages/server/lib/cloud/protocol.ts Adds a getter for the protocolManager.db property.
Comments suppressed due to low confidence (1)

packages/server/lib/cloud/studio.ts:108

  • The use of '@ts-expect-error' indicates a TypeScript type inference issue with the method call. It may be beneficial to resolve the type discrepancy with a proper type assertion or by refining the method signature instead of suppressing the error.
return this._studioServer[method].apply(this._studioServer, args)

@ryanthemanuel ryanthemanuel requested a review from mschile April 3, 2025 15:59
@@ -447,6 +447,10 @@ export class ProjectBase extends EE {

await browsers.connectProtocolToBrowser({ browser: this.browser, foundBrowsers: this.options.browsers, protocolManager: this.protocolManager })

if (this.protocolManager.db) {
this.ctx.coreData.studio?.setProtocolDb(this.protocolManager.db)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if there is a better way to do this since the StudioManager already has a reference to the protocolManager.

@ryanthemanuel ryanthemanuel merged commit 108eb7e into develop Apr 6, 2025
89 of 91 checks passed
@ryanthemanuel ryanthemanuel deleted the ryanm/feat/create-cdp-full-snapshot-at-timestamp branch April 6, 2025 20:04
AtofStryker added a commit that referenced this pull request Apr 8, 2025
* dependency: upgrade mocha to 7.2.0 (#31423)

* dependency: upgrade mocha to 7.2.0

* changelog entry

* remove the it.only from the mocha patch changelog that is triggering our stop-only check from passing

* skip patches folder with stop-only check

* remove extra bracket

* Update protocol_spec to reflect new mocha line number for error stack trace

* chore: updating v8 snapshot cache (#31424)

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>

* chore: updating v8 snapshot cache (#31425)

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>

* chore: updating v8 snapshot cache (#31426)

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>

* chore: migrates plugin system test to a v3 extension (#31434)

* chore: Update Chrome (stable) to 135.0.7049.52 (#31428)

* chore: Update Chrome (stable) to 135.0.7049.52

* empty commit

---------

Co-authored-by: cypress-bot[bot] <41898282+cypress-bot[bot]@users.noreply.github.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com>

* chore: bump Firefox to 137 (#31431)

* chore: bump Firefox to 137

* use 137 version? weird.

* just kidding, major version only has 1 zero after it................

* dependency: update server to mocha 7.2.0 (#31432)

* dependency: update server to mocha 7.2.0

* Add PR to changelog

* chore: updating v8 snapshot cache (#31437)

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>

* chore: updating v8 snapshot cache (#31438)

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>

* chore: updating v8 snapshot cache (#31439)

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>

* chore: Update Chrome (beta) to 136.0.7103.17 (#31448)

* chore: Update Chrome (beta) to 136.0.7103.17

* empty commit

---------

Co-authored-by: cypress-bot[bot] <41898282+cypress-bot[bot]@users.noreply.github.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>

* refactor: lifts toPosix to its own file, removes circular dependency between stack_utils and source_map_utils (#30983)

* refactor: lifts toPosix to remove circular dependency between stack_utils and source_map_utils

* camelCase to snake_case

* rm duplicated file

* internal: (studio) make the protocol database accessible to studio (#31443)

* internal: (studio) make the protocol database accessible to studio

* PR comment

* chore(deps): update dependency patch-package to v8 (#31451)

* chore(deps): update dependency patch-package to v8

* empty commit

* add types to handle json-stable-stringify dep change

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>

* chore: fix deprecation warnings and refactor react reporter to use functional components and hooks (#31284)

* chore: fix deprecation warnings and refactor react reporter to use functional components with hooks

* chore: update code to reflect feedback from code review

* fix issues with scrollIntoView() on updated component and refactor isOpen logic in collapsible to not attempt to sync state

* fix issues with tests after refactor

* see if event registration fixes windows flake

* chore: update snap-shot-core patch package file to match version (#31449)

* chore: update snap-shot-core patch package file to match version

* update circle cache

* experiment with removing .md from yarnclean

* add .md back to yarnclean

* bust circle cache

* remove .md files being cleaned from yarn to get around patch-package issue

* print size of cache

* try out the size of the .md

* remove md from yarnclean

* UPdate to version without removal of markdown files

* chore: updating v8 snapshot cache (#31460)

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>

* chore: updating v8 snapshot cache (#31462)

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>

* chore: updating v8 snapshot cache (#31461)

Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>

* feat: cy.press() (#31398)

* wip - cy.press() command

* cy command for dispatching key press/down/up events

* unit tests and failure cases for cy.press()

* Cypress.Keyboard.Keys definition; fix command log message

* add keys to the internal keyboard type

* auto-focus in cdp

* ensure aut iframe is focused before dispatching key events in bidi browsers

* update tests for cdp focus

* fixed tests for bidi

* lint

* fix type ref in .d.ts

* linting

* skip press() driver test in ff below v135

* try all contexts for frame before failing due to missing/invalid context id

* ensure error is error before accessing props

* skip press driver test in webkit

* changelog

* debug automation middleware invocation for firefox flake

* debug

* cache update

* use bidi automation middleware from connectToNewSpec rather than constructor

* more comprehensive logging

* debug socket base, additional debug in automation

* install firefox automation middleware on setup as well as connectToNewSpec

* unit tests for firefox-utils

* proper calledWith

---------

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

* docs: update contributing requirements for corepack (#31463)

* chore: remove `du` check (#31465)

* chore: use different args for `du` in win

* rm du command for build

* chore: release 14.3.0 (#31467)

---------

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com>
Co-authored-by: Cacie Prins <cacieprins@users.noreply.github.com>
Co-authored-by: cypress-bot[bot] <41898282+cypress-bot[bot]@users.noreply.github.com>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 8, 2025

Released in 14.3.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v14.3.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants