Skip to content

Commit

Permalink
fix: allow user to go to settings before a product is set up (#21146)
Browse files Browse the repository at this point in the history
* Allow user to go to settings before a product is set up

* Add a new before onboarding login flow

* Move user-enterprise json to follow other files

* Update user-enterprise.json

* Update user-before-onboarding.json

* Update before-onboarding.cy.ts

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (2)

* Update before-onboarding.cy.ts

* Update user-before-onboarding.json

* Change how the team settings are set

* Update before-onboarding.cy.ts

* Update e2e.ts

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
zlwaterfield and github-actions[bot] authored Mar 27, 2024
1 parent bcf3f67 commit 06fdcb2
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 6 deletions.
35 changes: 35 additions & 0 deletions cypress/e2e/before-onboarding.cy.ts
Original file line number Diff line number Diff line change
@@ -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')
})
})
1 change: 0 additions & 1 deletion cypress/e2e/onboarding.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { urls } from 'scenes/urls'
import { decideResponse } from '../fixtures/api/decide'

describe('Onboarding', () => {
Expand Down
13 changes: 9 additions & 4 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,15 @@ beforeEach(() => {
email: '[email protected]',
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')
})
}
}
})

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

0 comments on commit 06fdcb2

Please sign in to comment.