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

     1  // few tests just to quickly validate the endpoints are working
     2  describe('API tests', () => {
     3    it('tests /render endpoint', () => {
     4      cy.request(
     5        'GET',
     6        '/render?from=now-5m&until=now&query=pyroscope.server.alloc_objects%7B%7D&format=json'
     7      )
     8        .its('headers')
     9        .its('content-type')
    10        .should('include', 'application/json');
    11    });
    12  
    13    it('tests /labels endpoint', () => {
    14      // TODO
    15      // this is not returning json
    16      cy.request('GET', '/labels?query=pyroscope.server.alloc_objects');
    17      //      .its('headers')
    18      //      .its('content-type')
    19      //      .should('include', 'application/json');
    20    });
    21  
    22    it('tests /render-diff endpoint', () => {
    23      cy.request(
    24        'GET',
    25        'http://localhost:4040/comparison-diff?query=pyroscope.server.cpu%7B%7D&rightQuery=pyroscope.server.cpu%7B%7D&leftQuery=pyroscope.server.cpu%7B%7D&leftFrom=1648154123&leftUntil=1648154128&rightFrom=1648154123&rightUntil=1648154129&from=1648154091&until=1648154131'
    26      );
    27    });
    28  
    29    it('tests 404 custom page', () => {
    30      cy.request({ url: '/my-404-page', failOnStatusCode: false })
    31        .its('status')
    32        .should('equal', 404);
    33  
    34      cy.visit({ url: '/my-404-page', failOnStatusCode: false });
    35      cy.get('.pyroscope-app').should('contain.text', 'does not exist');
    36    });
    37  });