@@ -81,34 +81,38 @@ describe('Chat', () => {
8181 // Click save to knowledge base button
8282 cy . get ( '.border-t > .flex > .bg-blue-500' ) . click ( )
8383
84- // Wait for save action to complete
85- cy . wait ( 1000 )
84+ // Wait longer for save action to complete (includes backend processing)
85+ cy . wait ( 3000 )
8686 } )
8787
8888 it ( 'should navigate to knowledge base and test saved chat' , ( ) => {
8989 // Click on Knowledge Base navigation
9090 cy . get ( '.from-emerald-500' ) . click ( )
9191 cy . url ( ) . should ( 'include' , '/knowledge' )
9292
93- // Wait for knowledge base to load
94- cy . wait ( 2000 )
93+ // Wait for knowledge base to load and backend processing to complete
94+ cy . wait ( 5000 )
9595
96- // Verify the saved chat appears in knowledge base (with retry for CI)
96+ // Verify the saved chat appears in knowledge base (with extended retry for CI)
9797 // Note: openbrain backend does additional embedding resizing which can take longer in CI
98- cy . get ( '.rounded-xl > .w-80 > .overflow-y-auto > :nth-child(1)' , { timeout : 20000 } ) . should ( 'exist' )
98+ cy . get ( '.rounded-xl > .w-80 > .overflow-y-auto' , { timeout : 30000 } ) . should ( 'exist' )
99+
100+ // Wait for at least one document to appear with polling
101+ cy . get ( '.overflow-y-auto > :nth-child(1)' , { timeout : 30000 } ) . should ( 'exist' )
99102
100103 // Verify the chat title "Chat: New Chat" appears in the knowledge base
101- cy . get ( '.overflow-y-auto > :nth-child(1) > .items-start > .flex-1 > .font-medium' , { timeout : 20000 } )
104+ cy . get ( '.overflow-y-auto > :nth-child(1) > .items-start > .flex-1 > .font-medium' , { timeout : 30000 } )
105+ . should ( 'exist' )
102106 . should ( 'contain' , 'Chat: New Chat' )
103107
104108 // Click on the knowledge base item
105109 cy . get ( '.overflow-y-auto > :nth-child(1) > .items-start' ) . click ( )
106110
107111 // Wait for the item to load
108- cy . wait ( 1000 )
112+ cy . wait ( 2000 )
109113
110114 // Verify the chat content appears correctly
111- cy . get ( '.markdown-content > :nth-child(1)' ) . should ( 'contain' , 'Hi' )
115+ cy . get ( '.markdown-content > :nth-child(1)' , { timeout : 10000 } ) . should ( 'contain' , 'Hi' )
112116 cy . get ( '.markdown-content > :nth-child(2)' ) . should ( 'exist' ) . and ( 'not.be.empty' )
113117 } )
114118
@@ -161,11 +165,13 @@ describe('Chat', () => {
161165 // Navigate back to knowledge base
162166 cy . get ( '.from-emerald-500' ) . click ( )
163167 cy . url ( ) . should ( 'include' , '/knowledge' )
164- cy . wait ( 2000 )
168+ cy . wait ( 3000 )
165169
166- // Click on the saved chat again (with timeout for CI)
167- cy . get ( '.overflow-y-auto > :nth-child(1) > .items-start' , { timeout : 20000 } ) . click ( )
168- cy . wait ( 1000 )
170+ // Wait for documents to load and click on the saved chat again (with extended timeout for CI)
171+ cy . get ( '.overflow-y-auto' , { timeout : 30000 } ) . should ( 'exist' )
172+ cy . get ( '.overflow-y-auto > :nth-child(1)' , { timeout : 30000 } ) . should ( 'exist' )
173+ cy . get ( '.overflow-y-auto > :nth-child(1) > .items-start' , { timeout : 30000 } ) . should ( 'exist' ) . click ( )
174+ cy . wait ( 2000 )
169175
170176 // Click on the inline-flex button to add tag
171177 cy . get ( '.inline-flex' ) . click ( { multiple : true } )
@@ -185,11 +191,13 @@ describe('Chat', () => {
185191 // Navigate to knowledge base
186192 cy . get ( '.from-emerald-500' ) . click ( )
187193 cy . url ( ) . should ( 'include' , '/knowledge' )
188- cy . wait ( 2000 )
194+ cy . wait ( 3000 )
189195
190- // Click on the saved chat to open it (with timeout for CI)
191- cy . get ( '.overflow-y-auto > :nth-child(1) > .items-start' , { timeout : 20000 } ) . click ( )
192- cy . wait ( 1000 )
196+ // Wait for documents to load and click on the saved chat to open it (with extended timeout for CI)
197+ cy . get ( '.overflow-y-auto' , { timeout : 30000 } ) . should ( 'exist' )
198+ cy . get ( '.overflow-y-auto > :nth-child(1)' , { timeout : 30000 } ) . should ( 'exist' )
199+ cy . get ( '.overflow-y-auto > :nth-child(1) > .items-start' , { timeout : 30000 } ) . should ( 'exist' ) . click ( )
200+ cy . wait ( 2000 )
193201
194202 // Click the edit button
195203 cy . contains ( 'button' , 'Edit' ) . click ( )
@@ -216,12 +224,13 @@ describe('Chat', () => {
216224 // First: Delete the saved chat from knowledge base
217225 cy . get ( '.from-emerald-500' ) . click ( )
218226 cy . url ( ) . should ( 'include' , '/knowledge' )
219- cy . wait ( 2000 )
227+ cy . wait ( 3000 )
220228
221- // Find and delete the saved chat
222- cy . get ( '.overflow-y-auto > :nth-child(1)' ) . should ( 'exist' )
229+ // Wait for documents to load and find and delete the saved chat
230+ cy . get ( '.overflow-y-auto' , { timeout : 30000 } ) . should ( 'exist' )
231+ cy . get ( '.overflow-y-auto > :nth-child(1)' , { timeout : 30000 } ) . should ( 'exist' )
223232 cy . get ( '.overflow-y-auto > :nth-child(1)' ) . find ( 'button[title*="Delete"], button:contains("Delete"), .delete' ) . first ( ) . click ( )
224- cy . wait ( 1000 )
233+ cy . wait ( 2000 )
225234
226235 // Second: Delete the created tag
227236 cy . get ( '.from-orange-500' ) . click ( )
0 commit comments