From 16b2d51c40071a68178b69509d5aea48f0488de0 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 9 Oct 2024 14:28:19 +0530 Subject: [PATCH] Parameterised the file --- sdk/parameterisedSDKCloud.js | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 sdk/parameterisedSDKCloud.js diff --git a/sdk/parameterisedSDKCloud.js b/sdk/parameterisedSDKCloud.js new file mode 100644 index 0000000..c0d3fd7 --- /dev/null +++ b/sdk/parameterisedSDKCloud.js @@ -0,0 +1,44 @@ +const { Builder, By, Key, until } = require('selenium-webdriver'); +const { smartuiSnapshot } = require('@lambdatest/selenium-driver'); + +// username: Username can be found at automation dashboard +const USERNAME = process.env.LT_USERNAME || ""; + +// AccessKey: AccessKey can be generated from automation dashboard or profile section +const KEY = process.env.LT_ACCESS_KEY || ""; + +// export BROWSER_NAME=edge | export BROWSER_NAME=firefox | export BROWSER_NAME=safari +const BROWSER_NAME = process.env.BROWSER_NAME || "chrome"; + +let capabilities = { + platform: "catalina", + browserName: BROWSER_NAME, + version: "latest", + "LT:Options": { + username: USERNAME, + accessKey: KEY, + project: "", + w3c: true, + name: "SDK_Cloud_" + BROWSER_NAME, // name of the test + build: "SmartUI_Node_SDK", // name of the build + visual: true, + }, +}; + +(async function example() { + // Setup Input capabilities + var gridUrl = + "https://" + USERNAME + ":" + KEY + "@hub.lambdatest.com/wd/hub"; + + let driver = await new Builder() + .usingServer(gridUrl) + .withCapabilities(capabilities) + .build(); + driver.manage().window().fullscreen(); + try { + await driver.get("https://www.lambdatest.com/visual-regression-testing"); + await smartuiSnapshot(driver, "LT-SmartUI"); + } finally { + await driver.quit(); + } +})();