@@ -84,11 +84,11 @@ module.exports = (env, { port = 8080, urls = {} } = {}) => {
8484 await page . waitForTimeout ( 500 ) ;
8585 }
8686
87- const customConfig = { threshold : 0.03 } ;
87+ const customConfig = { threshold : 0.012 } ;
8888
89- function compareSnapshot ( image , name ) {
89+ function compareSnapshot ( image , name , overrideConfig = { } ) {
9090 expect ( image ) . toMatchImageSnapshot ( {
91- customDiffConfig : customConfig ,
91+ customDiffConfig : { ... customConfig , ... overrideConfig } ,
9292 customSnapshotIdentifier : `${ layout } -${ theme } -${ viewportName } -${ name } -snap` ,
9393 customDiffDir : diffSnapshotsDir ,
9494 storeReceivedOnFailure : true ,
@@ -187,7 +187,7 @@ module.exports = (env, { port = 8080, urls = {} } = {}) => {
187187
188188 const image = await takeScreenshot ( ) ;
189189
190- compareSnapshot ( image , 'profile' ) ;
190+ compareSnapshot ( image , 'profile' , { threshold : 0.03 } ) ;
191191
192192 // TODO: fix false positive screenshot failure and uncomment
193193 // await switchTheme();
@@ -226,7 +226,7 @@ module.exports = (env, { port = 8080, urls = {} } = {}) => {
226226 await page . waitForTimeout ( 3000 ) ;
227227 const image = await takeScreenshot ( ) ;
228228
229- compareSnapshot ( image , 'toggle' ) ;
229+ compareSnapshot ( image , 'toggle' , { threshold : 0.03 } ) ;
230230 } ) ;
231231
232232 it ( 'User panel' , async ( ) => {
@@ -244,7 +244,7 @@ module.exports = (env, { port = 8080, urls = {} } = {}) => {
244244 }
245245 } ) ;
246246
247- compareSnapshot ( image , 'user-panel' ) ;
247+ compareSnapshot ( image , 'user-panel' , { threshold : 0.03 } ) ;
248248 } ) ;
249249
250250 it ( 'Login page' , async ( ) => {
0 commit comments