From 5e9e01b604a3e4e4f1fa9d992b6ac67f48dd20ba Mon Sep 17 00:00:00 2001 From: Zach Waterfield Date: Tue, 26 Mar 2024 15:26:17 -0400 Subject: [PATCH] Add a new before onboarding login flow --- cypress/e2e/before-onboarding.cy.ts | 17 +++++++ .../api/users/user-before-onboarding.json | 46 +++++++++++++++++++ cypress/support/e2e.ts | 9 ++++ 3 files changed, 72 insertions(+) create mode 100644 cypress/e2e/before-onboarding.cy.ts create mode 100644 cypress/fixtures/api/users/user-before-onboarding.json diff --git a/cypress/e2e/before-onboarding.cy.ts b/cypress/e2e/before-onboarding.cy.ts new file mode 100644 index 0000000000000..0a21c3f258fdb --- /dev/null +++ b/cypress/e2e/before-onboarding.cy.ts @@ -0,0 +1,17 @@ +describe('Before Onboarding', () => { + it.only('Navigate back 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.only('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/fixtures/api/users/user-before-onboarding.json b/cypress/fixtures/api/users/user-before-onboarding.json new file mode 100644 index 0000000000000..f3524d43b9dfc --- /dev/null +++ b/cypress/fixtures/api/users/user-before-onboarding.json @@ -0,0 +1,46 @@ +{ + "id": "01788ed8-6d2d-0000-ccdb-d8e17589b1ea", + "distinct_id": "kOyAmTq2McfCD5XvqwjKf8m6GVecm9uN0L0ypEoRN50", + "first_name": "Jane", + "email": "test@posthog.com", + "email_opt_in": true, + "anonymize_data": false, + "toolbar_mode": "toolbar", + "has_password": true, + "is_staff": false, + "is_impersonated": false, + "team": { + "id": 1, + "uuid": "01787e47-55d7-0000-6976-b893a03aaba8", + "organization": "01787e47-5558-0000-bae1-6bc513b42abe", + "api_token": "dtrwW0uEC7LwVx64RmZmqog_XjU0nXWuEK1d1ZpjteQ", + "name": "Hogflix Demo App 2", + "completed_snippet_onboarding": false, + "ingested_event": false, + "is_demo": true, + "timezone": "UTC" + }, + "organization": { + "id": "01787e47-5558-0000-bae1-6bc513b42abe", + "name": "Hogflix Movies", + "created_at": "2021-03-29T13:58:27.416616Z", + "updated_at": "2021-03-29T13:58:57.067131Z", + "membership_level": 15, + "plugins_access_level": 9, + "teams": [ + { + "id": 1, + "uuid": "01787e47-55d7-0000-6976-b893a03aaba8", + "organization": "01787e47-5558-0000-bae1-6bc513b42abe", + "api_token": "dtrwW0uEC7LwVx64RmZmqog_XjU0nXWuEK1d1ZpjteQ", + "name": "Hogflix Demo App 2", + "completed_snippet_onboarding": false, + "ingested_event": false, + "is_demo": true, + "timezone": "UTC" + } + ], + "available_features": [] + }, + "organizations": [{ "id": "01787e47-5558-0000-bae1-6bc513b42abe", "name": "Hogflix Movies" }] +} diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 87f1dfd127b1f..3a045ceb986e0 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -53,6 +53,15 @@ beforeEach(() => { email: 'test@posthog.com', password: '12345678', }) + cy.visit('/?no-preloaded-app-context=true') + } else if (Cypress.spec.name.includes('before-onboarding')) { + cy.intercept('/api/users/@me/', { fixture: 'api/users/user-before-onboarding' }) + + cy.request('POST', '/api/login/', { + email: 'test@posthog.com', + password: '12345678', + }) + cy.visit('/?no-preloaded-app-context=true') } else { cy.intercept('GET', /\/api\/projects\/\d+\/insights\/?\?/).as('getInsights')