@@ -435,6 +435,49 @@ export const layoutShowTests = async (url, page, timeout = 5000, testParent) =>
435435 const location2 = await page . evaluate ( ( ) => window . location ) ;
436436 strictEqual ( location2 . search , `?page=layoutShow&layoutId=${ LAYOUT_ID } &tab=test` ) ;
437437 } ) ;
438+
439+ await testParent . test (
440+ 'should update layout name in sidebar when name is changed and saved via JSON editor' ,
441+ { timeout } ,
442+ async ( ) => {
443+ const originalSidebarName = await page . evaluate ( ( ) => {
444+ const sidebarLayoutLink = document . querySelector ( 'nav a.menu-item.w-wrapped.selected span:nth-child(2)' ) ;
445+ return sidebarLayoutLink ? sidebarLayoutLink . textContent . trim ( ) : null ;
446+ } ) ;
447+
448+ const editDropdownButtonPath = '.btn-group > div > button' ;
449+ await page . locator ( editDropdownButtonPath ) . click ( ) ;
450+ await delay ( 100 ) ;
451+
452+ const editViaJSONButtonPath = '#editByJson' ;
453+ await page . locator ( editViaJSONButtonPath ) . click ( ) ;
454+ await delay ( 100 ) ;
455+
456+ const currentJSON = await page . evaluate ( ( ) => {
457+ const textareaPath = 'body > div > div > div > div > textarea' ;
458+ return document . querySelector ( textareaPath ) . value ;
459+ } ) ;
460+
461+ const layoutData = JSON . parse ( currentJSON ) ;
462+ const newLayoutName = 'Updated Layout Name Test' ;
463+ layoutData . name = newLayoutName ;
464+
465+ const textareaPath = '#layout-json-editor' ;
466+ await page . locator ( textareaPath ) . fill ( JSON . stringify ( layoutData ) ) ;
467+
468+ const updateButtonPath = '#updateLayoutButton' ;
469+ await page . locator ( updateButtonPath ) . click ( ) ;
470+ await delay ( 200 ) ;
471+
472+ const updatedSidebarName = await page . evaluate ( ( ) => {
473+ const sidebarLayoutLink = document . querySelector ( 'nav a.menu-item.w-wrapped.selected span:nth-child(2)' ) ;
474+ return sidebarLayoutLink ? sidebarLayoutLink . textContent . trim ( ) : null ;
475+ } ) ;
476+
477+ strictEqual ( updatedSidebarName , newLayoutName ) ;
478+ ok ( originalSidebarName !== updatedSidebarName , 'Sidebar name should have changed from original' ) ;
479+ } ,
480+ ) ;
438481} ;
439482
440483const checkInvalidJSON = async ( page , mockedJSON , errorMessage ) => {
0 commit comments