@@ -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 , userAgent : ctx . config . userAgent } ;
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,12 @@ 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 {
35+ contextOptions . userAgent = pageOptions . userAgent ;
36+ if ( pageOptions . userAgent === null ) {
37+ contextOptions . userAgent = userAgent ;
38+ }
39+ }
3440
3541 try {
3642 const browser = browsers [ browserName ] ;
0 commit comments