| 
									
										
										
										
											2023-09-08 23:51:59 +08:00
										 |  |  | import { e2e } from '../utils'; | 
					
						
							| 
									
										
										
										
											2021-02-02 17:17:38 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | describe('Trace view', () => { | 
					
						
							| 
									
										
										
										
											2023-09-13 20:24:20 +08:00
										 |  |  |   beforeEach(() => { | 
					
						
							| 
									
										
										
										
											2023-09-27 18:33:00 +08:00
										 |  |  |     e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD')); | 
					
						
							| 
									
										
										
										
											2023-09-13 20:24:20 +08:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-02 17:17:38 +08:00
										 |  |  |   it('Can lazy load big traces', () => { | 
					
						
							| 
									
										
										
										
											2023-09-11 18:20:54 +08:00
										 |  |  |     cy.intercept('GET', '**/api/traces/trace', { | 
					
						
							|  |  |  |       fixture: 'long-trace-response.json', | 
					
						
							|  |  |  |     }).as('longTrace'); | 
					
						
							| 
									
										
										
										
											2021-02-02 17:17:38 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     e2e.pages.Explore.visit(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-26 23:38:48 +08:00
										 |  |  |     e2e.components.DataSourcePicker.container().should('be.visible').type('gdev-jaeger{enter}'); | 
					
						
							| 
									
										
										
										
											2023-09-11 18:20:54 +08:00
										 |  |  |     // Wait for the query editor to be set correctly
 | 
					
						
							|  |  |  |     e2e.components.QueryEditorRows.rows().within(() => { | 
					
						
							|  |  |  |       cy.contains('gdev-jaeger').should('be.visible'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // type this with 0 delay to prevent flaky tests due to cursor position changing between rerenders
 | 
					
						
							|  |  |  |     e2e.components.QueryField.container().should('be.visible').type('trace', { | 
					
						
							|  |  |  |       delay: 0, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     // Use shift+enter to execute the query as it's more stable than clicking the execute button
 | 
					
						
							|  |  |  |     e2e.components.QueryField.container().type('{shift+enter}'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     cy.wait('@longTrace'); | 
					
						
							| 
									
										
										
										
											2021-02-24 21:18:52 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-25 17:30:32 +08:00
										 |  |  |     e2e.components.TraceViewer.spanBar().should('be.visible'); | 
					
						
							| 
									
										
										
										
											2021-02-24 21:18:52 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-15 23:26:23 +08:00
										 |  |  |     e2e.components.TraceViewer.spanBar() | 
					
						
							|  |  |  |       .its('length') | 
					
						
							|  |  |  |       .then((oldLength) => { | 
					
						
							| 
									
										
										
										
											2024-11-09 00:46:07 +08:00
										 |  |  |         e2e.pages.Explore.General.scrollView().children().first().scrollTo('center'); | 
					
						
							| 
									
										
										
										
											2021-02-02 17:17:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-15 23:26:23 +08:00
										 |  |  |         // After scrolling we should load more spans
 | 
					
						
							| 
									
										
										
										
											2023-04-11 17:51:54 +08:00
										 |  |  |         e2e.components.TraceViewer.spanBar().should(($span) => { | 
					
						
							|  |  |  |           expect($span.length).to.be.gt(oldLength); | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2021-09-15 23:26:23 +08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2021-02-02 17:17:38 +08:00
										 |  |  |   }); | 
					
						
							|  |  |  | }); |