Skip to content

Commit d48efd7

Browse files
Merge pull request #452 from LambdaTest/stage
Stage
2 parents 5c9f998 + 065bdea commit d48efd7

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/smartui-cli",
3-
"version": "4.1.49",
3+
"version": "4.1.50",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"
@@ -34,12 +34,12 @@
3434
"@types/which": "^3.0.2",
3535
"ajv": "^8.12.0",
3636
"ajv-errors": "^3.0.0",
37-
"axios": "^1.6.0",
37+
"axios": "^1.12.0",
3838
"chalk": "^4.1.2",
3939
"commander": "^11.1.0",
40-
"cross-spawn": "^7.0.3",
41-
"fastify": "^4.24.3",
42-
"form-data": "^4.0.0",
40+
"cross-spawn": "^7.0.6",
41+
"fastify": "^4.29.1",
42+
"form-data": "^4.0.4",
4343
"json-stringify-safe": "^5.0.1",
4444
"listr2": "^7.0.1",
4545
"node-cache": "^5.1.2",

src/lib/screenshot.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,23 @@ async function captureScreenshotsForConfig(
112112
ctx.log.debug(`Failed resolving tunnel/proxy details: ${e}`);
113113
}
114114
let page: Page;
115-
if (browserName == constants.CHROME) contextOptions.userAgent = constants.CHROME_USER_AGENT;
116-
else if (browserName == constants.FIREFOX) contextOptions.userAgent = constants.FIREFOX_USER_AGENT;
117-
else if (browserName == constants.SAFARI) contextOptions.userAgent = constants.SAFARI_USER_AGENT;
118-
else if (browserName == constants.EDGE) contextOptions.userAgent = constants.EDGE_USER_AGENT;
119-
if (ctx.config.userAgent || userAgent) {
115+
if (!ctx.env.DO_NOT_USE_USER_AGENT) {
116+
if (browserName == constants.CHROME)
117+
contextOptions.userAgent = constants.CHROME_USER_AGENT;
118+
else if (browserName == constants.FIREFOX)
119+
contextOptions.userAgent = constants.FIREFOX_USER_AGENT;
120+
else if (browserName == constants.SAFARI)
121+
contextOptions.userAgent = constants.SAFARI_USER_AGENT;
122+
else if (browserName == constants.EDGE)
123+
contextOptions.userAgent = constants.EDGE_USER_AGENT;
124+
if (ctx.config.userAgent || userAgent) {
120125
if (ctx.config.userAgent !== "") {
121-
contextOptions.userAgent = ctx.config.userAgent;
126+
contextOptions.userAgent = ctx.config.userAgent;
122127
}
123128
if (userAgent && userAgent !== "") {
124-
contextOptions.userAgent = userAgent;
129+
contextOptions.userAgent = userAgent;
125130
}
131+
}
126132
}
127133

128134
try {

src/lib/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ export async function launchBrowsers(ctx: Context): Promise<Record<string, Brows
6262
let browsers: Record<string, Browser> = {};
6363
const isHeadless = process.env.HEADLESS?.toLowerCase() === 'false' ? false : true;
6464
let launchOptions: Record<string, any> = { headless: isHeadless };
65+
66+
const proxyServer = ctx.env.SMARTUI_HTTPS_PROXY || ctx.env.SMARTUI_HTTP_PROXY || ctx.env.HTTPS_PROXY || ctx.env.HTTP_PROXY;
67+
if (proxyServer) {
68+
launchOptions.proxy = { server: proxyServer };
69+
}
6570

6671
if (ctx.config.web) {
6772
for (const browser of ctx.config.web.browsers) {

0 commit comments

Comments
 (0)