Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow user to go to settings before a product is set up #21146

Merged
merged 16 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cypress/e2e/before-onboarding.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
describe('Before Onboarding', () => {
it.only('Navigate to /products when a product has not been set up', () => {
zlwaterfield marked this conversation as resolved.
Show resolved Hide resolved
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', () => {
zlwaterfield marked this conversation as resolved.
Show resolved Hide resolved
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')
})
})
46 changes: 46 additions & 0 deletions cypress/fixtures/api/users/user-before-onboarding.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"id": "01788ed8-6d2d-0000-ccdb-d8e17589b1ea",
"distinct_id": "kOyAmTq2McfCD5XvqwjKf8m6GVecm9uN0L0ypEoRN50",
"first_name": "Jane",
"email": "[email protected]",
"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",
"completed_snippet_onboarding": false,
"ingested_event": false,
"is_demo": true,
zlwaterfield marked this conversation as resolved.
Show resolved Hide resolved
"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",
"completed_snippet_onboarding": false,
"ingested_event": false,
"is_demo": true,
"timezone": "UTC"
}
],
"available_features": []
},
"organizations": [{ "id": "01787e47-5558-0000-bae1-6bc513b42abe", "name": "Hogflix Movies" }]
}
11 changes: 10 additions & 1 deletion cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,21 @@ beforeEach(() => {
)

if (Cypress.spec.name.includes('Premium')) {
cy.intercept('/api/users/@me/', { fixture: 'api/user-enterprise' })
cy.intercept('/api/users/@me/', { fixture: 'api/users/user-enterprise' })
zlwaterfield marked this conversation as resolved.
Show resolved Hide resolved

cy.request('POST', '/api/login/', {
email: '[email protected]',
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: '[email protected]',
password: '12345678',
})

cy.visit('/?no-preloaded-app-context=true')
} else {
cy.intercept('GET', /\/api\/projects\/\d+\/insights\/?\?/).as('getInsights')
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/sceneLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export const sceneLogic = kea<sceneLogicType>([
!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 (
Expand Down
Loading