Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 101 additions & 8 deletions docs/smartui-pdf-comparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ keywords:
- Visual Regression Run Specific Test
- Visual Regression Testing Environment
- How to Run Visual Regression Tests
url: https://www.lambdatest.com/support/docs/smartui-pdf-comparison/
url: https://www.lambdatest.com/support/docs/smartui-pdf-comparison/
site_name: LambdaTest
slug: smartui-pdf-comparison/
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import NewTag from '../src/component/newTag';
import CodeBlock from '@theme/CodeBlock';
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";

<script type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify({
"@context": "https://schema.org",
Expand All @@ -36,12 +42,13 @@ slug: smartui-pdf-comparison/
},{
"@type": "ListItem",
"position": 3,
"name": "WebDriverIO With Appium",
"item": "https://www.lambdatest.com/support/docs/smartui-upload-api-v2/"
"name": "SmartUI PDF Comparison",
"item": "https://www.lambdatest.com/support/docs/smartui-pdf-comparison/"
}]
})
}}
></script>

:::caution
This functionality is exclusive to our enterprise plan subscribers on SmartUI. For additional details or inquiries, please [contact us](https://www.lambdatest.com/demo).
:::
Expand All @@ -62,8 +69,6 @@ In the following section, we will walk you through the process of conducting you

## Getting Started with PDF Comparison



<div className="storylane-iframe">
<script async src="https://js.storylane.io/js/v2/storylane.js"></script>
<div className="sl-embed">
Expand All @@ -87,7 +92,7 @@ Once your project is active, retrieve your `Project Token` from the application.
projectToken = "123456#1234abcd-****-****-****-************"
```

## Step 2: Integrating PDFs via API
## Option 1: Integrating PDFs via API

After setting up your SmartUI Project, you can upload your local PDF files to your project. This will automatically generate a build by capturing snapshots of every page.

Expand All @@ -100,13 +105,101 @@ Here's how you can upload your PDFs:
| Variable | Type | Description | Required? |
| ------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | --------- |
| projectToken | string | This token is required to upload PDF files and validate your project. <br/> Example: `projectToken:123456#1234abcd-****-****-****-************` | Yes |
| pathToFiles | array | Add the path to the PDFs that will be uploaded. <br/> Example: `pathToFiles : [ "path/to/pdf-1", "path/to/pdf-2"]` | Yes |
| buildName | string | Assign a name of your choice to the build comprising the uploaded PDFs. <br/> Example: `buildName : #&lt;Build_Name&gt; | No |
| pathToFiles | array | Add the path to the PDFs that will be uploaded. <br/> Example: `pathToFiles : [ "path/to/pdf-1", "path/to/pdf-2"]` | Yes |
| buildName | string | Assign a name of your choice to the build comprising the uploaded PDFs. <br/> Example: `buildName : #<Build_Name>` | No |

:::note
Only files in `.pdf` format are compatible with this feature.
:::

## Option 2: Uploading PDFs via SmartUI CLI (Alternative Method)

For users who prefer command-line tools, SmartUI provides a CLI to easily upload PDFs and fetch test results.

### Step 1: Install the SmartUI CLI

Install the CLI globally using npm:

```bash
npm install -g @lambdatest/smartui-cli
```
### Step 2: Setup your credentials

<Tabs className="docs__val">

<TabItem value="terminal" label="Linux / MacOS" default>

<div className="lambdatest__codeblock">
<CodeBlock className="language-bash">
{`export LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
export LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"
export PROJECT_TOKEN="123456#1234abcd-****-****-****-************"`}
</CodeBlock>
</div>

</TabItem>

<TabItem value="cmd" label="Windows-CMD" default>

<div className="lambdatest__codeblock">
<CodeBlock className="language-powershell">
{`set LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
set LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"
set PROJECT_TOKEN="123456#1234abcd-****-****-****-************"`}
</CodeBlock>
</div>

</TabItem>

<TabItem value="powershell" label="Windows-PS" default>

<div className="lambdatest__codeblock">
<CodeBlock className="language-powershell">
{`$Env:LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
$Env:LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"
$Env:PROJECT_TOKEN="123456#1234abcd-****-****-****-************"`}

</CodeBlock>
</div>

</TabItem>

</Tabs>


<img loading="lazy" src={require('../assets/images/smart-visual-testing/project-token-primer.webp').default} alt="cmd" width="768" height="373" className="doc_img"/>

### Step 3: Upload PDFs Using CLI

Use the `upload-pdf` command to upload one or multiple PDF files from a directory:

```bash
smartui upload-pdf <directory_or_filename> [options]
```

#### Arguments:
- `directory_or_filename`: Path to a single PDF file or a directory containing multiple PDFs.

#### Options:
- `--fetch-results [filename]`: Fetch test results after upload. Optionally specify an output file (e.g., `results.json`).
- `--buildName <string>`: Assign a custom name to the build.

#### Example Usage:

Upload all PDFs from a folder and name the build:

```bash
smartui upload-pdf ./pdfs/ --buildName "Release-v2.1"
```

Fetch results and save to a file:

```bash
smartui upload-pdf ./spec.pdf --fetch-results results.json
```

This CLI method streamlines PDF uploads and result retrieval, making it ideal for CI/CD pipelines and automated workflows.

## Use Cases of Smart PDF Comparison

1. **Software Documentation**: In software development, PDF comparison can be utilized to ensure the accuracy and consistency of user manuals, system documentation, and more. It can help in tracking changes made in the document across different software versions or updates.
Expand Down
Loading