github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/cypress/integration/webapp/sidebar.ts (about) 1 describe('sidebar', () => { 2 describe('not collapsed', () => { 3 // on smaller screens component will be collapsed by default 4 beforeEach(() => { 5 cy.viewport(1440, 900); 6 }); 7 8 it('internal sidebar links work', () => { 9 cy.visit('/'); 10 11 cy.findByTestId('sidebar-continuous-comparison').click(); 12 13 const basePath = Cypress.env('basePath') || ''; 14 cy.location('pathname').should('eq', `${basePath}/comparison`); 15 16 cy.findByTestId('sidebar-continuous-diff').click(); 17 cy.location('pathname').should('eq', `${basePath}/comparison-diff`); 18 19 cy.findByTestId('sidebar-continuous-single').click(); 20 cy.location('pathname').should('eq', `${basePath}/`); 21 }); 22 }); 23 24 describe('collapse/uncollapse', () => { 25 it('defaults to collapsed in smaller screens', () => { 26 cy.viewport(1000, 900); 27 cy.visit('/'); 28 cy.get('.app').find('.pro-sidebar').should('have.class', 'collapsed'); 29 }); 30 31 it('defaults to uncollapsed in bigger screens', () => { 32 cy.viewport(1440, 900); 33 cy.visit('/'); 34 cy.get('.app').find('.pro-sidebar').should('not.have.class', 'collapsed'); 35 }); 36 37 it('collapses when screen width changes', () => { 38 cy.viewport(1440, 900); 39 cy.visit('/'); 40 41 cy.get('.app').find('.pro-sidebar').should('not.have.class', 'collapsed'); 42 43 cy.viewport(1000, 900); 44 45 cy.get('.app').find('.pro-sidebar').should('have.class', 'collapsed'); 46 }); 47 48 describe('when user interacts', () => { 49 it('persists state across reloads', () => { 50 cy.viewport(1440, 900); 51 cy.visit('/'); 52 53 cy.get('.app') 54 .find('.pro-sidebar') 55 .should('not.have.class', 'collapsed'); 56 cy.get('.app') 57 .find('.pro-sidebar') 58 .findByText('Collapse Sidebar') 59 .click(); 60 61 cy.get('.app').find('.pro-sidebar').should('have.class', 'collapsed'); 62 63 cy.reload(); 64 65 cy.get('.app').find('.pro-sidebar').should('have.class', 'collapsed'); 66 }); 67 }); 68 }); 69 });