import { synthtrace } from '../../../synthtrace' ; import { opbeans } from '../../fixtures/synthtrace/opbeans' ; const start = '2021-10-10T00:00:00.000Z' ; const end = '2021-10-10T00:15:00.000Z' ; const timeRange = { rangeFrom : start , rangeTo : end , } ; describe ( 'Dependencies' , ( ) => { before ( async ( ) => { await synthtrace . index ( opbeans ( { from : new Date ( start ) . getTime ( ) , to : new Date ( end ) . getTime ( ) , } ) ) ; } ) ; after ( async ( ) => { await synthtrace . clean ( ) ; } ) ; beforeEach ( ( ) => { cy . loginAsReadOnlyUser ( ) ; } ) ; describe ( 'top-level dependencies page' , ( ) => { it ( 'has a list of dependencies and you can navigate to the page for one' , ( ) => { cy . visit ( `/app/apm/services?${ new URLSearchParams ( timeRange ) }` ) ; cy . contains ( 'nav a' , 'Dependencies' ) . click ( ) ; cy . contains ( 'postgresql' ) . click ( { force : true } ) ; cy . contains ( 'h1' , 'postgresql' ) ; } ) ; } ) ; describe ( 'dependency overview page' , ( ) => { it ( 'shows dependency information and you can navigate to a page for an upstream service' , ( ) => { cy . visit ( `/app/apm/backends/overview?${ new URLSearchParams ( { ... timeRange , backendName : 'postgresql' , } ) }` ) ; cy . get ( '[data-test-subj="latencyChart"]' ) ; cy . get ( '[data-test-subj="throughputChart"]' ) ; cy . get ( '[data-test-subj="errorRateChart"]' ) ; cy . contains ( 'opbeans-java' ) . click ( { force : true } ) ; cy . contains ( 'h1' , 'opbeans-java' ) ; } ) ; } ) ; describe ( 'service overview page' , ( ) => { it ( 'shows dependency information and you can navigate to a page for a dependency' , ( ) => { cy . visit ( `/app/apm/services/opbeans-java/overview?${ new URLSearchParams ( timeRange ) }` ) ; cy . contains ( 'a' , 'postgresql' ) . click ( { force : true } ) ; cy . contains ( 'h1' , 'postgresql' ) ; } ) ; } ) ; describe ( 'service dependencies tab' , ( ) => { it ( 'shows dependency information and you can navigate to a page for a dependency' , ( ) => { cy . visit ( `/app/apm/services/opbeans-java/overview?${ new URLSearchParams ( timeRange ) }` ) ; cy . contains ( 'a[role="tab"]' , 'Dependencies' ) . click ( ) ; cy . contains ( 'Time spent by dependency' ) ; cy . contains ( 'a' , 'postgresql' ) . click ( { force : true } ) ; cy . contains ( 'h1' , 'postgresql' ) ; } ) ; } ) ; } ) ;