mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-11 01:29:59 -06:00
chore: fix artifact report schema (#27596)
* ensure fatal error reports for protocol include a url entry, even if not applicable * inconsequential debug msg change to alleviate semantic commit check warning
This commit is contained in:
@@ -168,6 +168,10 @@ export class ProtocolManager implements ProtocolManagerShape {
|
||||
}
|
||||
|
||||
async beforeTest (test: { id: string } & Record<string, any>) {
|
||||
if (!test.id) {
|
||||
debug('protocolManager beforeTest was invoked with test without id %O', test)
|
||||
}
|
||||
|
||||
this._runnableId = test.id
|
||||
await this.invokeAsync('beforeTest', { isEssential: true }, test)
|
||||
}
|
||||
|
||||
@@ -162,6 +162,11 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
|
||||
if (protocolManager.hasFatalError()) {
|
||||
const error = protocolManager.getFatalError().error
|
||||
|
||||
debug('protocol fatal error encountered', {
|
||||
message: error.message,
|
||||
stack: error.stack,
|
||||
})
|
||||
|
||||
return {
|
||||
...artifact,
|
||||
skip: true,
|
||||
@@ -186,6 +191,7 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
|
||||
}
|
||||
} catch (err) {
|
||||
debug('failed to prepare protocol artifact', {
|
||||
error: err.message,
|
||||
stack: err.stack,
|
||||
})
|
||||
}
|
||||
@@ -223,7 +229,11 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
|
||||
}
|
||||
|
||||
preparedArtifacts.forEach((artifact) => {
|
||||
debug('preparing to upload artifact %O', artifact)
|
||||
debug('preparing to upload artifact %O', {
|
||||
...artifact,
|
||||
payload: typeof artifact.payload,
|
||||
})
|
||||
|
||||
if (!quiet) {
|
||||
printPendingArtifactUpload(artifact, labels)
|
||||
}
|
||||
@@ -237,11 +247,16 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
|
||||
return {
|
||||
key: artifact.reportKey,
|
||||
skipped: true,
|
||||
url: artifact.url || '',
|
||||
...(artifact.error && { error: artifact.error, success: false }),
|
||||
}
|
||||
}
|
||||
|
||||
debug('uploading artifact %O', artifact)
|
||||
debug('uploading artifact %O', {
|
||||
...artifact,
|
||||
payload: typeof artifact.payload,
|
||||
})
|
||||
|
||||
try {
|
||||
if (artifact.reportKey === 'protocol') {
|
||||
const res = await protocolManager.uploadCaptureArtifact(artifact)
|
||||
|
||||
@@ -2332,7 +2332,14 @@ describe('e2e record', () => {
|
||||
}).then(() => {
|
||||
const urls = getRequestUrls()
|
||||
|
||||
expect(urls).to.include.members([`PUT /instances/${instanceId}/artifacts`])
|
||||
expect(urls).not.to.include.members([`PUT ${CAPTURE_PROTOCOL_UPLOAD_URL}`])
|
||||
|
||||
const artifactReport = getRequests().find(({ url }) => url === `PUT /instances/${instanceId}/artifacts`)?.body
|
||||
|
||||
expect(artifactReport?.protocol).to.exist()
|
||||
expect(artifactReport?.protocol?.error).to.exist().and.not.to.be.empty()
|
||||
expect(artifactReport?.protocol?.url).to.exist()
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -2357,6 +2364,7 @@ describe('e2e record', () => {
|
||||
|
||||
expect(artifactReport?.protocol).to.exist()
|
||||
expect(artifactReport?.protocol?.error).to.exist().and.not.to.be.empty()
|
||||
expect(artifactReport?.protocol?.url).to.exist()
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -2381,6 +2389,7 @@ describe('e2e record', () => {
|
||||
|
||||
expect(artifactReport?.protocol).to.exist()
|
||||
expect(artifactReport?.protocol?.error).to.exist().and.not.to.be.empty()
|
||||
expect(artifactReport?.protocol?.url).to.exist()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user