Skip to content

Commit e58696b

Browse files
Merge pull request #312 from LambdaTest/stage
Release PR - 4.1.18-beta.0
2 parents 2f3ffe7 + a976087 commit e58696b

File tree

7 files changed

+26
-14
lines changed

7 files changed

+26
-14
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
node_modules
22
dist
3+
.idea
4+
pnpm-lock.yaml

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/smartui-cli",
3-
"version": "4.1.17",
3+
"version": "4.1.18-beta.0",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"

src/lib/constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ export default {
360360

361361
FIGMA_API: 'https://api.figma.com/v1/',
362362
DEFAULT_FIGMA_CONFIG: {
363-
"depth": 2,
363+
"depth": 1,
364364
"figma_config": [
365365
{
366366
"figma_file_token": "token_for_first_figma_file",
@@ -381,7 +381,7 @@ export default {
381381
]
382382
},
383383
figma: {
384-
"depth": 2,
384+
"depth": 1,
385385
"configs": [
386386
{
387387
"figma_file_token": "<token>",
@@ -408,7 +408,7 @@ export default {
408408
}
409409
],
410410
figma: {
411-
"depth": 2,
411+
"depth": 1,
412412
"configs": [
413413
{
414414
"figma_file_token": "<token>",

src/lib/ctx.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default (options: Record<string, string>): Context => {
2323
let fetchResultObj: boolean;
2424
let fetchResultsFileObj: string;
2525
let buildNameObj: string;
26+
let allowDuplicateSnapshotNames: boolean = false;
2627
try {
2728
if (options.config) {
2829
config = JSON.parse(fs.readFileSync(options.config, 'utf-8'));
@@ -85,10 +86,13 @@ export default (options: Record<string, string>): Context => {
8586
}
8687
}
8788
if (config.basicAuthorization) {
88-
basicAuthObj = config.basicAuthorization
89+
basicAuthObj = config.basicAuthorization;
8990
}
9091
if (config.tunnel) {
91-
tunnelObj = config.tunnel
92+
tunnelObj = config.tunnel;
93+
}
94+
if (config.allowDuplicateSnapshotNames) {
95+
allowDuplicateSnapshotNames = true;
9296
}
9397

9498
return {
@@ -114,7 +118,8 @@ export default (options: Record<string, string>): Context => {
114118
skipBuildCreation: config.skipBuildCreation ?? false,
115119
tunnel: tunnelObj,
116120
userAgent: config.userAgent || '',
117-
requestHeaders: config.requestHeaders || {}
121+
requestHeaders: config.requestHeaders || {},
122+
allowDuplicateSnapshotNames: allowDuplicateSnapshotNames,
118123
},
119124
uploadFilePath: '',
120125
webStaticConfig: [],

src/lib/schemaValidation.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ const ConfigSchema = {
258258
errorMessage: {
259259
uniqueItems: "Invalid config; duplicates in requestHeaders"
260260
}
261+
},
262+
allowDuplicateSnapshotNames: {
263+
type: "boolean",
264+
errorMessage: "Invalid config; allowDuplicateSnapshotNames must be true/false"
261265
}
262266
},
263267
anyOf: [
@@ -508,8 +512,8 @@ const FigmaDesignConfigSchema: JSONSchemaType<FigmaDesignConfig> = {
508512
properties: {
509513
depth: {
510514
type: "integer",
511-
minimum: 2,
512-
errorMessage: "Depth must be an integer and greater than 1"
515+
minimum: 1,
516+
errorMessage: "Depth must be an integer and greater than 0"
513517
},
514518
figma_config: {
515519
type: "array",
@@ -582,8 +586,8 @@ const FigmaWebConfigSchema: JSONSchemaType<Object> = {
582586
"properties": {
583587
depth: {
584588
type: "integer",
585-
minimum: 2,
586-
errorMessage: "Depth must be an integer and greater than 1"
589+
minimum: 1,
590+
errorMessage: "Depth must be an integer and greater than 0"
587591
},
588592
"configs": {
589593
"type": "array",
@@ -698,8 +702,8 @@ const FigmaAppConfigSchema: JSONSchemaType<Object> = {
698702
"properties": {
699703
depth: {
700704
type: "integer",
701-
minimum: 2,
702-
errorMessage: "Depth must be an integer and greater than 1"
705+
minimum: 1,
706+
errorMessage: "Depth must be an integer and greater than 0"
703707
},
704708
"configs": {
705709
"type": "array",

src/lib/snapshotQueue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export default class Queue {
276276
this.ctx.log.info(`Processing Snapshot: ${snapshot?.name}`);
277277
}
278278

279-
if (!this.ctx.config.delayedUpload && snapshot && snapshot.name && this.snapshotNames.includes(snapshot.name)) {
279+
if (!this.ctx.config.delayedUpload && snapshot && snapshot.name && this.snapshotNames.includes(snapshot.name) && !this.ctx.config.allowDuplicateSnapshotNames) {
280280
drop = true;
281281
this.ctx.log.info(`Skipping duplicate SmartUI snapshot '${snapshot.name}'. To capture duplicate screenshots, please set the 'delayedUpload' configuration as true in your config file.`);
282282
}

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export interface Context {
3636
tunnel: tunnelConfig | undefined;
3737
userAgent?: string;
3838
requestHeaders?: Array<Record<string, string>>;
39+
allowDuplicateSnapshotNames?: boolean;
3940
};
4041
uploadFilePath: string;
4142
webStaticConfig: WebStaticConfig;

0 commit comments

Comments
 (0)