Skip to content

Commit 719312a

Browse files
authored
Merge pull request #226 from LambdaTest/stage
Release version 4.1.1
2 parents 33b6be2 + bf3aeeb commit 719312a

File tree

8 files changed

+13
-4
lines changed

8 files changed

+13
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/smartui-cli",
3-
"version": "4.1.0",
3+
"version": "4.1.1",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"

src/commander/capture.ts

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ command
2727
process.exit(1);
2828
}
2929
let ctx: Context = ctxInit(command.optsWithGlobals());
30+
ctx.isSnapshotCaptured = true
3031

3132
if (!fs.existsSync(file)) {
3233
ctx.log.error(`Web Static Config file ${file} not found.`);

src/commander/upload.ts

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ command
3434
process.exit(1);
3535
}
3636
let ctx: Context = ctxInit(command.optsWithGlobals());
37+
ctx.isSnapshotCaptured = true
3738

3839
if (!fs.existsSync(directory)) {
3940
console.log(`Error: The provided directory ${directory} not found.`);

src/commander/uploadFigma.ts

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ uploadFigma
2424
.option('--buildName <buildName>', 'Name of the build')
2525
.action(async function (file, _, command) {
2626
let ctx: Context = ctxInit(command.optsWithGlobals());
27+
ctx.isSnapshotCaptured = true;
2728

2829
if (!fs.existsSync(file)) {
2930
console.log(`Error: Figma Config file ${file} not found.`);

src/lib/ctx.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export default (options: Record<string, string>): Context => {
127127
},
128128
cliVersion: version,
129129
totalSnapshots: -1,
130-
isStartExec: false
130+
isStartExec: false,
131+
isSnapshotCaptured: false
131132
}
132133
}

src/lib/server.ts

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default async (ctx: Context): Promise<FastifyInstance<Server, IncomingMes
3838
if (!validateSnapshot(snapshot)) throw new Error(validateSnapshot.errors[0].message);
3939
ctx.testType = testType;
4040
ctx.snapshotQueue?.enqueue(snapshot);
41+
ctx.isSnapshotCaptured = true;
4142
replyCode = 200;
4243
replyBody = { data: { message: "success", warnings: [] }};
4344
} catch (error: any) {

src/tasks/finalizeBuild.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ export default (ctx: Context): ListrTask<Context, ListrRendererFactory, ListrRen
2828
ctx.log.debug(`Closed browser`);
2929
await ctx.server?.close();
3030
ctx.log.debug(`Closed server`);
31-
let resp = await ctx.client.getS3PreSignedURL(ctx);
32-
await ctx.client.uploadLogs(ctx, resp.data.url);
31+
if (ctx.isSnapshotCaptured) {
32+
ctx.log.debug(`Log file to be uploaded`)
33+
let resp = await ctx.client.getS3PreSignedURL(ctx);
34+
await ctx.client.uploadLogs(ctx, resp.data.url);
35+
}
3336
fs.unlinkSync(constants.LOG_FILE_PATH);
3437
ctx.log.debug(`Log file deleted: ${constants.LOG_FILE_PATH}`);
3538
} catch (error: any) {

src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export interface Context {
5353
figmaDesignConfig?: FigmaDesignConfig;
5454
testType?: string;
5555
isStartExec ?: boolean;
56+
isSnapshotCaptured ?: boolean;
5657
}
5758

5859
export interface Env {

0 commit comments

Comments
 (0)