mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-24 18:07:17 +01:00
6c0168350d
* Add unsubscription survey * Ask users why they're unsubscribing before they submit their unsubscription request. * update to use kea for state management, clean up some logic around finding matching surveys * resolve typo * pr feedback * CTA for contacting support in survey modal * remove getActiveMatchingSurveys call since we can directly use the surveyID. * add storybook for billing unsubscribe survey * add basic cypress tests for the unsubscribe survey * adding in product type as a response to our multi-question survey * update survey to show more information about how users might control their costs * another round of tweaks to survey * beef up tests --------- Co-authored-by: Bianca Yang <bianca@posthog.com>
45 lines
1.9 KiB
TypeScript
45 lines
1.9 KiB
TypeScript
describe('Billing', () => {
|
|
beforeEach(() => {
|
|
cy.intercept('/api/billing-v2/', { fixture: 'api/billing-v2/billing-v2.json' })
|
|
|
|
cy.visit('/organization/billing')
|
|
})
|
|
|
|
it('Show unsubscribe survey', () => {
|
|
cy.intercept('/api/billing-v2/deactivate?products=product_analytics', {
|
|
fixture: 'api/billing-v2/billing-v2-unsubscribed-product-analytics.json',
|
|
})
|
|
cy.get('[data-attr=more-button]').first().click()
|
|
cy.contains('.LemonButton', 'Unsubscribe').click()
|
|
cy.get('.LemonModal__content h3').should(
|
|
'contain',
|
|
'Why are you unsubscribing from Product analytics + data stack?'
|
|
)
|
|
cy.contains('.LemonModal .LemonButton', 'Unsubscribe').click()
|
|
|
|
cy.get('[data-attr=upgrade-card-product_analytics]').should('be.visible')
|
|
})
|
|
|
|
it('Unsubscribe survey text area maintains unique state between product types', () => {
|
|
cy.get('[data-attr=more-button]').first().click()
|
|
cy.contains('.LemonButton', 'Unsubscribe').click()
|
|
cy.get('.LemonModal__content h3').should(
|
|
'contain',
|
|
'Why are you unsubscribing from Product analytics + data stack?'
|
|
)
|
|
|
|
cy.get('[data-attr=unsubscribe-reason-survey-textarea]').type('Product analytics')
|
|
cy.contains('.LemonModal .LemonButton', 'Cancel').click()
|
|
|
|
cy.get('[data-attr=more-button]').eq(1).click()
|
|
cy.contains('.LemonButton', 'Unsubscribe').click()
|
|
cy.get('.LemonModal__content h3').should('contain', 'Why are you unsubscribing from Session replay?')
|
|
cy.get('[data-attr=unsubscribe-reason-survey-textarea]').type('Session replay')
|
|
cy.contains('.LemonModal .LemonButton', 'Cancel').click()
|
|
|
|
cy.get('[data-attr=more-button]').first().click()
|
|
cy.contains('.LemonButton', 'Unsubscribe').click()
|
|
cy.get('[data-attr=unsubscribe-reason-survey-textarea]').should('have.value', 'Product analytics')
|
|
})
|
|
})
|