github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/cypress/integration/webapp/pages.ts (about)

     1  // These tests currently only cover the existence of the main components
     2  // Such as timeline, flamegraph etc
     3  describe('pages', () => {
     4    it('loads / (single) correctly', () => {
     5      cy.intercept('**/render*', {
     6        fixture: 'simple-golang-app-cpu.json',
     7      }).as('render');
     8  
     9      cy.visit('/');
    10  
    11      cy.findByTestId('flamegraph-canvas');
    12      cy.findByTestId('timeline-single');
    13    });
    14  
    15    it.only('loads /comparison correctly', () => {
    16      cy.intercept('**/render*from=1633024298&until=1633024302*', {
    17        fixture: 'simple-golang-app-cpu.json',
    18        times: 1,
    19      }).as('render-main-timeline');
    20  
    21      cy.intercept('**/render*from=1633024300&until=1633024300*', {
    22        fixture: 'simple-golang-app-cpu.json',
    23        times: 1,
    24      }).as('render-right');
    25  
    26      cy.intercept('**/render*from=1633024290&until=1633024290*', {
    27        fixture: 'simple-golang-app-cpu2.json',
    28        times: 1,
    29      }).as('render-left');
    30  
    31      cy.visit(
    32        '/comparison?query=simple.golang.app.cpu%7B%7D&from=1633024298&until=1633024302&leftFrom=1633024290&leftUntil=1633024290&rightFrom=1633024300&rightUntil=1633024300'
    33      );
    34  
    35      cy.wait('@render-right');
    36      cy.wait('@render-left');
    37      cy.wait('@render-main-timeline');
    38  
    39      cy.findByTestId('timeline-main');
    40      cy.findByTestId('timeline-left');
    41      cy.findByTestId('timeline-right');
    42  
    43      // There should be 2 canvas there
    44      cy.findAllByTestId('flamegraph-canvas').should('have.length', 2);
    45    });
    46  
    47    it('loads /comparison-diff correctly', () => {
    48      cy.intercept('**/render*', {
    49        fixture: 'simple-golang-app-cpu-diff.json',
    50        times: 1,
    51      }).as('render');
    52  
    53      cy.visit(
    54        '/comparison-diff?query=simple.golang.app.cpu%7B%7D&from=1633024298&until=1633024302&leftFrom=1633024290&leftUntil=1633024290&rightFrom=1633024300&rightUntil=1633024300'
    55      );
    56  
    57      cy.wait('@render');
    58  
    59      // there are 3 timelines
    60      cy.findByTestId('timeline-main');
    61      cy.findByTestId('timeline-left');
    62      cy.findByTestId('timeline-right');
    63  
    64      cy.findByTestId('flamegraph-canvas');
    65    });
    66  });