0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 09:16:49 +01:00
posthog/cypress/e2e/billingv2.cy.ts
Bianca Yang 0521e2e9a5
fix: survey doesn't get dismissed when response textarea is empty (#18471)
* fix: survey doesn't get dismissed when response textarea is empty

* address pr feedback

* fix logic nit

* fix up the logic...

---------

Co-authored-by: Bianca Yang <bianca@posthog.com>
2023-11-09 13:25:20 -08:00

46 lines
2.0 KiB
TypeScript

describe('Billing', () => {
beforeEach(() => {
cy.intercept('/api/billing-v2/', { fixture: 'api/billing-v2/billing-v2.json' })
cy.visit('/organization/billing')
})
it('Show and submit unsubscribe survey', () => {
cy.intercept('/api/billing-v2/deactivate?products=product_analytics', {
fixture: 'api/billing-v2/billing-v2-unsubscribed-product-analytics.json',
}).as('unsubscribeProductAnalytics')
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('.LemonModal').should('not.exist')
cy.wait(['@unsubscribeProductAnalytics'])
})
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')
})
})