Skip to content

Commit

Permalink
feat: update the protocol to be able to flex logic based on project c…
Browse files Browse the repository at this point in the history
…onfig (#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
  • Loading branch information
ryanthemanuel authored Nov 13, 2024
1 parent 8fe4499 commit 0975b2f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 13.16.0

_Released 11/19/2024 (PENDING)_

**Features:**

- Updated the protocol to be able to flex logic based on project config. Addresses [#30560](https://github.com/cypress-io/cypress/issues/30560).

## 13.15.2

_Released 11/5/2024_
Expand Down
3 changes: 3 additions & 0 deletions packages/server/lib/cloud/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ export default {
}

if (script) {
const config = options.project.getConfig()

await options.project.protocolManager.setupProtocol(script, {
runId: result.runId,
projectId: options.projectId,
Expand All @@ -435,6 +437,7 @@ export default {
retryWithBackoff: this.retryWithBackoff,
requestPromise: this.rp,
},
projectConfig: _.pick(config, ['devServerPublicPathRoute', 'port', 'proxyUrl', 'namespace']),
mountVersion: runnerCapabilities.protocolMountVersion,
})
}
Expand Down
28 changes: 28 additions & 0 deletions packages/server/test/unit/cloud/api/api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,14 @@ describe('lib/cloud/api', () => {
get protocolManager () {
return protocolManager
},
getConfig: () => {
return {
port: 1234,
devServerPublicPathRoute: '/dev-server',
proxyUrl: 'http://localhost:1234',
namespace: '__cypress',
}
},
}

return api.createRun({
Expand All @@ -617,6 +625,12 @@ describe('lib/cloud/api', () => {
retryWithBackoff: api.retryWithBackoff,
requestPromise: api.rp,
},
projectConfig: {
port: 1234,
devServerPublicPathRoute: '/dev-server',
proxyUrl: 'http://localhost:1234',
namespace: '__cypress',
},
},
)
})
Expand Down Expand Up @@ -666,6 +680,14 @@ describe('lib/cloud/api', () => {
get protocolManager () {
return protocolManager
},
getConfig: () => {
return {
port: 1234,
devServerPublicPathRoute: '/dev-server',
proxyUrl: 'http://localhost:1234',
namespace: '__cypress',
}
},
}

return api.createRun({
Expand All @@ -692,6 +714,12 @@ describe('lib/cloud/api', () => {
retryWithBackoff: api.retryWithBackoff,
requestPromise: api.rp,
},
projectConfig: {
port: 1234,
devServerPublicPathRoute: '/dev-server',
proxyUrl: 'http://localhost:1234',
namespace: '__cypress',
},
},
)
})
Expand Down
8 changes: 8 additions & 0 deletions packages/types/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ export type CaptureArtifact = {
filePath: string
}

type ProjectConfig = {
devServerPublicPathRoute: string
namespace: string
port: number
proxyUrl: string
}

export type ProtocolManagerOptions = {
runId: string
testingType: 'e2e' | 'component'
Expand All @@ -96,6 +103,7 @@ export type ProtocolManagerOptions = {
get (options: any): Promise<any>
}
}
projectConfig: ProjectConfig
mountVersion?: number
}

Expand Down

5 comments on commit 0975b2f

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0975b2f Nov 13, 2024

Choose a reason for hiding this comment

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

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.16.0/linux-x64/develop-0975b2f07fed1802081a87ea5df5d5fa67a84965/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0975b2f Nov 13, 2024

Choose a reason for hiding this comment

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

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.16.0/linux-arm64/develop-0975b2f07fed1802081a87ea5df5d5fa67a84965/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0975b2f Nov 13, 2024

Choose a reason for hiding this comment

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

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.16.0/darwin-arm64/develop-0975b2f07fed1802081a87ea5df5d5fa67a84965/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0975b2f Nov 13, 2024

Choose a reason for hiding this comment

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

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.16.0/darwin-x64/develop-0975b2f07fed1802081a87ea5df5d5fa67a84965/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0975b2f Nov 13, 2024

Choose a reason for hiding this comment

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

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.16.0/win32-x64/develop-0975b2f07fed1802081a87ea5df5d5fa67a84965/cypress.tgz

Please sign in to comment.