Skip to content

Commit 0975b2f

Browse files
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
1 parent 8fe4499 commit 0975b2f

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

cli/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
2+
## 13.16.0
3+
4+
_Released 11/19/2024 (PENDING)_
5+
6+
**Features:**
7+
8+
- Updated the protocol to be able to flex logic based on project config. Addresses [#30560](https://github.com/cypress-io/cypress/issues/30560).
9+
210
## 13.15.2
311

412
_Released 11/5/2024_

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,8 @@ export default {
426426
}
427427

428428
if (script) {
429+
const config = options.project.getConfig()
430+
429431
await options.project.protocolManager.setupProtocol(script, {
430432
runId: result.runId,
431433
projectId: options.projectId,
@@ -435,6 +437,7 @@ export default {
435437
retryWithBackoff: this.retryWithBackoff,
436438
requestPromise: this.rp,
437439
},
440+
projectConfig: _.pick(config, ['devServerPublicPathRoute', 'port', 'proxyUrl', 'namespace']),
438441
mountVersion: runnerCapabilities.protocolMountVersion,
439442
})
440443
}

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,14 @@ describe('lib/cloud/api', () => {
591591
get protocolManager () {
592592
return protocolManager
593593
},
594+
getConfig: () => {
595+
return {
596+
port: 1234,
597+
devServerPublicPathRoute: '/dev-server',
598+
proxyUrl: 'http://localhost:1234',
599+
namespace: '__cypress',
600+
}
601+
},
594602
}
595603

596604
return api.createRun({
@@ -617,6 +625,12 @@ describe('lib/cloud/api', () => {
617625
retryWithBackoff: api.retryWithBackoff,
618626
requestPromise: api.rp,
619627
},
628+
projectConfig: {
629+
port: 1234,
630+
devServerPublicPathRoute: '/dev-server',
631+
proxyUrl: 'http://localhost:1234',
632+
namespace: '__cypress',
633+
},
620634
},
621635
)
622636
})
@@ -666,6 +680,14 @@ describe('lib/cloud/api', () => {
666680
get protocolManager () {
667681
return protocolManager
668682
},
683+
getConfig: () => {
684+
return {
685+
port: 1234,
686+
devServerPublicPathRoute: '/dev-server',
687+
proxyUrl: 'http://localhost:1234',
688+
namespace: '__cypress',
689+
}
690+
},
669691
}
670692

671693
return api.createRun({
@@ -692,6 +714,12 @@ describe('lib/cloud/api', () => {
692714
retryWithBackoff: api.retryWithBackoff,
693715
requestPromise: api.rp,
694716
},
717+
projectConfig: {
718+
port: 1234,
719+
devServerPublicPathRoute: '/dev-server',
720+
proxyUrl: 'http://localhost:1234',
721+
namespace: '__cypress',
722+
},
695723
},
696724
)
697725
})

packages/types/src/protocol.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ export type CaptureArtifact = {
8585
filePath: string
8686
}
8787

88+
type ProjectConfig = {
89+
devServerPublicPathRoute: string
90+
namespace: string
91+
port: number
92+
proxyUrl: string
93+
}
94+
8895
export type ProtocolManagerOptions = {
8996
runId: string
9097
testingType: 'e2e' | 'component'
@@ -96,6 +103,7 @@ export type ProtocolManagerOptions = {
96103
get (options: any): Promise<any>
97104
}
98105
}
106+
projectConfig: ProjectConfig
99107
mountVersion?: number
100108
}
101109

0 commit comments

Comments
 (0)