Skip to content

Commit 3b8d064

Browse files
authored
Merge pull request #2065 from Ishavyas9/main
pdf cli upload doc update
2 parents 9131561 + 2fe4786 commit 3b8d064

File tree

1 file changed

+101
-8
lines changed

1 file changed

+101
-8
lines changed

docs/smartui-pdf-comparison.md

Lines changed: 101 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ keywords:
1414
- Visual Regression Run Specific Test
1515
- Visual Regression Testing Environment
1616
- How to Run Visual Regression Tests
17-
url: https://www.lambdatest.com/support/docs/smartui-pdf-comparison/
17+
url: https://www.lambdatest.com/support/docs/smartui-pdf-comparison/
1818
site_name: LambdaTest
1919
slug: smartui-pdf-comparison/
2020
---
2121

22+
import Tabs from '@theme/Tabs';
23+
import TabItem from '@theme/TabItem';
24+
import NewTag from '../src/component/newTag';
25+
import CodeBlock from '@theme/CodeBlock';
26+
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
27+
2228
<script type="application/ld+json"
2329
dangerouslySetInnerHTML={{ __html: JSON.stringify({
2430
"@context": "https://schema.org",
@@ -36,12 +42,13 @@ slug: smartui-pdf-comparison/
3642
},{
3743
"@type": "ListItem",
3844
"position": 3,
39-
"name": "WebDriverIO With Appium",
40-
"item": "https://www.lambdatest.com/support/docs/smartui-upload-api-v2/"
45+
"name": "SmartUI PDF Comparison",
46+
"item": "https://www.lambdatest.com/support/docs/smartui-pdf-comparison/"
4147
}]
4248
})
4349
}}
4450
></script>
51+
4552
:::caution
4653
This functionality is exclusive to our enterprise plan subscribers on SmartUI. For additional details or inquiries, please [contact us](https://www.lambdatest.com/demo).
4754
:::
@@ -62,8 +69,6 @@ In the following section, we will walk you through the process of conducting you
6269

6370
## Getting Started with PDF Comparison
6471

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

90-
## Step 2: Integrating PDFs via API
95+
## Option 1: Integrating PDFs via API
9196

9297
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.
9398

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

106111
:::note
107112
Only files in `.pdf` format are compatible with this feature.
108113
:::
109114

115+
## Option 2: Uploading PDFs via SmartUI CLI (Alternative Method)
116+
117+
For users who prefer command-line tools, SmartUI provides a CLI to easily upload PDFs and fetch test results.
118+
119+
### Step 1: Install the SmartUI CLI
120+
121+
Install the CLI globally using npm:
122+
123+
```bash
124+
npm install -g @lambdatest/smartui-cli
125+
```
126+
### Step 2: Setup your credentials
127+
128+
<Tabs className="docs__val">
129+
130+
<TabItem value="terminal" label="Linux / MacOS" default>
131+
132+
<div className="lambdatest__codeblock">
133+
<CodeBlock className="language-bash">
134+
{`export LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
135+
export LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"
136+
export PROJECT_TOKEN="123456#1234abcd-****-****-****-************"`}
137+
</CodeBlock>
138+
</div>
139+
140+
</TabItem>
141+
142+
<TabItem value="cmd" label="Windows-CMD" default>
143+
144+
<div className="lambdatest__codeblock">
145+
<CodeBlock className="language-powershell">
146+
{`set LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
147+
set LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"
148+
set PROJECT_TOKEN="123456#1234abcd-****-****-****-************"`}
149+
</CodeBlock>
150+
</div>
151+
152+
</TabItem>
153+
154+
<TabItem value="powershell" label="Windows-PS" default>
155+
156+
<div className="lambdatest__codeblock">
157+
<CodeBlock className="language-powershell">
158+
{`$Env:LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}"
159+
$Env:LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"
160+
$Env:PROJECT_TOKEN="123456#1234abcd-****-****-****-************"`}
161+
162+
</CodeBlock>
163+
</div>
164+
165+
</TabItem>
166+
167+
</Tabs>
168+
169+
170+
<img loading="lazy" src={require('../assets/images/smart-visual-testing/project-token-primer.webp').default} alt="cmd" width="768" height="373" className="doc_img"/>
171+
172+
### Step 3: Upload PDFs Using CLI
173+
174+
Use the `upload-pdf` command to upload one or multiple PDF files from a directory:
175+
176+
```bash
177+
smartui upload-pdf <directory_or_filename> [options]
178+
```
179+
180+
#### Arguments:
181+
- `directory_or_filename`: Path to a single PDF file or a directory containing multiple PDFs.
182+
183+
#### Options:
184+
- `--fetch-results [filename]`: Fetch test results after upload. Optionally specify an output file (e.g., `results.json`).
185+
- `--buildName <string>`: Assign a custom name to the build.
186+
187+
#### Example Usage:
188+
189+
Upload all PDFs from a folder and name the build:
190+
191+
```bash
192+
smartui upload-pdf ./pdfs/ --buildName "Release-v2.1"
193+
```
194+
195+
Fetch results and save to a file:
196+
197+
```bash
198+
smartui upload-pdf ./spec.pdf --fetch-results results.json
199+
```
200+
201+
This CLI method streamlines PDF uploads and result retrieval, making it ideal for CI/CD pipelines and automated workflows.
202+
110203
## Use Cases of Smart PDF Comparison
111204

112205
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.

0 commit comments

Comments
 (0)