github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/cypress/integration/auth/oauth.ts (about) 1 describe('oauth with mock enabled', () => { 2 beforeEach(() => { 3 cy.clearCookies(); 4 }); 5 it('should correctly display buttons on login page', () => { 6 cy.visit('/login'); 7 8 cy.get('#gitlab-link').should('be.visible'); 9 cy.get('#google-link').should('not.exist'); 10 cy.get('#github-link').should('not.exist'); 11 12 cy.get('#gitlab-link').click(); 13 14 // When accessing /login directly we should be redirected to the root 15 cy.location().should((loc) => { 16 const removeTrailingSlash = (url: string) => url.replace(/\/+$/, ''); 17 18 const basePath = new URL(Cypress.config().baseUrl).pathname; 19 20 expect(removeTrailingSlash(loc.pathname)).to.eq( 21 removeTrailingSlash(basePath) 22 ); 23 }); 24 25 cy.intercept('/api/user'); 26 27 cy.findByTestId('sidebar-settings').click(); 28 29 cy.findByText('Change Password').should('not.exist'); 30 31 cy.get('li.pro-menu-item').contains('Sign out').click({ force: true }); 32 cy.url().should('contain', '/login'); 33 }); 34 });