0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-25 02:49:32 +01:00
posthog/cypress/e2e/billingUpgradeCTA.cy.ts

27 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

feat: Experiment with language on billing pages in app (#20567) * toggle upgrade language depending on flag value * forgot some local changes * update credit card case language * Update UI snapshots for `chromium` (1) * add event to record subscription status * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * add tests * remove length check * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * make common button component * some more small changes * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove extraneous files * remove optional chaining * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove test...rename event * Update UI snapshots for `chromium` (1) * didn't save before commiting * undo changes to billing cypress test * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * finally get cypress to work! * small fix to test * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove from paygate mini * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * remove paygate test * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove extraneous files * remove files! * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * update tests * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Raquel Smith <raquelmsmith@users.noreply.github.com>
2024-03-18 20:03:29 +01:00
// Mainly testing to make sure events are fired as expected
describe('Billing Upgrade CTA', () => {
beforeEach(() => {
cy.intercept('/api/billing/', { fixture: 'api/billing/billing-unsubscribed.json' })
feat: Experiment with language on billing pages in app (#20567) * toggle upgrade language depending on flag value * forgot some local changes * update credit card case language * Update UI snapshots for `chromium` (1) * add event to record subscription status * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * add tests * remove length check * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * make common button component * some more small changes * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove extraneous files * remove optional chaining * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove test...rename event * Update UI snapshots for `chromium` (1) * didn't save before commiting * undo changes to billing cypress test * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * finally get cypress to work! * small fix to test * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove from paygate mini * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * remove paygate test * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove extraneous files * remove files! * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * update tests * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Raquel Smith <raquelmsmith@users.noreply.github.com>
2024-03-18 20:03:29 +01:00
})
it('Check that events are being sent on each page visit', () => {
cy.visit('/organization/billing')
cy.get('[data-attr=billing-page-core-upgrade-cta] .LemonButton__content').should('have.text', 'Upgrade now')
feat: Experiment with language on billing pages in app (#20567) * toggle upgrade language depending on flag value * forgot some local changes * update credit card case language * Update UI snapshots for `chromium` (1) * add event to record subscription status * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * add tests * remove length check * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * make common button component * some more small changes * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove extraneous files * remove optional chaining * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove test...rename event * Update UI snapshots for `chromium` (1) * didn't save before commiting * undo changes to billing cypress test * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * finally get cypress to work! * small fix to test * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove from paygate mini * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * remove paygate test * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove extraneous files * remove files! * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * update tests * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Raquel Smith <raquelmsmith@users.noreply.github.com>
2024-03-18 20:03:29 +01:00
cy.window().then((win) => {
const events = (win as any)._cypress_posthog_captures
const matchingEvents = events.filter((event) => event.event === 'billing CTA shown')
// One for each product card
expect(matchingEvents.length).to.equal(1)
feat: Experiment with language on billing pages in app (#20567) * toggle upgrade language depending on flag value * forgot some local changes * update credit card case language * Update UI snapshots for `chromium` (1) * add event to record subscription status * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * add tests * remove length check * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * make common button component * some more small changes * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove extraneous files * remove optional chaining * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove test...rename event * Update UI snapshots for `chromium` (1) * didn't save before commiting * undo changes to billing cypress test * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * finally get cypress to work! * small fix to test * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove from paygate mini * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * remove paygate test * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove extraneous files * remove files! * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * update tests * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Raquel Smith <raquelmsmith@users.noreply.github.com>
2024-03-18 20:03:29 +01:00
})
// Mock billing response with subscription
cy.intercept('/api/billing/', { fixture: 'api/billing/billing.json' })
feat: Experiment with language on billing pages in app (#20567) * toggle upgrade language depending on flag value * forgot some local changes * update credit card case language * Update UI snapshots for `chromium` (1) * add event to record subscription status * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * add tests * remove length check * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * make common button component * some more small changes * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove extraneous files * remove optional chaining * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove test...rename event * Update UI snapshots for `chromium` (1) * didn't save before commiting * undo changes to billing cypress test * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * finally get cypress to work! * small fix to test * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove from paygate mini * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * remove paygate test * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove extraneous files * remove files! * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * update tests * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Raquel Smith <raquelmsmith@users.noreply.github.com>
2024-03-18 20:03:29 +01:00
cy.reload()
cy.get('[data-attr=billing-page-core-upgrade-cta] .LemonButton__content').should('not.exist')
cy.get('[data-attr=manage-billing]').should('have.text', 'Manage card details and invoices')
feat: Experiment with language on billing pages in app (#20567) * toggle upgrade language depending on flag value * forgot some local changes * update credit card case language * Update UI snapshots for `chromium` (1) * add event to record subscription status * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * add tests * remove length check * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * make common button component * some more small changes * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove extraneous files * remove optional chaining * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * remove test...rename event * Update UI snapshots for `chromium` (1) * didn't save before commiting * undo changes to billing cypress test * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * finally get cypress to work! * small fix to test * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove from paygate mini * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * remove paygate test * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * remove extraneous files * remove files! * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * update tests * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Raquel Smith <raquelmsmith@users.noreply.github.com>
2024-03-18 20:03:29 +01:00
})
})