Skip to content

Commit ada7c09

Browse files
authored
Add smartUI doc (webdriverio#14916)
1 parent be977f9 commit ada7c09

2 files changed

Lines changed: 123 additions & 0 deletions

File tree

website/_sidebars.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@
206206
"visual-testing/integrate-with-app-percy"
207207
]
208208
},
209+
{
210+
"type": "doc",
211+
"id": "visual-testing/integrate-with-smartui",
212+
"label": "SmartUI"
213+
},
209214
{
210215
"type": "doc",
211216
"id": "visual-testing/argos",
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
id: integrate-with-smartui
3+
title: SmartUI
4+
---
5+
6+
LambdaTest [SmartUI](https://www.lambdatest.com/smart-visual-testing) provides AI-powered visual regression testing for your WebdriverIO tests. It captures screenshots, compares them against baselines, and highlights visual differences with intelligent comparison algorithms.
7+
8+
## Setup
9+
10+
**Create a SmartUI project**
11+
12+
[Sign in](https://accounts.lambdatest.com/register) to LambdaTest and navigate to [SmartUI Projects](https://smartui.lambdatest.com/) to create a new project. Select **Web** as the platform and configure your project name, approvers, and tags.
13+
14+
**Set up credentials**
15+
16+
Get your `LT_USERNAME` and `LT_ACCESS_KEY` from the LambdaTest dashboard and set them as environment variables:
17+
18+
```sh
19+
export LT_USERNAME="<your username>"
20+
export LT_ACCESS_KEY="<your access key>"
21+
```
22+
23+
**Install SmartUI SDK**
24+
25+
```sh
26+
npm install @lambdatest/wdio-driver
27+
```
28+
29+
**Configure WebdriverIO**
30+
31+
Update your `wdio.conf.js`:
32+
33+
```javascript
34+
exports.config = {
35+
user: process.env.LT_USERNAME,
36+
key: process.env.LT_ACCESS_KEY,
37+
38+
capabilities: [{
39+
browserName: 'chrome',
40+
browserVersion: 'latest',
41+
'LT:Options': {
42+
platform: 'Windows 10',
43+
build: 'SmartUI Build',
44+
name: 'SmartUI Test',
45+
smartUI.project: '<Your Project Name>',
46+
smartUI.build: '<Your Build Name>',
47+
smartUI.baseline: false
48+
}
49+
}]
50+
}
51+
```
52+
53+
## Usage
54+
55+
Use `browser.execute('smartui.takeScreenshot')` to capture screenshots:
56+
57+
```javascript
58+
describe('WebdriverIO SmartUI Test', () => {
59+
it('should capture screenshot for visual testing', async () => {
60+
await browser.url('https://webdriver.io');
61+
62+
await browser.execute('smartui.takeScreenshot', {
63+
screenshotName: 'Homepage Screenshot'
64+
});
65+
66+
await browser.execute('smartui.takeScreenshot', {
67+
screenshotName: 'Homepage with Options',
68+
ignoreDOM: {
69+
id: ['dynamic-element-id'],
70+
class: ['ad-banner']
71+
}
72+
});
73+
});
74+
});
75+
```
76+
77+
**Run tests**
78+
79+
```sh
80+
npx wdio wdio.conf.js
81+
```
82+
83+
View results in the [SmartUI Dashboard](https://smartui.lambdatest.com/).
84+
85+
## Advanced Options
86+
87+
**Ignore elements**
88+
89+
```javascript
90+
await browser.execute('smartui.takeScreenshot', {
91+
screenshotName: 'Ignore Dynamic Elements',
92+
ignoreDOM: {
93+
id: ['element-id'],
94+
class: ['dynamic-class'],
95+
xpath: ['//div[@class="ad"]']
96+
}
97+
});
98+
```
99+
100+
**Select specific areas**
101+
102+
```javascript
103+
await browser.execute('smartui.takeScreenshot', {
104+
screenshotName: 'Compare Specific Area',
105+
selectDOM: {
106+
id: ['main-content']
107+
}
108+
});
109+
```
110+
111+
## Resources
112+
113+
| Resource | Description |
114+
|---------------------------------------------------------------------------------------------------|------------------------------------------|
115+
| [Official Documentation](https://www.lambdatest.com/support/docs/smart-ui-cypress/) | SmartUI Documentation |
116+
| [SmartUI Dashboard](https://smartui.lambdatest.com/) | Access your SmartUI projects and builds |
117+
| [Advanced Settings](https://www.lambdatest.com/support/docs/test-settings-options/) | Configure comparison sensitivity |
118+
| [Build Options](https://www.lambdatest.com/support/docs/smart-ui-build-options/) | Advanced build configuration |

0 commit comments

Comments
 (0)