Skip to content

Commit bace840

Browse files
authored
Merge pull request #140 from LambdaTest/dev
Dev -> Stage
2 parents 3923f9d + 0662988 commit bace840

File tree

9 files changed

+277
-92
lines changed

9 files changed

+277
-92
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
"author": "LambdaTest <[email protected]>",
2222
"license": "MIT",
2323
"dependencies": {
24-
"@playwright/browser-chromium": "^1.45.3",
25-
"@playwright/browser-firefox": "^1.45.3",
26-
"@playwright/browser-webkit": "^1.45.3",
27-
"@playwright/test": "^1.45.3",
24+
"@playwright/browser-chromium": "^1.47.2",
25+
"@playwright/browser-firefox": "^1.47.2",
26+
"@playwright/browser-webkit": "^1.47.2",
27+
"@playwright/test": "^1.47.2",
2828
"@types/cross-spawn": "^6.0.4",
2929
"@types/node": "^20.8.9",
3030
"@types/which": "^3.0.2",

packages/cli/README.md

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,68 @@
1-
# SmartUI CLI
2-
[![SmartUI-Testing](https://smartui.lambdatest.com/static/media/LTBadge.64a05e73.svg)](https://smartui.lambdatest.com)
1+
# SmartUI-CLI
32

4-
The SmartUI CLI is used to create configs, take screenshots and upload to [SmartUI Dashboard](https://smartui.lambdatest.com/) via
5-
the command line.
3+
<img height="400" src="https://user-images.githubusercontent.com/126776938/232535511-8d51cf1b-1a33-48fc-825c-b13e7a9ec388.png">
4+
5+
<p align="center">
6+
<a href="https://www.lambdatest.com/blog/?utm_source=github&utm_medium=repo&utm_campaign=playwright-sample" target="_bank">Blog</a>
7+
&nbsp; &#8901; &nbsp;
8+
<a href="https://www.lambdatest.com/support/docs/?utm_source=github&utm_medium=repo&utm_campaign=playwright-sample" target="_bank">Docs</a>
9+
&nbsp; &#8901; &nbsp;
10+
<a href="https://www.lambdatest.com/learning-hub/?utm_source=github&utm_medium=repo&utm_campaign=playwright-sample" target="_bank">Learning Hub</a>
11+
&nbsp; &#8901; &nbsp;
12+
<a href="https://www.lambdatest.com/newsletter/?utm_source=github&utm_medium=repo&utm_campaign=playwright-sample" target="_bank">Newsletter</a>
13+
&nbsp; &#8901; &nbsp;
14+
<a href="https://www.lambdatest.com/certifications/?utm_source=github&utm_medium=repo&utm_campaign=playwright-sample" target="_bank">Certifications</a>
15+
&nbsp; &#8901; &nbsp;
16+
<a href="https://www.youtube.com/c/LambdaTest" target="_bank">YouTube</a>
17+
</p>
18+
&emsp;
19+
&emsp;
20+
&emsp;
21+
22+
23+
24+
[<img height="58" width="200" src="https://user-images.githubusercontent.com/70570645/171866795-52c11b49-0728-4229-b073-4b704209ddde.png">](https://accounts.lambdatest.com/register?utm_source=github&utm_medium=repo&utm_campaign=playwright-sample)
25+
26+
27+
The **SmartUI-CLI** allows you to capture visual snapshots of your web applications, upload images, and run visual regression tests using [LambdaTest's SmartUI](https://www.lambdatest.com/visual-regression-testing) platform directly from the command line.
628

729
- [Installation](#installation)
8-
- [Start using CLI](#start-using-cli)
30+
- [Commands](#commands)
31+
- [Documentation](#documentation)
32+
- [Issues](#issues)
933

1034
## Installation
1135

1236
```sh-session
13-
$ npm install -g @lambdatest/smartui-cli --force
37+
$ npm install smartui-cli
1438
```
1539

16-
## Start using CLI
40+
**Note:**
41+
If you face any problems executing tests with SmartUI-CLI `versions >= v4.x.x`, upgrade your Node.js version to `v20.3` or above.
1742

18-
#### Create URL Json file
19-
```sh-session
20-
$ smartui config:web-static urls.json
21-
```
43+
## Commands
44+
- `npx smartui exec` - Capture DOM assets for visual testing across multiple browsers and resolutions.
45+
- `npx smartui capture` - Bulk capture static URLs for visual testing.
46+
- `npx smartui upload` - Upload custom images or screenshots for visual comparison.
47+
- `npx smartui upload-figma` - Upload Figma design images for visual comparison.
48+
- `npx smartui config` - Creates configuration file according to the usecase.
2249

23-
#### Create custom Web Config file
24-
```sh-session
25-
$ smartui config:create-web smartui-web.json
26-
```
50+
### Documentation
2751

28-
#### Configure your Project Token
52+
In addition to its core functionalities, the SmartUI CLI leverages LambdaTest's cloud infrastructure for robust, scalable visual regression testing across various browsers and devices.
2953

30-
Create a new web project from [SmartUI Dashboard](https://smartui.lambdatest.com/) and copy the project token and set on CLI via command
54+
- [SmartUI Selenium SDK](https://www.lambdatest.com/support/docs/smartui-selenium-java-sdk) - A complete SDK to capture DOM assets for visual tests.
55+
- [LambdaTest Documentation](https://www.lambdatest.com/support/docs/) - Official LambdaTest documentation for SmartUI and other integrations.
56+
- [Bulk capturing static URLs with SmartUI](https://www.lambdatest.com/support/docs/smartui-cli/) - Documentation for capturing satatic urls in bulk with SmartUI
57+
- [Bring your own screenshots](https://www.lambdatest.com/support/docs/smartui-cli-upload/) - Documentation for capturing satatic urls in bulk
58+
- [Figma CLI](https://www.lambdatest.com/support/docs/smartui-cli-figma/) - Documentation for uploading figma components to SmartUI
3159

32-
<b>For Linux/macOS:</b>
60+
### Issues
3361

34-
```
35-
export PROJECT_TOKEN="****-****-****-************"
36-
```
62+
If you encounter problems with SmartUI-CLI, [add an issue on GitHub](https://github.com/LambdaTest/smartui-cli/issues/new).
3763

38-
<b>For Windows:</b>
64+
For other support issues, reach out via [LambdaTest Support](https://www.lambdatest.com/support).
3965

40-
```
41-
set PROJECT_TOKEN="****-****-****-************"
42-
```
43-
44-
#### Capture Screenshots
45-
```sh-session
46-
$ smartui capture urls.json --config smartui-web.json
47-
```
66+
------
67+
68+
[Know more](https://www.lambdatest.com/visual-regression-testing) about SmartUI and it's AI enabled comparison engines.

pnpm-lock.yaml

Lines changed: 31 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/constants.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,66 @@ export default {
4747
EDGE_CHANNEL: 'msedge',
4848
WEBKIT: 'webkit',
4949

50+
// discovery browser launch arguments
51+
LAUNCH_ARGS: [
52+
// disable the translate popup and optimization downloads
53+
'--disable-features=Translate,OptimizationGuideModelDownloading',
54+
// disable several subsystems which run network requests in the background
55+
'--disable-background-networking',
56+
// disable task throttling of timer tasks from background pages
57+
'--disable-background-timer-throttling',
58+
// disable backgrounding renderer processes
59+
'--disable-renderer-backgrounding',
60+
// disable backgrounding renderers for occluded windows (reduce nondeterminism)
61+
'--disable-backgrounding-occluded-windows',
62+
// disable crash reporting
63+
'--disable-breakpad',
64+
// disable client side phishing detection
65+
'--disable-client-side-phishing-detection',
66+
// disable default component extensions with background pages for performance
67+
'--disable-component-extensions-with-background-pages',
68+
// disable installation of default apps on first run
69+
'--disable-default-apps',
70+
// work-around for environments where a small /dev/shm partition causes crashes
71+
'--disable-dev-shm-usage',
72+
// disable extensions
73+
'--disable-extensions',
74+
// disable hang monitor dialogs in renderer processes
75+
'--disable-hang-monitor',
76+
// disable inter-process communication flooding protection for javascript
77+
'--disable-ipc-flooding-protection',
78+
// disable web notifications and the push API
79+
'--disable-notifications',
80+
// disable the prompt when a POST request causes page navigation
81+
'--disable-prompt-on-repost',
82+
// disable syncing browser data with google accounts
83+
'--disable-sync',
84+
// disable site-isolation to make network requests easier to intercept
85+
'--disable-site-isolation-trials',
86+
// disable the first run tasks, whether or not it's actually the first run
87+
'--no-first-run',
88+
// disable the sandbox for all process types that are normally sandboxed
89+
'--no-sandbox',
90+
// specify a consistent encryption backend across platforms
91+
'--password-store=basic',
92+
// use a mock keychain on Mac to prevent blocking permissions dialogs
93+
'--use-mock-keychain',
94+
// enable remote debugging on the first available port
95+
'--remote-debugging-port=0',
96+
// sets navigator.webdriver to false
97+
'--disable-blink-features=AutomationControlled',
98+
// disable UA-CH feature
99+
`--disable-features=UserAgentClientHint`,
100+
],
101+
102+
// discovery request headers
103+
REQUEST_HEADERS: {
104+
// `HeadlessChrome` is added to sec-ch-ua, `--disable-features=UserAgentClientHint` doesn't seem to work
105+
'sec-ch-ua':'"Chromium";v="129", "Not=A?Brand";v="8"',
106+
'sec-ch-ua-mobile': '"?0"',
107+
'sec-ch-ua-platform': '"Windows"'
108+
},
109+
50110
// user agents
51111
CHROME_USER_AGENT: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.6312.107 Safari/537.3',
52112
FIREFOX_USER_AGENT: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:112.0) Gecko/20100101 Firefox/112.0',

0 commit comments

Comments
 (0)