@@ -11,6 +11,7 @@ import {
1111 longRunningStreamQuery ,
1212 longTableSelect ,
1313 longerRunningStreamQuery ,
14+ simpleQuery ,
1415} from '../constants' ;
1516
1617import {
@@ -407,4 +408,42 @@ test.describe('Test Query Editor', async () => {
407408 // Verify clipboard contains the query result
408409 expect ( clipboardContent ) . toContain ( '42' ) ;
409410 } ) ;
411+
412+ test . describe ( 'Statistics Modes Tests' , async ( ) => {
413+ test ( 'Stats tab shows no stats message when STATISTICS_MODES.none' , async ( { page} ) => {
414+ const queryEditor = new QueryEditor ( page ) ;
415+
416+ // Set query and configure statistics mode to none
417+ await queryEditor . setQuery ( simpleQuery ) ;
418+ await queryEditor . clickGearButton ( ) ;
419+ await queryEditor . settingsDialog . changeStatsLevel ( STATISTICS_MODES . none ) ;
420+ await queryEditor . settingsDialog . clickButton ( ButtonNames . Save ) ;
421+
422+ // Execute query
423+ await queryEditor . clickRunButton ( ) ;
424+ await expect ( queryEditor . waitForStatus ( 'Completed' ) ) . resolves . toBe ( true ) ;
425+
426+ // Check Stats tab content
427+ const statsContent = await queryEditor . getStatsTabContent ( ) ;
428+ expect ( statsContent ) . toContain ( 'There is no Stats for the request' ) ;
429+ } ) ;
430+
431+ test ( 'Stats tab shows JSON viewer when STATISTICS_MODES.basic' , async ( { page} ) => {
432+ const queryEditor = new QueryEditor ( page ) ;
433+
434+ // Set query and configure statistics mode to basic
435+ await queryEditor . setQuery ( simpleQuery ) ;
436+ await queryEditor . clickGearButton ( ) ;
437+ await queryEditor . settingsDialog . changeStatsLevel ( STATISTICS_MODES . basic ) ;
438+ await queryEditor . settingsDialog . clickButton ( ButtonNames . Save ) ;
439+
440+ // Execute query
441+ await queryEditor . clickRunButton ( ) ;
442+ await expect ( queryEditor . waitForStatus ( 'Completed' ) ) . resolves . toBe ( true ) ;
443+
444+ // Check that Stats tab contains JSON viewer
445+ const hasJsonViewer = await queryEditor . hasStatsJsonViewer ( ) ;
446+ expect ( hasJsonViewer ) . toBe ( true ) ;
447+ } ) ;
448+ } ) ;
410449} ) ;
0 commit comments