Skip to content

Commit 02682a6

Browse files
Merge pull request #54 from LambdaTest/revert-53-DOT-5046/cli-sync-changes
Revert "added sync param in options for cli"
2 parents 2729810 + 1c157da commit 02682a6

File tree

7 files changed

+12
-51
lines changed

7 files changed

+12
-51
lines changed

packages/sdk-utils/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
const { isSmartUIRunning, fetchDOMSerializer, postSnapshot, getSnapshotStatus } = require('./src/smartui');
1+
const { isSmartUIRunning, fetchDOMSerializer, postSnapshot } = require('./src/smartui');
22
const logger = require('./src/lib/logger');
33

44
module.exports = {
55
logger,
66
fetchDOMSerializer,
77
postSnapshot,
8-
isSmartUIRunning,
9-
getSnapshotStatus
8+
isSmartUIRunning
109
}

packages/sdk-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/sdk-utils",
3-
"version": "1.0.8",
3+
"version": "1.0.7",
44
"description": "LambdaTest driver utils",
55
"main": "index.js",
66
"repository": {

packages/sdk-utils/src/lib/httpClient.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,4 @@ module.exports = new class httpClient {
4747
}
4848
})
4949
}
50-
51-
getSnapshotStatus(contextId, snapshotName, pollTimeout) {
52-
return this.request({
53-
url: `${utils.getSmartUIServerAddress()}/snapshot/status`,
54-
method: 'GET',
55-
params: {
56-
contextId: contextId,
57-
snapshotName: snapshotName,
58-
pollTimeout: pollTimeout
59-
}
60-
});
61-
}
62-
6350
};

packages/sdk-utils/src/smartui.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,8 @@ async function postSnapshot(snapshot, testType) {
3636
}
3737
}
3838

39-
async function getSnapshotStatus(contextId,snapshotName,pollTimeout=600) {
40-
try {
41-
return await client.getSnapshotStatus(contextId,snapshotName,pollTimeout);
42-
} catch (error) {
43-
log.debug(error);
44-
throw new Error(`get snapshot status failed; ${error.message}`);
45-
}
46-
}
47-
4839
module.exports = {
4940
isSmartUIRunning,
5041
fetchDOMSerializer,
51-
postSnapshot,
52-
getSnapshotStatus
53-
}
42+
postSnapshot
43+
}

packages/selenium/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/selenium-driver",
3-
"version": "1.0.8",
3+
"version": "1.0.7",
44
"description": "Selenium driver for all Lambdatest functionalities",
55
"main": "index.js",
66
"repository": {

packages/selenium/src/smartui.js

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const utils = require('@lambdatest/sdk-utils');
22
const pkgName = require('../package.json').name;
33
const testType = 'js-selenium-driver';
4-
const crypto = require('crypto');
54

65
async function smartuiSnapshot(driver, name, options = {}) {
76
if (!driver) throw new Error('An instance of the selenium driver object is required.');
@@ -25,25 +24,11 @@ async function smartuiSnapshot(driver, name, options = {}) {
2524
dom: SmartUIDOM.serialize(options),
2625
url: document.URL
2726
}), {});
28-
29-
if(options?.sync){
30-
options.contextId = crypto.randomUUID();
31-
let { body } = await utils.postSnapshot({url, name, dom, options}, pkgName);
32-
if (body && body.data && body.data.warnings?.length !== 0) body.data.warnings.map(e => log.warn(e));
33-
log.info(`Snapshot captured: ${name}`);
34-
let timeout = options?.timeout || 600;
35-
if(timeout<30||timeout>900){
36-
log.info(`Timeout value must be between 30 and 900 seconds. Using default value of 600 seconds.`);
37-
timeout = 600;
38-
}
39-
let snapshotStatus = await utils.getSnapshotStatus(options.contextId,name,timeout);
40-
return snapshotStatus.body;
41-
}
42-
else{
43-
let { body } = await utils.postSnapshot({url, name, dom, options}, pkgName);
44-
if (body && body.data && body.data.warnings?.length !== 0) body.data.warnings.map(e => log.warn(e));
45-
log.info(`Snapshot captured: ${name}`);
46-
}
27+
28+
let { body } = await utils.postSnapshot({url, name, dom, options}, pkgName);
29+
if (body && body.data && body.data.warnings?.length !== 0) body.data.warnings.map(e => log.warn(e));
30+
31+
log.info(`Snapshot captured: ${name}`);
4732
} catch (error) {
4833
log.error(`SmartUI snapshot failed "${name}"`);
4934
log.error(error);

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)