@@ -1206,16 +1206,34 @@ describe("ai assistant", () => {
12061206
12071207 it ( "should move glyph icons when query position changes" , ( ) => {
12081208 // Given - Type a query starting at line 1
1209- cy . typeQuery ( "SELECT 1 ;" )
1209+ cy . typeQuery ( "DECLARE @myVar := 'shift-this' select @myVar ;" )
12101210
12111211 // Then - AI icon should be on line 1
1212- cy . getAIIconInLine ( 1 , "noChat" ) . should ( "be.visible" )
1212+ cy . getAIIconInLine ( 1 , "noChat" ) . should ( "be.visible" ) . click ( )
1213+
1214+ cy . getByDataHook ( "ai-chat-window" ) . should ( "be.visible" )
1215+ cy . getByDataHook ( "chat-input-textarea" ) . should ( "be.visible" )
1216+ cy . getByDataHook ( "chat-context-badge" ) . should ( "be.visible" )
1217+
1218+ interceptAIChatRequest ( "openai" )
1219+ cy . getByDataHook ( "chat-input-textarea" ) . type ( "Explain this query" , {
1220+ force : true ,
1221+ } )
1222+ cy . getByDataHook ( "chat-send-button" ) . click ( )
1223+ cy . getAIIconInLine ( 1 , "highlight" ) . should ( "be.visible" )
1224+
1225+ cy . wait ( "@openaiChatRequest" )
1226+ cy . getByDataHook ( "chat-message-assistant" ) . should ( "be.visible" )
1227+ cy . getAIIconInLine ( 1 , "active" ) . should ( "be.visible" )
1228+
1229+ cy . getByDataHook ( "chat-window-close" ) . click ( )
1230+ cy . getByDataHook ( "ai-chat-window" ) . should ( "not.exist" )
12131231
12141232 // When - Add empty lines before the query (press Home, then Enter twice)
1215- cy . get ( ".monaco-editor textarea" ) . type ( "{home}{enter}{enter}" )
1233+ cy . typeQuery ( "{home}{enter}{enter}" )
12161234
12171235 // Then - AI icon should move to line 3
1218- cy . getAIIconInLine ( 3 , "noChat " ) . should ( "be.visible" )
1236+ cy . getAIIconInLine ( 3 , "active " ) . should ( "be.visible" )
12191237
12201238 // And - Line 1 should not have an AI icon
12211239 cy . get ( ".glyph-widget-1 .glyph-ai-icon" ) . should ( "not.exist" )
0 commit comments