@@ -66,8 +66,13 @@ export class NotebookActionBarUtil {
6666
6767 const initialCodeVisibility = await this . actionBarPage . isCodeVisible ( ) ;
6868 await this . actionBarPage . toggleCodeVisibility ( ) ;
69- const newCodeVisibility = await this . actionBarPage . isCodeVisible ( ) ;
7069
70+ // Wait for the icon to change by checking for the expected icon
71+ const expectedIcon = initialCodeVisibility ? 'fullscreen' : 'fullscreen-exit' ;
72+ const icon = this . actionBarPage . showHideCodeButton . locator ( 'i[nz-icon] svg' ) ;
73+ await expect ( icon ) . toHaveAttribute ( 'data-icon' , expectedIcon , { timeout : 5000 } ) ;
74+
75+ const newCodeVisibility = await this . actionBarPage . isCodeVisible ( ) ;
7176 expect ( newCodeVisibility ) . toBe ( ! initialCodeVisibility ) ;
7277
7378 // Verify the button is still functional after click
@@ -80,8 +85,13 @@ export class NotebookActionBarUtil {
8085
8186 const initialOutputVisibility = await this . actionBarPage . isOutputVisible ( ) ;
8287 await this . actionBarPage . toggleOutputVisibility ( ) ;
83- const newOutputVisibility = await this . actionBarPage . isOutputVisible ( ) ;
8488
89+ // Wait for the icon to change by checking for the expected icon
90+ const expectedIcon = initialOutputVisibility ? 'book' : 'read' ;
91+ const icon = this . actionBarPage . showHideOutputButton . locator ( 'i[nz-icon] svg' ) ;
92+ await expect ( icon ) . toHaveAttribute ( 'data-icon' , expectedIcon , { timeout : 5000 } ) ;
93+
94+ const newOutputVisibility = await this . actionBarPage . isOutputVisible ( ) ;
8595 expect ( newOutputVisibility ) . toBe ( ! initialOutputVisibility ) ;
8696
8797 // Verify the button is still functional after click
0 commit comments