Skip to content

Commit a976087

Browse files
Merge pull request #311 from lt-zeeshan/ignore_delayed_upload_check
Add support for allowDuplicateSnapshotNames configuration
2 parents 1578b44 + 728ca20 commit a976087

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
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.18",
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/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: 4 additions & 0 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: [

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)