@@ -204,9 +204,48 @@ describe('APM Services Page', () => {
204204 cy . get ( '.euiModal' ) . should ( 'not.exist' ) ;
205205 cy . get ( '[data-test-subj="globalLoadingIndicator"]' ) . should ( 'not.exist' ) ;
206206
207+ // Intercept all network requests to capture what the UI actually calls
208+ cy . intercept ( '**/api/**' ) . as ( 'apiCall' ) ;
209+ cy . intercept ( 'POST' , '**/observability/**' ) . as ( 'observabilityCall' ) ;
210+ cy . intercept ( '**/prometheus/**' ) . as ( 'prometheusCall' ) ;
211+
207212 // Set time range
208213 setAPMTimeRange ( startTime , endTime ) ;
209214
215+ // Wait for loading to complete after time range change
216+ cy . get ( '[data-test-subj="globalLoadingIndicator"]' , { timeout : 10000 } ) . should ( 'not.exist' ) ;
217+
218+ // Capture and log all API calls made by the UI
219+ cy . get ( '@apiCall.all' ) . then ( ( interceptions ) => {
220+ cy . task ( 'log' , `=== UI Made ${ interceptions . length } API Calls ===` ) ;
221+ interceptions . forEach ( ( interception , index ) => {
222+ const url = interception . request . url ;
223+ const method = interception . request . method ;
224+ const status = interception . response && interception . response . statusCode
225+ ? interception . response . statusCode
226+ : 'pending' ;
227+
228+ // Log all calls but focus on those that might be related to our widgets
229+ if ( url . includes ( 'prometheus' ) ||
230+ url . includes ( 'query' ) ||
231+ url . includes ( 'observability' ) ||
232+ url . includes ( 'ppl' ) ||
233+ url . includes ( 'dataconnections' ) ) {
234+ cy . task ( 'log' , `\n[${ index + 1 } ] ${ method } ${ url } ` ) ;
235+ cy . task ( 'log' , ` Status: ${ status } ` ) ;
236+
237+ if ( interception . request . body ) {
238+ cy . task ( 'log' , ` Request Body: ${ JSON . stringify ( interception . request . body ) . substring ( 0 , 500 ) } ` ) ;
239+ }
240+
241+ if ( interception . response && interception . response . body ) {
242+ const respBody = JSON . stringify ( interception . response . body ) ;
243+ cy . task ( 'log' , ` Response: ${ respBody . substring ( 0 , 500 ) } ` ) ;
244+ }
245+ }
246+ } ) ;
247+ } ) ;
248+
210249 // Debug: Check Prometheus metrics and actual UI queries
211250 cy . log ( '=== DEBUG: Checking Prometheus metrics and queries ===' ) ;
212251 cy . task ( 'log' , `Test time range: ${ startTime } to ${ endTime } ` ) ;
0 commit comments