From 97c8b889ed27d024edc460a617d1568af3c5ff88 Mon Sep 17 00:00:00 2001 From: shreyanshc Date: Wed, 8 Oct 2025 21:26:37 +0530 Subject: [PATCH 1/3] added a fix for veeva --- src/lib/httpClient.ts | 12 ++++++++---- src/lib/server.ts | 15 +++++++++++++-- src/lib/snapshotQueue.ts | 19 +++++++++++++------ src/types.ts | 2 +- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/lib/httpClient.ts b/src/lib/httpClient.ts index 3628328..5d43708 100644 --- a/src/lib/httpClient.ts +++ b/src/lib/httpClient.ts @@ -375,7 +375,7 @@ export default class httpClient { }, ctx.log) } - processSnapshotCaps(ctx: Context, snapshot: ProcessedSnapshot, snapshotUuid: string, capsBuildId: string, capsProjectToken: string, discoveryErrors: DiscoveryErrors) { + processSnapshotCaps(ctx: Context, snapshot: ProcessedSnapshot, snapshotUuid: string, capsBuildId: string, capsProjectToken: string, discoveryErrors: DiscoveryErrors, variantCount: number, sync: boolean = false) { return this.request({ url: `/build/${capsBuildId}/snapshot`, method: 'POST', @@ -387,17 +387,19 @@ export default class httpClient { name: snapshot.name, url: snapshot.url, snapshotUuid: snapshotUuid, + variantCount: variantCount, test: { type: ctx.testType, source: 'cli' }, doRemoteDiscovery: snapshot.options.doRemoteDiscovery, discoveryErrors: discoveryErrors, + sync: sync } }, ctx.log) } - uploadSnapshotForCaps(ctx: Context, snapshot: ProcessedSnapshot, capsBuildId: string, capsProjectToken: string, discoveryErrors: DiscoveryErrors) { + uploadSnapshotForCaps(ctx: Context, snapshot: ProcessedSnapshot, capsBuildId: string, capsProjectToken: string, discoveryErrors: DiscoveryErrors, variantCount: number, sync: boolean = false) { // Use capsBuildId if provided, otherwise fallback to ctx.build.id const buildId = capsBuildId !== '' ? capsBuildId : ctx.build.id; @@ -415,6 +417,8 @@ export default class httpClient { source: 'cli' }, discoveryErrors: discoveryErrors, + variantCount: variantCount, + sync: sync } }, ctx.log); } @@ -660,9 +664,9 @@ export default class httpClient { }, ctx.log) } - getSnapshotStatus(snapshotName: string, snapshotUuid: string, ctx: Context): Promise> { + getSnapshotStatus(buildId: string, snapshotName: string, snapshotUuid: string, ctx: Context): Promise> { return this.request({ - url: `/snapshot/status?buildId=${ctx.build.id}&snapshotName=${snapshotName}&snapshotUUID=${snapshotUuid}`, + url: `/snapshot/status?buildId=${buildId}&snapshotName=${snapshotName}&snapshotUUID=${snapshotUuid}`, method: 'GET', headers: { 'Content-Type': 'application/json', diff --git a/src/lib/server.ts b/src/lib/server.ts index cc03eb9..bb0df89 100644 --- a/src/lib/server.ts +++ b/src/lib/server.ts @@ -252,19 +252,29 @@ export default async (ctx: Context): Promise setTimeout(resolve, 5000)); contextStatus = ctx.contextToSnapshotMap.get(contextId); + counter--; } - if(contextStatus==2){ + if(contextStatus==='2'){ throw new Error("Snapshot Failed"); } ctx.log.debug("Snapshot uploaded successfully"); + const buildId = contextStatus; + if (!buildId) { + throw new Error(`No buildId found for contextId: ${contextId}`); + } + // Poll external API until it returns 200 or timeout is reached let lastExternalResponse: any = null; const startTime = Date.now(); @@ -272,6 +282,7 @@ export default async (ctx: Context): Promise; + contextToSnapshotMap?: Map; sourceCommand?: string; autoTunnelStarted?: boolean; } From 00aaa22b50a2c91ea6229df9494cdc290f1434c1 Mon Sep 17 00:00:00 2001 From: shreyanshc Date: Wed, 8 Oct 2025 21:27:26 +0530 Subject: [PATCH 2/3] 4.1.37-beta.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ea7313..b660c3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lambdatest/smartui-cli", - "version": "4.1.36", + "version": "4.1.37-beta.0", "description": "A command line interface (CLI) to run SmartUI tests on LambdaTest", "files": [ "dist/**/*" From af63e384bb27ec3782751b4c8762a848cb6cba57 Mon Sep 17 00:00:00 2001 From: shreyanshc Date: Wed, 8 Oct 2025 21:44:46 +0530 Subject: [PATCH 3/3] resolved comments --- src/lib/server.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/server.ts b/src/lib/server.ts index bb0df89..a286e2f 100644 --- a/src/lib/server.ts +++ b/src/lib/server.ts @@ -118,7 +118,7 @@ export default async (ctx: Context): Promise setTimeout(resolve, 5000)); - - contextStatus = ctx.contextToSnapshotMap.get(contextId); counter--; }