Skip to content

Commit e3132d5

Browse files
authored
Merge pull request #432 from parthlambdatest/Dot-6920
[Dot-6920] Add support for do not use user agents in context
2 parents edcb086 + c8f4dc0 commit e3132d5

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/smartui-cli",
3-
"version": "4.1.42",
3+
"version": "4.1.43",
44
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
55
"files": [
66
"dist/**/*"

src/lib/env.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export default (): Env => {
2626
SHOW_RENDER_ERRORS,
2727
SMARTUI_SSE_URL='https://server-events.lambdatest.com',
2828
LT_SDK_SKIP_EXECUTION_LOGS,
29-
MAX_CONCURRENT_PROCESSING
29+
MAX_CONCURRENT_PROCESSING,
30+
DO_NOT_USE_USER_AGENT,
3031
} = process.env
3132

3233
return {
@@ -55,5 +56,6 @@ export default (): Env => {
5556
SMARTUI_SSE_URL,
5657
LT_SDK_SKIP_EXECUTION_LOGS: LT_SDK_SKIP_EXECUTION_LOGS === 'true',
5758
MAX_CONCURRENT_PROCESSING: MAX_CONCURRENT_PROCESSING ? parseInt(MAX_CONCURRENT_PROCESSING, 10) : 0,
59+
DO_NOT_USE_USER_AGENT: DO_NOT_USE_USER_AGENT === 'true',
5860
}
5961
}

src/lib/processSnapshot.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,11 @@ export default async function processSnapshot(snapshot: Snapshot, ctx: Context):
237237
}
238238
let contextOptions: Record<string, any> = {
239239
javaScriptEnabled: ctx.config.cliEnableJavaScript,
240-
userAgent: constants.CHROME_USER_AGENT,
241-
ignoreHTTPSErrors : ctx.config.ignoreHTTPSErrors
240+
ignoreHTTPSErrors: ctx.config.ignoreHTTPSErrors,
241+
};
242+
243+
if (!ctx.env.DO_NOT_USE_USER_AGENT) {
244+
contextOptions.userAgent = constants.CHROME_USER_AGENT;
242245
}
243246
if (!ctx.browser?.isConnected()) {
244247
if (ctx.env.HTTP_PROXY || ctx.env.HTTPS_PROXY) launchOptions.proxy = { server: ctx.env.HTTP_PROXY || ctx.env.HTTPS_PROXY };

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export interface Env {
137137
SMARTUI_SSE_URL: string;
138138
LT_SDK_SKIP_EXECUTION_LOGS: boolean;
139139
MAX_CONCURRENT_PROCESSING: number;
140+
DO_NOT_USE_USER_AGENT: boolean;
140141
}
141142

142143
export interface Snapshot {

0 commit comments

Comments
 (0)