@@ -110,14 +110,16 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
110110 description : 'https://outsystemsrd.atlassian.net/browse/FW-6830' ,
111111 } ) ;
112112
113+ // Set up event spy BEFORE opening modal
114+ const ionModalDidPresent = await page . spyOnEvent ( 'ionModalDidPresent' ) ;
115+
113116 // Open the modal
114117 await page . evaluate ( ( ) => {
115118 const modal = document . getElementById ( 'test-modal' ) as HTMLIonModalElement ;
116119 modal . isOpen = true ;
117120 } ) ;
118121
119122 // Wait for modal to be presented
120- const ionModalDidPresent = await page . spyOnEvent ( 'ionModalDidPresent' ) ;
121123 await ionModalDidPresent . next ( ) ;
122124
123125 const modalContent = page . locator ( '#content-in-modal' ) ;
@@ -137,11 +139,10 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
137139 // Initially should have safe-area-top (no header)
138140 await expect ( content ) . toHaveClass ( / s a f e - a r e a - t o p / ) ;
139141
140- // Add header dynamically
141- await page . click ( '#add-header-btn' ) ;
142+ // Add header dynamically (use evaluate to avoid pointer-events issues in Firefox)
143+ await page . evaluate ( ( ) => ( window as any ) . addHeader ( ) ) ;
142144
143145 // Wait for mutation observer to trigger and component to update
144- // Using expect with timeout instead of waitForTimeout for reliability
145146 await expect ( content ) . not . toHaveClass ( / s a f e - a r e a - t o p / , { timeout : 1000 } ) ;
146147 } ) ;
147148
@@ -153,12 +154,12 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
153154
154155 const content = page . locator ( '#content-dynamic' ) ;
155156
156- // Add header first
157- await page . click ( '#add-header-btn' ) ;
157+ // Add header first (use evaluate to avoid pointer-events issues in Firefox)
158+ await page . evaluate ( ( ) => ( window as any ) . addHeader ( ) ) ;
158159 await expect ( content ) . not . toHaveClass ( / s a f e - a r e a - t o p / , { timeout : 1000 } ) ;
159160
160161 // Remove header
161- await page . click ( '#remove-header-btn' ) ;
162+ await page . evaluate ( ( ) => ( window as any ) . removeHeader ( ) ) ;
162163
163164 // Should have safe-area-top again
164165 await expect ( content ) . toHaveClass ( / s a f e - a r e a - t o p / , { timeout : 1000 } ) ;
0 commit comments