@@ -73,9 +73,7 @@ test.describe('Test Query Editor', async () => {
7373 await queryEditor . setQuery ( invalidQuery ) ;
7474 await queryEditor . clickRunButton ( ) ;
7575
76- const statusElement = await queryEditor . getExecutionStatus ( ) ;
77- await expect ( statusElement ) . toBe ( 'Failed' ) ;
78-
76+ await expect ( queryEditor . waitForStatus ( 'Failed' ) ) . resolves . toBe ( true ) ;
7977 const errorMessage = await queryEditor . getErrorMessage ( ) ;
8078 await expect ( errorMessage ) . toContain ( 'Column references are not allowed without FROM' ) ;
8179 } ) ;
@@ -123,13 +121,9 @@ test.describe('Test Query Editor', async () => {
123121 await queryEditor . clickRunButton ( ) ;
124122
125123 await expect ( queryEditor . isStopButtonVisible ( ) ) . resolves . toBe ( true ) ;
126-
127124 await queryEditor . clickStopButton ( ) ;
128- await page . waitForTimeout ( 1000 ) ; // Wait for the editor to initialize
129125
130- // Check for a message or indicator that the query was stopped
131- const statusElement = await queryEditor . getExecutionStatus ( ) ;
132- await expect ( statusElement ) . toBe ( 'Stopped' ) ;
126+ await expect ( queryEditor . waitForStatus ( 'Stopped' ) ) . resolves . toBe ( true ) ;
133127 } ) ;
134128
135129 test ( 'Stop button is not visible for quick queries' , async ( { page} ) => {
@@ -239,4 +233,12 @@ test.describe('Test Query Editor', async () => {
239233 await queryEditor . clickRunButton ( ) ;
240234 await expect ( queryEditor . resultTable . getResultHeadText ( ) ) . resolves . toBe ( 'Truncated(1)' ) ;
241235 } ) ;
236+
237+ test ( 'Query execution status changes correctly' , async ( { page} ) => {
238+ const queryEditor = new QueryEditor ( page ) ;
239+ await queryEditor . setQuery ( testQuery ) ;
240+ await queryEditor . clickRunButton ( ) ;
241+
242+ await expect ( queryEditor . waitForStatus ( 'Completed' ) ) . resolves . toBe ( true ) ;
243+ } ) ;
242244} ) ;
0 commit comments