diff --git a/cypress/e2e/before-onboarding.cy.ts b/cypress/e2e/before-onboarding.cy.ts new file mode 100644 index 0000000000000..2110950014488 --- /dev/null +++ b/cypress/e2e/before-onboarding.cy.ts @@ -0,0 +1,35 @@ +describe('Before Onboarding', () => { + before(() => { + cy.request({ + method: 'PATCH', + url: '/api/projects/1/', + body: { completed_snippet_onboarding: false }, + headers: { Authorization: 'Bearer e2e_demo_api_key' }, + }) + }) + + after(() => { + cy.request({ + method: 'PATCH', + url: '/api/projects/1/', + body: { completed_snippet_onboarding: true }, + headers: { Authorization: 'Bearer e2e_demo_api_key' }, + }) + }) + + it('Navigate to /products when a product has not been set up', () => { + cy.visit('/project/1/data-management/events') + + cy.get('[data-attr=top-bar-name] > span').contains('Products') + }) + + it('Navigate to a settings page even when a product has not been set up', () => { + cy.visit('/settings/user') + + cy.get('[data-attr=top-bar-name] > span').contains('User') + + cy.visit('/settings/organization') + + cy.get('[data-attr=top-bar-name] > span').contains('Organization') + }) +}) diff --git a/cypress/e2e/onboarding.cy.ts b/cypress/e2e/onboarding.cy.ts index 56cb23bc45b70..19b7749265c4f 100644 --- a/cypress/e2e/onboarding.cy.ts +++ b/cypress/e2e/onboarding.cy.ts @@ -1,4 +1,3 @@ -import { urls } from 'scenes/urls' import { decideResponse } from '../fixtures/api/decide' describe('Onboarding', () => { diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 87f1dfd127b1f..bfb16863482ec 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -61,10 +61,15 @@ beforeEach(() => { email: 'test@posthog.com', password: '12345678', }) - cy.visit('/insights') - cy.wait('@getInsights').then(() => { - cy.get('.saved-insights tr').should('exist') - }) + + if (Cypress.spec.name.includes('before-onboarding')) { + cy.visit('/?no-preloaded-app-context=true') + } else { + cy.visit('/insights') + cy.wait('@getInsights').then(() => { + cy.get('.saved-insights tr').should('exist') + }) + } } }) diff --git a/frontend/src/scenes/sceneLogic.ts b/frontend/src/scenes/sceneLogic.ts index 998726e131ec5..77b24b6407325 100644 --- a/frontend/src/scenes/sceneLogic.ts +++ b/frontend/src/scenes/sceneLogic.ts @@ -202,7 +202,7 @@ export const sceneLogic = kea([ !teamLogic.values.currentTeam.is_demo && !removeProjectIdIfPresent(location.pathname).startsWith(urls.onboarding('')) && !removeProjectIdIfPresent(location.pathname).startsWith(urls.products()) && - !removeProjectIdIfPresent(location.pathname).startsWith(urls.settings()) + !removeProjectIdIfPresent(location.pathname).startsWith('/settings') ) { const allProductUrls = Object.values(productUrlMapping).flat() if (