@@ -29,11 +29,10 @@ test.describe('generate snapshots', () => {
2929 for ( const preview of previewsJson ) {
3030 for ( const example of preview . examples ) {
3131 if ( example . snapshot !== 'false' ) {
32- const previewPath = example . preview_path . replace ( 'OpenProject' , 'open_project' )
3332 if ( example . snapshot === 'interactive' ) {
3433 for ( const theme of themes ) {
3534 test ( `${ example . preview_path } -${ theme } ` , async ( { page} ) => {
36- await page . goto ( `/rails/view_components/${ previewPath } ?theme=${ theme } ` )
35+ await page . goto ( `/rails/view_components/${ example . preview_path } ?theme=${ theme } ` )
3736
3837 // Focus state
3938 await page . keyboard . press ( 'Tab' )
@@ -45,16 +44,16 @@ test.describe('generate snapshots', () => {
4544 await new Promise ( resolve => setTimeout ( resolve , 100 ) )
4645
4746 const focusedScreenshot = await page . screenshot ( { animations : 'disabled' } )
48- expect ( focusedScreenshot ) . toMatchSnapshot ( [ previewPath , `${ theme } .png` ] )
47+ expect ( focusedScreenshot ) . toMatchSnapshot ( [ example . preview_path , `${ theme } .png` ] )
4948 } )
5049 }
5150 }
5251
5352 test ( example . preview_path , async ( { page} ) => {
54- await page . goto ( `/rails/view_components/${ previewPath } ?theme=all` )
53+ await page . goto ( `/rails/view_components/${ example . preview_path } ?theme=all` )
5554
5655 const defaultScreenshot = await page . locator ( '#component-preview' ) . screenshot ( { animations : 'disabled' } )
57- expect ( defaultScreenshot ) . toMatchSnapshot ( [ previewPath , 'default.png' ] )
56+ expect ( defaultScreenshot ) . toMatchSnapshot ( [ example . preview_path , 'default.png' ] )
5857
5958 // Focus state
6059 await page . keyboard . press ( 'Tab' )
@@ -63,7 +62,7 @@ test.describe('generate snapshots', () => {
6362 await new Promise ( resolve => setTimeout ( resolve , 100 ) )
6463
6564 const focusedScreenshot = await page . locator ( '#component-preview' ) . screenshot ( { animations : 'disabled' } )
66- expect ( focusedScreenshot ) . toMatchSnapshot ( [ previewPath , 'focused.png' ] )
65+ expect ( focusedScreenshot ) . toMatchSnapshot ( [ example . preview_path , 'focused.png' ] )
6766 } )
6867 }
6968 }
0 commit comments