Skip to content

Commit 14575ab

Browse files
authored
Merge pull request #433 from LambdaTest/stage
Release PR for Adding support for do not use user agents in context
2 parents 234ab8c + e3132d5 commit 14575ab

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
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/commander/commander.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ program
2323
.option('--baselineBranch <string>', 'Mark this build baseline')
2424
.option('--baselineBuild <string>', 'Mark this build baseline')
2525
.option('--githubURL <string>', 'GitHub URL including commitId')
26+
.option('--userName <string>', 'Specify the LT username')
27+
.option('--accessKey <string>', 'Specify the LT accesskey')
2628
.addCommand(exec)
2729
.addCommand(capture)
2830
.addCommand(configWeb)

src/commander/exec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ command
2424
.option('--fetch-results [filename]', 'Fetch results and optionally specify an output file, e.g., <filename>.json')
2525
.option('--buildName <string>', 'Specify the build name')
2626
.option('--scheduled <string>', 'Specify the schedule ID')
27-
.option('--userName <string>', 'Specify the LT username')
28-
.option('--accessKey <string>', 'Specify the LT accesskey')
2927
.option('--show-render-errors', 'Show render errors from SmartUI build')
3028
.action(async function(execCommand, _, command) {
3129
const options = command.optsWithGlobals();

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)