Skip to content

Conversation

lt-zeeshan
Copy link
Contributor

This pull request introduces a new feature for uploading PDFs and fetching their visual comparison results. It adds a new CLI command for PDF uploads, implements the backend logic for uploading and polling results, and updates environment configuration and types accordingly. The changes are grouped below by feature and infrastructure updates.

PDF Upload and Results Fetching Feature:

  • Added a new CLI command upload-pdf in uploadPdf.ts to upload PDFs for visual comparison, with options for specifying the build name and fetching results. The command is registered in the main commander program. [1] [2] [3]
  • Implemented the PDF upload logic in uploadPdfs.ts, which handles uploading single or multiple PDF files and updates the build context after upload.
  • Added polling logic in utils.ts with startPdfPolling, which repeatedly fetches and displays PDF comparison results, groups results by PDF, summarizes mismatches, and supports saving results to a file.

Backend and API Integration:

  • Extended httpClient.ts with methods uploadPdf and fetchPdfResults to support uploading PDFs and fetching their comparison results from the backend, including improved HTTP error handling. [1] [2] [3]

Environment and Types Updates:

  • Added SMARTUI_UPLOAD_URL to the environment configuration in env.ts and updated the Env and Context types accordingly. [1] [2] [3]

let ctx: Context = ctxInit(command.optsWithGlobals());

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add process.exit(1);

startPdfPolling(ctx);
}
} catch (error) {
console.log('\nRefer docs: https://www.lambdatest.com/support/docs/smart-visual-regression-testing/');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add process.exit(1);

accessKey: string;

private handleHttpError(error: any, log: Logger): never {
if (error.response) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use (error && error.response)

@sushobhit-lt sushobhit-lt merged commit 9f434eb into LambdaTest:stage Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants