0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-25 11:17:50 +01:00
posthog/cypress/e2e/billing.cy.ts

54 lines
2.6 KiB
TypeScript
Raw Normal View History

const UNSUBSCRIBE_SURVEY_ID = '018b6e13-590c-0000-decb-c727a2b3f462'
describe('Billing', () => {
beforeEach(() => {
cy.intercept('/api/billing/', { fixture: 'api/billing/billing.json' })
cy.visit('/organization/billing')
})
it('Show and submit unsubscribe survey', () => {
cy.intercept('/api/billing/deactivate?products=product_analytics', {
fixture: 'api/billing/billing-unsubscribed-product-analytics.json',
}).as('unsubscribeProductAnalytics')
cy.get('[data-attr=more-button]').first().click()
cy.contains('.LemonButton', 'Unsubscribe').click()
feat: Add Cypress Tests for Onboarding Flow (#20676) * wip * iteration 1 * some small fixes * update * Update UI snapshots for `chromium` (1) * fix up product intro page test * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * rebase on main, fix a type issue * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove console log * remove extraneous file * fix tests again... * Update UI snapshots for `chromium` (2) * more test tweaks * Update UI snapshots for `chromium` (2) * yet another set of fixeds * Update UI snapshots for `chromium` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `webkit` (2) * one more test tweak * fix(admin): follow up for org page performance improvements (#20912) * feat: Add clickhouse migration to create a dictionary (#20665) * feat: Add clickhouse migration to create a dictionary * refactor: Use dictionary created in migration for squashing * fix: Test file drop references to dictionary * fix: Update comment * chore: Master merge * fix: Typo in dictionary Co-authored-by: James Greenhill <fuziontech@gmail.com> --------- Co-authored-by: James Greenhill <fuziontech@gmail.com> * fix: picking embedding input samples (#20913) * fix: Split healthcheck to separate nginx unit app (#20917) Split healthcheck to separate nginx unit app When posthog is under load the healthcheck can stop responding. Split it off into a separate app so it has a dedicated thread to handle it * chore: BillingProduct cleanup (#20910) * fix: show names on frontend (#20918) * fix(experiment): revert default goal back to Trends (#20921) * Add missing healthcheck routes to app (#20923) * Add missing healthcheck routes to app * Switch healthz to _health * chore: Add context to deployment messages (#20911) Add context to deployment messages Co-authored-by: xneyder <xneyder@gmail.com> * chore(environments): Add migration to backfill projects (#20887) * chore(environments): Add migration to backfill projects * Fix `noop` * Add `project_id` to plugin server test setup * Fix `project_id` * Also add `posthog_project` to plugin server tests * Update `createTeam` * Fix func tests * refactor(style): do not use star imports for locals (#20915) * feat(sentry): enable sampling via http header (#20916) * fix: Add missing underscore to healthcheck routes (#20926) Add missing underscore to healthcheck routes * chore(deps): Update posthog-js to 1.115.0 (#20924) * fix(toolbar): Keep flags in sync (#20927) * fix(toolbar): Keep flags in sync * add test * fix: some typos in summary settings (#20925) * fix: some typos in summary settings * Update UI snapshots for `chromium` (2) * don't compare instance equality you fool * feels wrong for reset to change opt in status... * Fix --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * fix: custom player inspector events should respect mini filters (#20929) * fix: custom player inspector events should respect mini filters * all the alls * fix: don't show billing step on self-hosted (#20931) don't show billing step on self-hosted * chore: improve onboarding spacing consistency (#20838) * Make the space between sections consistent * add more space above team section * Improve the topbar spacing and positioning * Move the breadcrumbs above and center the title * Make spacing consistent across all SDKs * Add chain op to plans for when they aren't available * Make sdk margin top consistent with other steps * Update the invite onboarding step title * Move the breadcrumbs to be left aligned * Set top bar title to onboarding in onboarding * Fix cypress tests * Update cypress tests * Remove stale snapshots * remove billing changes --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * fix: flappy snapshot (#20930) * attempt fix for flappy snapshot * Update UI snapshots for `chromium` (2) * fix another one * Update UI snapshots for `chromium` (2) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * fix storybook * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * fix some tests * another round of fixes --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Thomas Obermüller <thomas.obermueller@gmail.com> Co-authored-by: Tomás Farías Santana <tomas@tomasfarias.dev> Co-authored-by: James Greenhill <fuziontech@gmail.com> Co-authored-by: David Newell <d.newell1@outlook.com> Co-authored-by: Frank Hamand <frankhamand@gmail.com> Co-authored-by: Juraj Majerik <juro.majerik@gmail.com> Co-authored-by: danielxnj <115043334+danielxnj@users.noreply.github.com> Co-authored-by: xneyder <xneyder@gmail.com> Co-authored-by: Michael Matloka <dev@twixes.com> Co-authored-by: PostHog Bot <69588470+posthog-bot@users.noreply.github.com> Co-authored-by: Neil Kakkar <neilkakkar@gmail.com> Co-authored-by: Paul D'Ambra <paul@posthog.com> Co-authored-by: Raquel Smith <raquelmsmith@users.noreply.github.com> Co-authored-by: Zach Waterfield <zlwaterfield@gmail.com>
2024-03-19 05:19:26 +01:00
cy.get('.LemonModal h3').should('contain', 'Why are you unsubscribing from Product analytics?')
cy.get('[data-attr=unsubscribe-reason-survey-textarea]').type('Product analytics')
cy.contains('.LemonModal .LemonButton', 'Unsubscribe').click()
cy.window().then((win) => {
const events = (win as any)._cypress_posthog_captures
const matchingEvents = events.filter((event) => event.event === 'survey sent')
expect(matchingEvents.length).to.equal(1)
const matchingEvent = matchingEvents[0]
expect(matchingEvent.properties.$survey_id).to.equal(UNSUBSCRIBE_SURVEY_ID)
expect(matchingEvent.properties.$survey_response).to.equal('Product analytics')
expect(matchingEvent.properties.$survey_response_1).to.equal('product_analytics')
})
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()
feat: Add Cypress Tests for Onboarding Flow (#20676) * wip * iteration 1 * some small fixes * update * Update UI snapshots for `chromium` (1) * fix up product intro page test * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * rebase on main, fix a type issue * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove console log * remove extraneous file * fix tests again... * Update UI snapshots for `chromium` (2) * more test tweaks * Update UI snapshots for `chromium` (2) * yet another set of fixeds * Update UI snapshots for `chromium` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `webkit` (2) * one more test tweak * fix(admin): follow up for org page performance improvements (#20912) * feat: Add clickhouse migration to create a dictionary (#20665) * feat: Add clickhouse migration to create a dictionary * refactor: Use dictionary created in migration for squashing * fix: Test file drop references to dictionary * fix: Update comment * chore: Master merge * fix: Typo in dictionary Co-authored-by: James Greenhill <fuziontech@gmail.com> --------- Co-authored-by: James Greenhill <fuziontech@gmail.com> * fix: picking embedding input samples (#20913) * fix: Split healthcheck to separate nginx unit app (#20917) Split healthcheck to separate nginx unit app When posthog is under load the healthcheck can stop responding. Split it off into a separate app so it has a dedicated thread to handle it * chore: BillingProduct cleanup (#20910) * fix: show names on frontend (#20918) * fix(experiment): revert default goal back to Trends (#20921) * Add missing healthcheck routes to app (#20923) * Add missing healthcheck routes to app * Switch healthz to _health * chore: Add context to deployment messages (#20911) Add context to deployment messages Co-authored-by: xneyder <xneyder@gmail.com> * chore(environments): Add migration to backfill projects (#20887) * chore(environments): Add migration to backfill projects * Fix `noop` * Add `project_id` to plugin server test setup * Fix `project_id` * Also add `posthog_project` to plugin server tests * Update `createTeam` * Fix func tests * refactor(style): do not use star imports for locals (#20915) * feat(sentry): enable sampling via http header (#20916) * fix: Add missing underscore to healthcheck routes (#20926) Add missing underscore to healthcheck routes * chore(deps): Update posthog-js to 1.115.0 (#20924) * fix(toolbar): Keep flags in sync (#20927) * fix(toolbar): Keep flags in sync * add test * fix: some typos in summary settings (#20925) * fix: some typos in summary settings * Update UI snapshots for `chromium` (2) * don't compare instance equality you fool * feels wrong for reset to change opt in status... * Fix --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * fix: custom player inspector events should respect mini filters (#20929) * fix: custom player inspector events should respect mini filters * all the alls * fix: don't show billing step on self-hosted (#20931) don't show billing step on self-hosted * chore: improve onboarding spacing consistency (#20838) * Make the space between sections consistent * add more space above team section * Improve the topbar spacing and positioning * Move the breadcrumbs above and center the title * Make spacing consistent across all SDKs * Add chain op to plans for when they aren't available * Make sdk margin top consistent with other steps * Update the invite onboarding step title * Move the breadcrumbs to be left aligned * Set top bar title to onboarding in onboarding * Fix cypress tests * Update cypress tests * Remove stale snapshots * remove billing changes --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * fix: flappy snapshot (#20930) * attempt fix for flappy snapshot * Update UI snapshots for `chromium` (2) * fix another one * Update UI snapshots for `chromium` (2) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * fix storybook * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * fix some tests * another round of fixes --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Thomas Obermüller <thomas.obermueller@gmail.com> Co-authored-by: Tomás Farías Santana <tomas@tomasfarias.dev> Co-authored-by: James Greenhill <fuziontech@gmail.com> Co-authored-by: David Newell <d.newell1@outlook.com> Co-authored-by: Frank Hamand <frankhamand@gmail.com> Co-authored-by: Juraj Majerik <juro.majerik@gmail.com> Co-authored-by: danielxnj <115043334+danielxnj@users.noreply.github.com> Co-authored-by: xneyder <xneyder@gmail.com> Co-authored-by: Michael Matloka <dev@twixes.com> Co-authored-by: PostHog Bot <69588470+posthog-bot@users.noreply.github.com> Co-authored-by: Neil Kakkar <neilkakkar@gmail.com> Co-authored-by: Paul D'Ambra <paul@posthog.com> Co-authored-by: Raquel Smith <raquelmsmith@users.noreply.github.com> Co-authored-by: Zach Waterfield <zlwaterfield@gmail.com>
2024-03-19 05:19:26 +01:00
cy.get('.LemonModal h3').should('contain', 'Why are you unsubscribing from Product analytics?')
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()
2024-02-12 15:11:41 +01:00
cy.get('.LemonModal 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')
})
})