Skip to content

Commit

Permalink
add smartui capabilities in LT:Options for selenium version >=4
Browse files Browse the repository at this point in the history
  • Loading branch information
sushobhit-lt committed Oct 1, 2024
1 parent b2629da commit 6c6be7c
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions hooks/examples/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const KEY = process.env.LT_ACCESS_KEY || "accessKey";
// gridUrl: gridUrl can be found at automation dashboard
//const GRID_HOST = process.env.GRID_HOST || "@hub.sushobhit.dev.lambdatest.io/wd/hub"; //dev
const GRID_HOST =
process.env.GRID_HOST || "@hub.lambdatest.com/wd/hub"; //connect to lambdatest hub
process.env.GRID_HOST || "@hub.lambdatest.com/wd/hub"; //connect to lambdatest hub

async function searchTextOnGoogle() {
var keys = process.argv;
Expand All @@ -34,32 +34,34 @@ async function searchTextOnGoogle() {
"accessKey": KEY,
name: "test session", // name of the test
build: platform + browserName + version, // name of the build
"smartUI.project": "smartuigithub",
// will generate random smartUI build if not specified
// "smartUI.build": "first",
"smartUI.options": {
"output": {
"errorColor": {
"red": 200,
"green": 0,
"blue": 255
"LT:Options": {
"smartUI.project": "smartuigithub",
// will generate random smartUI build if not specified
// "smartUI.build": "first",
"smartUI.options": {
"output": {
"errorColor": {
"red": 200,
"green": 0,
"blue": 255
},
"errorType": "movement",
"transparency": 0.3,
"largeImageThreshold": 100,
"useCrossOrigin": false,
"outputDiff": true
},
"errorType": "movement",
"transparency": 0.3,
"largeImageThreshold": 100,
"useCrossOrigin": false,
"outputDiff": true
},
"scaleToSameSize": true,
"ignore": "antialiasing"
"scaleToSameSize": true,
"ignore": "antialiasing"
}
}
};

//add github app capabilities
let githubURL = process.env.GITHUB_URL
if (githubURL){
if (githubURL) {
capabilities.github = {
url:githubURL
url: githubURL
}
}

Expand Down Expand Up @@ -104,7 +106,10 @@ async function startTest(gridUrl, capabilities, name) {
// For Smartui TakeScreenshot
setTimeout(function () {
console.log("taking screenshot ...")
driver.executeScript(`smartui.takeScreenshot,{"screenshotName":"web-page"}`).then(out => {
let config = {
screenshotName: "web-page"
};
driver.executeScript("smartui.takeScreenshot", config).then(out => {
console.log("RESPONSE :", out)
return
});
Expand Down

0 comments on commit 6c6be7c

Please sign in to comment.