From 0521e2e9a5a6b72d00a7606138f1436c9d1f1ac7 Mon Sep 17 00:00:00 2001 From: Bianca Yang Date: Thu, 9 Nov 2023 13:25:20 -0800 Subject: [PATCH] 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 --- cypress/e2e/billingv2.cy.ts | 7 ++++--- frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/billingv2.cy.ts b/cypress/e2e/billingv2.cy.ts index 5c25ddeee4a53..3c01f489e1f78 100644 --- a/cypress/e2e/billingv2.cy.ts +++ b/cypress/e2e/billingv2.cy.ts @@ -5,10 +5,10 @@ describe('Billing', () => { cy.visit('/organization/billing') }) - it('Show unsubscribe survey', () => { + 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( @@ -17,7 +17,8 @@ describe('Billing', () => { ) cy.contains('.LemonModal .LemonButton', 'Unsubscribe').click() - cy.get('[data-attr=upgrade-card-product_analytics]').should('be.visible') + cy.get('.LemonModal').should('not.exist') + cy.wait(['@unsubscribeProductAnalytics']) }) it('Unsubscribe survey text area maintains unique state between product types', () => { diff --git a/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx b/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx index 098a7470a9468..9a3b65fa24c03 100644 --- a/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx +++ b/frontend/src/scenes/billing/UnsubscribeSurveyModal.tsx @@ -82,7 +82,9 @@ export const UnsubscribeSurveyModal = ({ product }: { product: BillingProductV2T type={textAreaNotEmpty ? 'primary' : 'tertiary'} status={textAreaNotEmpty ? 'primary' : 'muted'} onClick={() => { - textAreaNotEmpty && reportSurveySent(surveyID, surveyResponse) + textAreaNotEmpty + ? reportSurveySent(surveyID, surveyResponse) + : reportSurveyDismissed(surveyID) deactivateProduct(product.type) }} >