Skip to content

Commit 6c6be7c

Browse files
committed
add smartui capabilities in LT:Options for selenium version >=4
1 parent b2629da commit 6c6be7c

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

hooks/examples/test.js

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const KEY = process.env.LT_ACCESS_KEY || "accessKey";
1212
// gridUrl: gridUrl can be found at automation dashboard
1313
//const GRID_HOST = process.env.GRID_HOST || "@hub.sushobhit.dev.lambdatest.io/wd/hub"; //dev
1414
const GRID_HOST =
15-
process.env.GRID_HOST || "@hub.lambdatest.com/wd/hub"; //connect to lambdatest hub
15+
process.env.GRID_HOST || "@hub.lambdatest.com/wd/hub"; //connect to lambdatest hub
1616

1717
async function searchTextOnGoogle() {
1818
var keys = process.argv;
@@ -34,32 +34,34 @@ async function searchTextOnGoogle() {
3434
"accessKey": KEY,
3535
name: "test session", // name of the test
3636
build: platform + browserName + version, // name of the build
37-
"smartUI.project": "smartuigithub",
38-
// will generate random smartUI build if not specified
39-
// "smartUI.build": "first",
40-
"smartUI.options": {
41-
"output": {
42-
"errorColor": {
43-
"red": 200,
44-
"green": 0,
45-
"blue": 255
37+
"LT:Options": {
38+
"smartUI.project": "smartuigithub",
39+
// will generate random smartUI build if not specified
40+
// "smartUI.build": "first",
41+
"smartUI.options": {
42+
"output": {
43+
"errorColor": {
44+
"red": 200,
45+
"green": 0,
46+
"blue": 255
47+
},
48+
"errorType": "movement",
49+
"transparency": 0.3,
50+
"largeImageThreshold": 100,
51+
"useCrossOrigin": false,
52+
"outputDiff": true
4653
},
47-
"errorType": "movement",
48-
"transparency": 0.3,
49-
"largeImageThreshold": 100,
50-
"useCrossOrigin": false,
51-
"outputDiff": true
52-
},
53-
"scaleToSameSize": true,
54-
"ignore": "antialiasing"
54+
"scaleToSameSize": true,
55+
"ignore": "antialiasing"
56+
}
5557
}
5658
};
5759

5860
//add github app capabilities
5961
let githubURL = process.env.GITHUB_URL
60-
if (githubURL){
62+
if (githubURL) {
6163
capabilities.github = {
62-
url:githubURL
64+
url: githubURL
6365
}
6466
}
6567

@@ -104,7 +106,10 @@ async function startTest(gridUrl, capabilities, name) {
104106
// For Smartui TakeScreenshot
105107
setTimeout(function () {
106108
console.log("taking screenshot ...")
107-
driver.executeScript(`smartui.takeScreenshot,{"screenshotName":"web-page"}`).then(out => {
109+
let config = {
110+
screenshotName: "web-page"
111+
};
112+
driver.executeScript("smartui.takeScreenshot", config).then(out => {
108113
console.log("RESPONSE :", out)
109114
return
110115
});

0 commit comments

Comments
 (0)