Skip to content

Commit 16b2d51

Browse files
committed
Parameterised the file
1 parent 3c6ef6d commit 16b2d51

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

sdk/parameterisedSDKCloud.js

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const { Builder, By, Key, until } = require('selenium-webdriver');
2+
const { smartuiSnapshot } = require('@lambdatest/selenium-driver');
3+
4+
// username: Username can be found at automation dashboard
5+
const USERNAME = process.env.LT_USERNAME || "<USERNAME>";
6+
7+
// AccessKey: AccessKey can be generated from automation dashboard or profile section
8+
const KEY = process.env.LT_ACCESS_KEY || "<ACCESS_KEY>";
9+
10+
// export BROWSER_NAME=edge | export BROWSER_NAME=firefox | export BROWSER_NAME=safari
11+
const BROWSER_NAME = process.env.BROWSER_NAME || "chrome";
12+
13+
let capabilities = {
14+
platform: "catalina",
15+
browserName: BROWSER_NAME,
16+
version: "latest",
17+
"LT:Options": {
18+
username: USERNAME,
19+
accessKey: KEY,
20+
project: "<PROJECT_NAME>",
21+
w3c: true,
22+
name: "SDK_Cloud_" + BROWSER_NAME, // name of the test
23+
build: "SmartUI_Node_SDK", // name of the build
24+
visual: true,
25+
},
26+
};
27+
28+
(async function example() {
29+
// Setup Input capabilities
30+
var gridUrl =
31+
"https://" + USERNAME + ":" + KEY + "@hub.lambdatest.com/wd/hub";
32+
33+
let driver = await new Builder()
34+
.usingServer(gridUrl)
35+
.withCapabilities(capabilities)
36+
.build();
37+
driver.manage().window().fullscreen();
38+
try {
39+
await driver.get("https://www.lambdatest.com/visual-regression-testing");
40+
await smartuiSnapshot(driver, "LT-SmartUI");
41+
} finally {
42+
await driver.quit();
43+
}
44+
})();

0 commit comments

Comments
 (0)