@@ -16,12 +16,12 @@ async function captureScreenshotsForConfig(
1616) : Promise < void > {
1717 ctx . log . debug ( `*** urlConfig ${ JSON . stringify ( urlConfig ) } ` ) ;
1818
19- let { name, url, waitForTimeout, execute, pageEvent} = urlConfig ;
19+ let { name, url, waitForTimeout, execute, pageEvent, userAgent } = urlConfig ;
2020 let afterNavigationScript = execute ?. afterNavigation ;
2121 let beforeSnapshotScript = execute ?. beforeSnapshot ;
2222 let waitUntilEvent = pageEvent || process . env . SMARTUI_PAGE_WAIT_UNTIL_EVENT || 'load' ;
2323
24- let pageOptions = { waitUntil : waitUntilEvent , timeout : ctx . config . waitForPageRender || constants . DEFAULT_PAGE_LOAD_TIMEOUT } ;
24+ let pageOptions = { waitUntil : waitUntilEvent , timeout : ctx . config . waitForPageRender || constants . DEFAULT_PAGE_LOAD_TIMEOUT } ;
2525 ctx . log . debug ( `url: ${ url } pageOptions: ${ JSON . stringify ( pageOptions ) } ` ) ;
2626 let ssId = name . toLowerCase ( ) . replace ( / \s / g, '_' ) ;
2727 let context : BrowserContext ;
@@ -31,6 +31,14 @@ 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+ if ( ctx . config . userAgent || userAgent ) {
35+ if ( ctx . config . userAgent !== "" ) {
36+ contextOptions . userAgent = ctx . config . userAgent ;
37+ }
38+ if ( urlConfig . userAgent !== "" && urlConfig . userAgent !== undefined ) {
39+ contextOptions . userAgent = userAgent ;
40+ }
41+ }
3442
3543 try {
3644 const browser = browsers [ browserName ] ;
0 commit comments