From 6c6be7c1f7090c5f9228004c808006600d55debd Mon Sep 17 00:00:00 2001 From: sushobhit-lt Date: Tue, 1 Oct 2024 13:12:50 +0530 Subject: [PATCH 1/2] add smartui capabilities in LT:Options for selenium version >=4 --- hooks/examples/test.js | 47 +++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/hooks/examples/test.js b/hooks/examples/test.js index 62702fd..fe05859 100644 --- a/hooks/examples/test.js +++ b/hooks/examples/test.js @@ -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; @@ -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 } } @@ -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 }); From 0fee284492515bcbbed209ffb6c82ff763b4f344 Mon Sep 17 00:00:00 2001 From: sushobhit-lt Date: Tue, 1 Oct 2024 16:11:44 +0530 Subject: [PATCH 2/2] remove commented code --- hooks/examples/test.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hooks/examples/test.js b/hooks/examples/test.js index fe05859..0849f4d 100644 --- a/hooks/examples/test.js +++ b/hooks/examples/test.js @@ -10,9 +10,7 @@ const USERNAME = process.env.LT_USERNAME || "username"; 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 +const GRID_HOST = process.env.GRID_HOST || "@hub.lambdatest.com/wd/hub"; //connect to lambdatest hub async function searchTextOnGoogle() { var keys = process.argv;