@@ -164,6 +164,33 @@ test.describe('Query History', () => {
164164 expect ( editorValue . trim ( ) ) . toBe ( firstQuery . trim ( ) ) ;
165165 } ) ;
166166
167+ test ( 'No unsaved changes modal when running a query that is identical to last in history' , async ( ) => {
168+ // Run first query
169+ const firstQuery = 'SELECT 10 AS first_history_query;' ;
170+ await queryEditor . run ( firstQuery , QUERY_MODES . script ) ;
171+
172+ // Set some other query
173+ const secondQuery = 'SELECT 20 AS second_history_query;' ;
174+ await queryEditor . setQuery ( secondQuery ) ;
175+
176+ // Run the first query again
177+ await queryEditor . run ( firstQuery , QUERY_MODES . script ) ;
178+
179+ // Navigate to history tab
180+ await queryEditor . queryTabs . selectTab ( QueryTabs . History ) ;
181+ await queryEditor . historyQueries . isVisible ( ) ;
182+
183+ // Select the first query from history
184+ await queryEditor . historyQueries . selectQuery ( firstQuery ) ;
185+
186+ // Verify no unsaved changes modal appeared
187+ const isModalHidden = await tenantPage . isUnsavedChangesModalHidden ( ) ;
188+ expect ( isModalHidden ) . toBe ( true ) ;
189+ // Verify query is loaded in editor
190+ const editorValue = await queryEditor . editorTextArea . inputValue ( ) ;
191+ expect ( editorValue . trim ( ) ) . toBe ( firstQuery . trim ( ) ) ;
192+ } ) ;
193+
167194 test ( 'Unsaved changes modal appears when modifying a query and selecting from history' , async ( ) => {
168195 // Run a query
169196 const originalQuery = 'SELECT 30 AS original_history_query;' ;
0 commit comments