Skip to content

Commit 66f93e5

Browse files
Merge pull request #459 from LambdaTest/stage
Release 9th Jan
2 parents d0a53d6 + 5cf3b13 commit 66f93e5

File tree

7 files changed

+13
-6
lines changed

7 files changed

+13
-6
lines changed

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.52",
3+
"version": "4.1.53",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"

src/commander/uploadPdf.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ command
1515
.option('--fetch-results [filename]', 'Fetch results and optionally specify an output file, e.g., <filename>.json')
1616
.option('--buildName <string>', 'Specify the build name')
1717
.option('--markBaseline', 'Mark this build baseline')
18+
.option('--pdfNames <string>', 'Specify PDF names for the upload')
1819
.action(async function(directory, _, command) {
1920
const options = command.optsWithGlobals();
2021
if (options.buildName === '') {

src/lib/ctx.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ export default (options: Record<string, string>): Context => {
227227
githubURL : options.gitURL || options.githubURL || '',
228228
showRenderErrors: options.showRenderErrors ? true : false,
229229
userName: options.userName || '',
230-
accessKey: options.accessKey || ''
230+
accessKey: options.accessKey || '',
231+
pdfNames: options.pdfNames || ''
231232
},
232233
cliVersion: version,
233234
totalSnapshots: -1,

src/lib/httpClient.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,14 +772,17 @@ export default class httpClient {
772772
}
773773
}
774774

775-
async uploadPdf(ctx: Context, form: FormData, buildName?: string): Promise<any> {
775+
async uploadPdf(ctx: Context, form: FormData, buildName?: string, pdfNames?: string): Promise<any> {
776776
form.append('projectToken', this.projectToken);
777777
if (ctx.build.name !== undefined && ctx.build.name !== '') {
778778
form.append('buildName', buildName);
779779
}
780780
if (ctx.options.markBaseline) {
781781
form.append('markBaseline', ctx.options.markBaseline.toString());
782782
}
783+
if (pdfNames && pdfNames !== '') {
784+
form.append('pdfNames', pdfNames);
785+
}
783786

784787
try {
785788
const response = await this.axiosInstance.request({

src/lib/screenshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async function captureScreenshotsForConfig(
7979
};
8080
} else {
8181
const geoResp = await ctx.client.getGeolocationProxy(ctx.config.geolocation, ctx.log);
82-
ctx.log.debug(`Geolocation proxy response: ${JSON.stringify(geoResp)}`);
82+
ctx.log.debug(`Geolocation proxy response: ${JSON.stringify(geoResp)}`);
8383
if (geoResp && geoResp.data && geoResp.data.proxy && geoResp.data.username && geoResp.data.password) {
8484
ctx.log.info(`URL Capture :: Using geolocation proxy for ${ctx.config.geolocation}`);
8585
ctx.geolocationData = {

src/tasks/uploadPdfs.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function uploadPdfs(ctx: Context, pdfPath: string): Promise<void> {
3535
formData.append('pathToFiles', fs.createReadStream(pdfPath));
3636
} else {
3737
const files = fs.readdirSync(pdfPath);
38-
const pdfFiles = files.filter(file => file.endsWith('.pdf'));
38+
const pdfFiles = files.filter(file => file.endsWith('.pdf')).sort();
3939

4040
pdfFiles.forEach(pdf => {
4141
const filePath = path.join(pdfPath, pdf);
@@ -44,13 +44,14 @@ async function uploadPdfs(ctx: Context, pdfPath: string): Promise<void> {
4444
}
4545

4646
const buildName = ctx.options.buildName;
47+
const pdfNames = ctx.options.pdfNames;
4748

4849
if (buildName) {
4950
ctx.build.name = buildName;
5051
}
5152

5253
try {
53-
const response = await ctx.client.uploadPdf(ctx, formData, buildName);
54+
const response = await ctx.client.uploadPdf(ctx, formData, buildName, pdfNames);
5455
if (response && response.buildId) {
5556
ctx.build.id = response.buildId;
5657
ctx.log.debug(`PDF upload successful. Build ID: ${ctx.build.id}`);

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export interface Context {
8585
githubURL?: string,
8686
gitURL?: string,
8787
showRenderErrors?: boolean,
88+
pdfNames?: string,
8889
userName?: string,
8990
accessKey?: string
9091
}

0 commit comments

Comments
 (0)