Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK changes #25

Merged
merged 27 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
"dependencies": {
"minimatch": "^3.0.5",
"moment": "^2.29.4",
"playwright": "^1.35.1",
"scroll-to-bottomjs": "^1.1.0",
"selenium-webdriver": "^3.6.0"
"@lambdatest/selenium-driver": "^1.0.0",
"@lambdatest/smartui-cli": "^2.0.0",
"selenium-webdriver": "^4.16.0"
},
"type": "module",
sushobhit-lt marked this conversation as resolved.
Show resolved Hide resolved
"name": "nodejs-selenium-sample",
"description": "![LambdaTest Logo](https://www.lambdatest.com/images/logo.svg)",
"version": "1.0.0",
Expand All @@ -25,5 +29,8 @@
"bugs": {
"url": "https://github.com/LambdaTest/nodejs-selenium-sample/issues"
},
"homepage": "https://github.com/LambdaTest/nodejs-selenium-sample#readme"
"homepage": "https://github.com/LambdaTest/nodejs-selenium-sample#readme",
"devDependencies": {
"@playwright/test": "^1.35.1"
}
}
40 changes: 40 additions & 0 deletions sdk/SmartUI_SDK.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Builder, By, Key, until } from 'selenium-webdriver';
import { smartuiSnapshot } from '@lambdatest/selenium-driver';

// username: Username can be found at automation dashboard
const USERNAME = process.env.LT_USERNAME || "<USERNAME>";

// AccessKey: AccessKey can be generated from automation dashboard or profile section
const KEY = process.env.LT_ACCESS_KEY || "<ACCESS_KEY>";
let capabilities = {
platform: "catalina",
browserName: "chrome",
version: "latest",
"LT:Options": {
"username": USERNAME,
"accessKey": KEY,
"project": "<PROJECT_NAME>",
"w3c": true,
name: "<TEST_NAME>", // name of the test
build: "<BUILD_NAME", // name of the build
visual: true,
sushobhit-lt marked this conversation as resolved.
Show resolved Hide resolved

},
};

(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();
}
})();
18 changes: 18 additions & 0 deletions sdk/SmartUI_SDK_local.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Builder, By, Key, until } from 'selenium-webdriver';
import { smartuiSnapshot } from '@lambdatest/selenium-driver';

(async function example() {
let driver = await new Builder()
.forBrowser('edge')
sushobhit-lt marked this conversation as resolved.
Show resolved Hide resolved
.build();

try {

await driver.get('https://www.lambdatest.com');
await smartuiSnapshot(driver, 'Lambdatest');
await driver.get('https://www.pinterest.com/pin/112801165652823604/')
await smartuiSnapshot(driver, 'NYC');
} finally {
await driver.quit();
}
})();
Loading