Skip to content
Closed
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lambdatest/smartui-cli",
"version": "4.1.28",
"version": "4.1.29",
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
"files": [
"dist/**/*"
Expand Down
14 changes: 14 additions & 0 deletions src/lib/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,4 +644,18 @@ export default class httpClient {
}
}, ctx.log);
}

uploadSnapshotFailure(failure: string, ctx: Context): Promise<Record<string, any>> {
return this.request({
url: `/upload/failed/snapshot`,
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: {
buildId: ctx.build.id,
snapshotError: failure
}
}, ctx.log);
}
}
12 changes: 12 additions & 0 deletions src/lib/snapshotQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,18 @@ export default class Queue {
if (snapshot?.options?.contextId && this.ctx.contextToSnapshotMap) {
this.ctx.contextToSnapshotMap.set(snapshot.options.contextId, 2);
}
//upload error
try {
this.ctx.log.debug(`Uploading snapshot failure for ${snapshot?.name}`);
let errorMessageString = `snapshot failed ${snapshot?.name}; ${error.message}`;
if (errorMessageString.length > 255) {
errorMessageString = errorMessageString.substring(0, 255); // Truncate to first 255 characters
}
let resp = await this.ctx.client.uploadSnapshotFailure(errorMessageString, this.ctx);
this.ctx.log.debug(`Uploading snapshot failure response for ${snapshot?.name}; ${JSON.stringify(resp)}`);
} catch (error: any) {
this.ctx.log.debug(`Uploading snapshot failure also failed for ${snapshot?.name}; ${error}`);
}
}
// Close open browser contexts and pages
if (this.ctx.browser) {
Expand Down