Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ _Released 10/20/2025 (PENDING)_
- Fixed an issue where grouped command text jumps up and down when expanding and collapsing in the command log. Addressed in [#32757](https://github.com/cypress-io/cypress/pull/32757).
- Fixed an issue where command snapshots were not correctly displayed in Studio. Addressed in [#32808](https://github.com/cypress-io/cypress/pull/32808).
- Fixed an issue with grouped console prop items having a hard to read blue color in the console log and duplicate `:` characters being displayed. Addressed in [#32776](https://github.com/cypress-io/cypress/pull/32776).
- Added more context to the error message shown when `cy.prompt()` fails to download. Addressed in [#32822](https://github.com/cypress-io/cypress/pull/32822).

**Misc:**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export class CyPromptLifecycleManager {
const cloudUrl = ctx.cloud.getCloudUrl(cloudEnv)
const cloudHeaders = await ctx.cloud.additionalHeaders()

const lastError = error instanceof AggregateError ? error.errors[error.errors.length - 1] : error

reportCyPromptError({
cloudApi: {
cloudUrl,
Expand All @@ -99,15 +101,15 @@ export class CyPromptLifecycleManager {
additionalHeaders: cloudHeaders,
cyPromptHash: this.cyPromptHash,
projectSlug: (await ctx.project.getConfig()).projectId || undefined,
error,
error: lastError,
cyPromptMethod: 'initializeCyPromptManager',
cyPromptMethodArgs: [],
})

// Clean up any registered listeners
this.listeners = []

return { error }
return { error: lastError }
})

this.cyPromptManagerPromise = cyPromptManagerPromise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,85 @@ describe('CyPromptLifecycleManager', () => {
},
})
})

it('handles errors from ensureCyPromptBundle', async () => {
const actualError = new Error('Test error')

ensureCyPromptBundleStub.rejects(actualError)
cyPromptLifecycleManager.initializeCyPromptManager({
cloudDataSource: mockCloudDataSource,
ctx: mockCtx,
record: false,
key: '123e4567-e89b-12d3-a456-426614174000',
})

// @ts-expect-error - accessing private property
const cyPromptPromise = cyPromptLifecycleManager.cyPromptManagerPromise

expect(cyPromptPromise).to.not.be.null

const { error } = (await cyPromptPromise) as { error: Error }

expect(error.message).to.equal('Test error')

expect(reportCyPromptErrorStub).to.be.calledWith({
cloudApi: {
cloudUrl: 'https://cloud.cypress.io',
CloudRequest,
createCloudRequest,
isRetryableError,
asyncRetry,
},
cyPromptHash: 'abc',
projectSlug: 'test-project-id',
error: actualError,
cyPromptMethod: 'initializeCyPromptManager',
cyPromptMethodArgs: [],
additionalHeaders: {
'Authorization': 'Bearer test-token',
},
})
})

it('handles AggregateErrors from ensureCyPromptBundle', async () => {
const aggregateError = new AggregateError([new Error('Test error'), new Error('Second error')], 'Multiple errors')

ensureCyPromptBundleStub.rejects(aggregateError)

cyPromptLifecycleManager.initializeCyPromptManager({
cloudDataSource: mockCloudDataSource,
ctx: mockCtx,
record: false,
key: '123e4567-e89b-12d3-a456-426614174000',
})

// @ts-expect-error - accessing private property
const cyPromptPromise = cyPromptLifecycleManager.cyPromptManagerPromise

expect(cyPromptPromise).to.not.be.null

const { error } = (await cyPromptPromise) as { error: Error }

expect(error.message).to.equal('Second error')

expect(reportCyPromptErrorStub).to.be.calledWith({
cloudApi: {
cloudUrl: 'https://cloud.cypress.io',
CloudRequest,
createCloudRequest,
isRetryableError,
asyncRetry,
},
cyPromptHash: 'abc',
projectSlug: 'test-project-id',
error: aggregateError.errors[aggregateError.errors.length - 1],
cyPromptMethod: 'initializeCyPromptManager',
cyPromptMethodArgs: [],
additionalHeaders: {
'Authorization': 'Bearer test-token',
},
})
})
})

describe('getCyPrompt', () => {
Expand Down
Loading