Skip to content

Commit 2fa6fe1

Browse files
authored
SDK sanity
1 parent a7a058b commit 2fa6fe1

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,60 @@ node .examples\test.js
106106
- **Purpose:** Use the SmartUI SDK for comprehensive visual testing in both local and remote automation tests environments.
107107
- **Advantages:** Ensure consistent DOM capturing and rendering across various browsers and resolutions.
108108
- **More Information:** [SmartUI Selenium JavaScript SDK Documentation](https://www.lambdatest.com/support/docs/smartui-selenium-js-sdk/).
109+
110+
##### Steps:
111+
- Install the dependencies
112+
```bash
113+
cd sdk
114+
npm i @lambdatest/smartui-cli @lambdatest/selenium-driver selenium-webdriver
115+
```
116+
- Configure your Project Token
117+
118+
Setup your project token show in the **SmartUI** app after, creating your project.
119+
120+
<Tabs className="docs__val" groupId="language">
121+
<TabItem value="MacOS/Linux" label="MacOS/Linux" default>
122+
123+
```bash
124+
export PROJECT_TOKEN="123456#1234abcd-****-****-****-************"
125+
```
126+
127+
</TabItem>
128+
<TabItem value="Windows" label="Windows - CMD">
129+
130+
```bash
131+
set PROJECT_TOKEN="123456#1234abcd-****-****-****-************"
132+
```
133+
134+
</TabItem>
135+
<TabItem value="Powershell" label="Windows-PS">
136+
137+
```bash
138+
$Env:PROJECT_TOKEN="123456#1234abcd-****-****-****-************"
139+
```
140+
</TabItem>
141+
</Tabs>
142+
143+
- Add the SmartUI function to take screenshot to `sdkLocal.js` file
144+
```js
145+
import { Builder, By, Key, until } from 'selenium-webdriver';
146+
import { smartuiSnapshot } from '@lambdatest/selenium-driver';
147+
148+
(async function example() {
149+
let driver = await new Builder()
150+
.forBrowser('chrome')
151+
.build();
152+
153+
try {
154+
await driver.get('<Required URL>'); //enter your desired URL here
155+
await smartuiSnapshot(driver, '<Screenshot_Name>');
156+
} finally {
157+
await driver.quit();
158+
}
159+
})();
160+
```
161+
- Execute the Tests on SmartUI Cloud
162+
163+
```bash
164+
npx smartui exec node <fileName>.js
165+
```
File renamed without changes.

0 commit comments

Comments
 (0)