diff --git a/guides/cy-prompt-development.md b/guides/cy-prompt-development.md index 390e2147506..1eebbb52be6 100644 --- a/guides/cy-prompt-development.md +++ b/guides/cy-prompt-development.md @@ -1,6 +1,6 @@ # `cy.prompt` Development -In production, the code used to facilitate the prompt command will be retrieved from the Cloud. While `cy.prompt` is still in its early stages it is hidden behind an environment variable: `CYPRESS_ENABLE_CY_PROMPT` but can also be run against local cloud Studio code via the environment variable: `CYPRESS_LOCAL_CY_PROMPT_PATH`. +In production, the code used to facilitate the prompt command will be retrieved from the Cloud. While `cy.prompt` is still in its early stages it is hidden behind an environment variable: `CYPRESS_ENABLE_CY_PROMPT` but can also be run against local cloud prompt code via the environment variable: `CYPRESS_LOCAL_CY_PROMPT_PATH`. To run against locally developed `cy.prompt`: @@ -30,6 +30,20 @@ To run against a deployed version of `cy.prompt`: - Set: - `CYPRESS_INTERNAL_ENV=` (e.g. `staging` or `production` if you want to hit those deployments of `cypress-services` or `development` if you want to hit a locally running version of `cypress-services`) +## Types + +The prompt bundle provides the types for the `app`, `driver`, and `server` interfaces that are used within the Cypress code. To incorporate the types into the code base, run: + +```sh +yarn gulp downloadPromptTypes +``` + +or to reference a local `cypress_services` repo: + +```sh +CYPRESS_LOCAL_CY_PROMPT_PATH= yarn gulp downloadPromptTypes +``` + ## Testing ### Unit/Component Testing diff --git a/packages/app/src/prompt/PromptGetCodeModal.vue b/packages/app/src/prompt/PromptGetCodeModal.vue new file mode 100644 index 00000000000..7c53f561909 --- /dev/null +++ b/packages/app/src/prompt/PromptGetCodeModal.vue @@ -0,0 +1,124 @@ + + + diff --git a/packages/app/src/prompt/prompt-app-types.ts b/packages/app/src/prompt/prompt-app-types.ts new file mode 100644 index 00000000000..09014fc44d9 --- /dev/null +++ b/packages/app/src/prompt/prompt-app-types.ts @@ -0,0 +1,28 @@ +// Note: This file is owned by the cloud delivered +// cy prompt bundle. It is downloaded and copied here. +// It should not be modified directly here. + +export interface CypressInternal extends Cypress.Cypress { + backendRequestHandler: ( + backendRequestNamespace: string, + eventName: string, + ...args: any[] + ) => Promise +} + +export interface GetCodeModalContentsProps { + Cypress: CypressInternal + testId: string + logId: string + onClose: () => void +} + +export type GetCodeModalContentsShape = ( + props: GetCodeModalContentsProps +) => JSX.Element + +export interface CyPromptAppDefaultShape { + // Purposefully do not use React in this signature to avoid conflicts when this type gets + // transferred to the Cypress app + GetCodeModalContents: GetCodeModalContentsShape +} diff --git a/packages/app/src/runner/SpecRunnerOpenMode.vue b/packages/app/src/runner/SpecRunnerOpenMode.vue index 89f720f7665..a5dfc452157 100644 --- a/packages/app/src/runner/SpecRunnerOpenMode.vue +++ b/packages/app/src/runner/SpecRunnerOpenMode.vue @@ -1,4 +1,9 @@