File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,8 @@ export default {
3131 {
3232 "name" : "lambdatest-home-page" ,
3333 "url" : "https://www.lambdatest.com" ,
34- "waitForTimeout" : 1000
34+ "waitForTimeout" : 1000 ,
35+ "userAgent" : ""
3536 } ,
3637 {
3738 "name" : "example-page" ,
Original file line number Diff line number Diff line change @@ -230,6 +230,10 @@ const WebStaticConfigSchema: JSONSchemaType<WebStaticConfig> = {
230230 maximum : 30000 ,
231231 errorMessage : "waitForTimeout must be > 0 and <= 30000"
232232 } ,
233+ userAgent : {
234+ type : "string" ,
235+ errorMessage : "User Agent value must be a valid string"
236+ } ,
233237 execute : {
234238 type : "object" ,
235239 properties : {
Original file line number Diff line number Diff line change @@ -31,10 +31,11 @@ async function captureScreenshotsForConfig(
3131 else if ( browserName == constants . FIREFOX ) contextOptions . userAgent = constants . FIREFOX_USER_AGENT ;
3232 else if ( browserName == constants . SAFARI ) contextOptions . userAgent = constants . SAFARI_USER_AGENT ;
3333 else if ( browserName == constants . EDGE ) contextOptions . userAgent = constants . EDGE_USER_AGENT ;
34- else if ( ctx . config . userAgent || urlConfig . userAgent ) {
35- contextOptions . userAgent = ctx . config . userAgent ;
36- if ( urlConfig . userAgent !== null ) {
37- contextOptions . userAgent = urlConfig . userAgent ;
34+ if ( ctx . config . userAgent || urlConfig . userAgent ) {
35+ if ( ctx . config . userAgent !== "" ) {
36+ contextOptions . userAgent = ctx . config . userAgent ; }
37+ if ( urlConfig . userAgent !== "" ) {
38+ contextOptions . userAgent = userAgent ;
3839 }
3940 }
4041
Original file line number Diff line number Diff line change @@ -175,7 +175,8 @@ export interface MobileConfig {
175175export type WebStaticConfig = Array < {
176176 name : string ;
177177 url : string ;
178- waitForTimeout ?: number
178+ waitForTimeout ?: number ;
179+ userAgent ?: string ;
179180} > ;
180181
181182export type FigmaConfigItem = {
You can’t perform that action at this time.
0 commit comments