@@ -180,6 +180,82 @@ describe('Board export', function() {
180180 } )
181181} )
182182
183+ describe ( 'Board title editing' , function ( ) {
184+ before ( function ( ) {
185+ cy . createUser ( user )
186+ } )
187+
188+ it ( 'Shows updated board title immediately on the opened board' , function ( ) {
189+ const originalTitle = `Live rename ${ Date . now ( ) } `
190+ const updatedTitle = `${ originalTitle } updated`
191+
192+ cy . createExampleBoard ( { user, board : sampleBoard ( originalTitle ) } ) . then ( ( board ) => {
193+ cy . login ( user )
194+ cy . visit ( `/apps/deck/board/${ board . id } ` )
195+
196+ cy . intercept ( { method : 'PUT' , url : `**/apps/deck/boards/${ board . id } ` } ) . as ( 'updateBoard' )
197+
198+ cy . get ( `.app-navigation__list .app-navigation-entry:contains("${ originalTitle } ")` )
199+ . parent ( )
200+ . find ( 'button[aria-label="Actions"]' )
201+ . click ( )
202+
203+ cy . get ( 'button:contains("Edit board")' ) . click ( )
204+
205+ cy . get ( '.board-edit form input[type=text]' )
206+ . clear ( )
207+ . type ( updatedTitle )
208+
209+ cy . get ( '.board-edit form button[title="Save board"]' ) . click ( )
210+
211+ cy . get ( '.board-title h2' ) . contains ( updatedTitle )
212+
213+ cy . wait ( '@updateBoard' ) . its ( 'response.statusCode' ) . should ( 'equal' , 200 )
214+
215+ cy . get ( '.app-navigation__list .app-navigation-entry' )
216+ . contains ( updatedTitle )
217+ . should ( 'be.visible' )
218+ } )
219+ } )
220+
221+ it ( 'Does not change the opened board title when editing another board' , function ( ) {
222+ const boardATitle = `Active board ${ Date . now ( ) } `
223+ const boardBTitle = `Background board ${ Date . now ( ) } `
224+ const boardBUpdatedTitle = `${ boardBTitle } updated`
225+
226+ cy . createExampleBoard ( { user, board : sampleBoard ( boardATitle ) } ) . then ( ( boardA ) => {
227+ cy . createExampleBoard ( { user, board : sampleBoard ( boardBTitle ) } ) . then ( ( boardB ) => {
228+ cy . login ( user )
229+ cy . visit ( `/apps/deck/board/${ boardA . id } ` )
230+
231+ cy . intercept ( { method : 'PUT' , url : `**/apps/deck/boards/${ boardB . id } ` } ) . as ( 'updateBoardOther' )
232+
233+ cy . get ( '.board-title h2' ) . should ( 'contain' , boardATitle )
234+
235+ cy . get ( `.app-navigation__list .app-navigation-entry:contains("${ boardBTitle } ")` )
236+ . parent ( )
237+ . find ( 'button[aria-label="Actions"]' )
238+ . click ( { force : true } ) // element is only visible on hover, and cypress can't hover
239+
240+ cy . get ( 'button:contains("Edit board")' ) . click ( )
241+
242+ cy . get ( '.board-edit form input[type=text]' )
243+ . clear ( )
244+ . type ( boardBUpdatedTitle )
245+
246+ cy . get ( '.board-edit form button[title="Save board"]' ) . click ( )
247+
248+ cy . wait ( '@updateBoardOther' ) . its ( 'response.statusCode' ) . should ( 'equal' , 200 )
249+
250+ cy . get ( '.board-title h2' ) . should ( 'contain' , boardATitle )
251+ cy . get ( '.app-navigation__list .app-navigation-entry' )
252+ . contains ( boardBUpdatedTitle )
253+ . should ( 'be.visible' )
254+ } )
255+ } )
256+ } )
257+ } )
258+
183259describe ( 'Board import' , function ( ) {
184260 before ( function ( ) {
185261 cy . createUser ( user )
0 commit comments