github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/cypress/integration/webapp/annotations.ts (about) 1 describe('Annotations', () => { 2 it('add annotation flow works as expected', () => { 3 const basePath = Cypress.env('basePath') || ''; 4 cy.intercept(`${basePath}**/labels*`).as('labels'); 5 cy.intercept(`${basePath}/api/apps`, { 6 fixture: 'appNames.json', 7 }).as('appNames'); 8 cy.intercept('**/render*', { 9 fixture: 'render.json', 10 }).as('render'); 11 12 cy.visit('/'); 13 14 cy.wait('@labels'); 15 cy.wait('@appNames'); 16 cy.wait('@render'); 17 18 cy.get('canvas.flot-overlay').click(); 19 20 cy.get('li[role=menuitem]').contains('Add annotation').click(); 21 22 const content = 'test'; 23 let time; 24 25 cy.get('form#annotation-form') 26 .findByTestId('annotation_timestamp_input') 27 .invoke('val') 28 .then((sometext) => (time = sometext)); 29 30 cy.get('form#annotation-form') 31 .findByTestId('annotation_content_input') 32 .type(content); 33 34 cy.get('button[form=annotation-form]').click(); 35 36 cy.get('div[data-testid="annotation_mark_wrapper"]').click(); 37 38 cy.get('form#annotation-form') 39 .findByTestId('annotation_content_input') 40 .should('have.value', content); 41 42 cy.get('form#annotation-form') 43 .findByTestId('annotation_timestamp_input') 44 .invoke('val') 45 .then((sometext2) => assert.isTrue(sometext2 === time)); 46 47 cy.get('button[form=annotation-form]').contains('Close').click(); 48 49 cy.get('form#annotation-form').should('not.exist'); 50 }); 51 });