@@ -14,11 +14,14 @@ async function smartuiSnapshot(page, name, options = {}) {
1414 const screenshotBuffer = await page . screenshot ( { fullPage : true } ) ;
1515 const screenshotBlob = new Blob ( [ screenshotBuffer ] , { type : 'image/png' } ) ;
1616 const form = new FormData ( ) ;
17- form . append ( 'screenshotName' , name ) ;
17+ //screenshot name is name_uuid use snapshotUuid = uuidv4()
18+ const snapshotid = Math . floor ( 100000 + Math . random ( ) * 900000 ) ;
19+ const screenshotName = `${ name } _${ snapshotid } ` ;
20+ form . append ( 'screenshotName' , screenshotName ) ;
1821 form . append ( 'uploadToS3Only' , true ) ;
1922 form . append ( 'buildId' , process . env . SMARTUI_BUILD_ID || '' ) ;
2023 form . append ( 'screenshot' , screenshotBlob , {
21- filename : `${ name . replace ( / [ ^ a - z 0 - 9 ] / gi, '_' ) } .png` ,
24+ filename : `${ screenshotName . replace ( / [ ^ a - z 0 - 9 ] / gi, '_' ) } .png` ,
2225 contentType : 'image/png' ,
2326 } ) ;
2427 const uploadUrl = 'https://api.lambdatest.com/visualui/1.0/screenshot' ;
@@ -32,10 +35,10 @@ async function smartuiSnapshot(page, name, options = {}) {
3235 body : form ,
3336 } ) ;
3437 } catch ( uploadError ) {
35-
38+ log . info ( 'Failed to upload sdk screenshot:' , uploadError ) ;
3639 }
3740 } catch ( screenshotError ) {
38-
41+ log . info ( 'Failed to capture sdk screenshot:' , screenshotError ) ;
3942 }
4043 }
4144 const resp = await utils . fetchDOMSerializer ( ) ;
0 commit comments