Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Cypress Tests for Onboarding Flow #20676

Merged
merged 53 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
9d78dad
wip
Feb 29, 2024
a6763a6
iteration 1
Mar 2, 2024
bec0c8b
some small fixes
Mar 2, 2024
6bb8c5c
update
Mar 8, 2024
3422c6e
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 8, 2024
f71d915
fix up product intro page test
Mar 8, 2024
de9281a
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 8, 2024
79eaa8a
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 9, 2024
414d2c6
rebase on main, fix a type issue
Mar 11, 2024
4315b48
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 11, 2024
700dee1
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 11, 2024
99cf6c1
remove console log
Mar 12, 2024
eac7c1e
remove extraneous file
Mar 12, 2024
442ccb3
fix tests again...
Mar 13, 2024
238b36c
Merge branch 'master' into by/onboarding-cypress
xrdt Mar 13, 2024
50cdb29
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 13, 2024
721e5c4
more test tweaks
Mar 13, 2024
2140361
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 13, 2024
0382f25
yet another set of fixeds
Mar 13, 2024
0472e86
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 13, 2024
8153238
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 13, 2024
34a582f
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 13, 2024
7c4d389
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 13, 2024
c105362
one more test tweak
Mar 14, 2024
3cd15a8
Merge remote-tracking branch 'origin/master' into by/onboarding-cypress
Mar 14, 2024
b28824f
fix(admin): follow up for org page performance improvements (#20912)
thmsobrmlr Mar 14, 2024
e40142f
feat: Add clickhouse migration to create a dictionary (#20665)
tomasfarias Mar 14, 2024
0524021
fix: picking embedding input samples (#20913)
daibhin Mar 14, 2024
2ffbb1b
fix: Split healthcheck to separate nginx unit app (#20917)
frankh Mar 14, 2024
9049fd2
chore: BillingProduct cleanup (#20910)
daibhin Mar 14, 2024
42edec7
fix: show names on frontend (#20918)
daibhin Mar 14, 2024
b192cb9
fix(experiment): revert default goal back to Trends (#20921)
jurajmajerik Mar 14, 2024
176da5d
Add missing healthcheck routes to app (#20923)
frankh Mar 14, 2024
1840482
chore: Add context to deployment messages (#20911)
danielxnj Mar 14, 2024
354cf47
chore(environments): Add migration to backfill projects (#20887)
Twixes Mar 14, 2024
f4c9bef
refactor(style): do not use star imports for locals (#20915)
thmsobrmlr Mar 14, 2024
32e423d
feat(sentry): enable sampling via http header (#20916)
thmsobrmlr Mar 14, 2024
114ce39
fix: Add missing underscore to healthcheck routes (#20926)
frankh Mar 14, 2024
19e49f7
chore(deps): Update posthog-js to 1.115.0 (#20924)
posthog-bot Mar 14, 2024
00bef66
fix(toolbar): Keep flags in sync (#20927)
neilkakkar Mar 14, 2024
47a4297
fix: some typos in summary settings (#20925)
pauldambra Mar 14, 2024
e198211
fix: custom player inspector events should respect mini filters (#20929)
pauldambra Mar 14, 2024
f550541
fix: don't show billing step on self-hosted (#20931)
raquelmsmith Mar 14, 2024
7164789
chore: improve onboarding spacing consistency (#20838)
zlwaterfield Mar 14, 2024
011781a
fix: flappy snapshot (#20930)
raquelmsmith Mar 14, 2024
c8764f6
fix storybook
Mar 18, 2024
118a884
Merge remote-tracking branch 'origin/master' into by/onboarding-cypress
Mar 18, 2024
8c442f8
Update UI snapshots for `webkit` (2)
github-actions[bot] Mar 19, 2024
a2b89fd
Update UI snapshots for `chromium` (1)
github-actions[bot] Mar 19, 2024
fd653b1
Update UI snapshots for `chromium` (2)
github-actions[bot] Mar 19, 2024
1ede0b6
Merge branch 'master' into by/onboarding-cypress
xrdt Mar 19, 2024
d12e651
fix some tests
Mar 19, 2024
e880147
another round of fixes
Mar 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/billingUpgradeCTA.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Billing Upgrade CTA', () => {
const events = (win as any)._cypress_posthog_captures

const matchingEvents = events.filter((event) => event.event === 'billing CTA shown')
expect(matchingEvents.length).to.equal(4)
expect(matchingEvents.length).to.equal(3)
})

cy.intercept('/api/billing-v2/', { fixture: 'api/billing-v2/billing-v2-unsubscribed.json' })
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/billingv2.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Billing', () => {

cy.get('[data-attr=more-button]').first().click()
cy.contains('.LemonButton', 'Unsubscribe').click()
cy.get('.LemonModal h3').should('contain', 'Why are you unsubscribing from Product analytics + data stack?')
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()

Expand All @@ -35,7 +35,7 @@ describe('Billing', () => {
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 h3').should('contain', 'Why are you unsubscribing from Product analytics + data stack?')
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()
Expand Down
162 changes: 149 additions & 13 deletions cypress/e2e/onboarding.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { decideResponse } from '../fixtures/api/decide'

describe('Onboarding', () => {
beforeEach(() => {
cy.intercept('/api/billing-v2/', { fixture: 'api/billing-v2/billing-v2-unsubscribed.json' })

cy.intercept('**/decide/*', (req) =>
req.reply(
decideResponse({
Expand All @@ -21,24 +23,158 @@ describe('Onboarding', () => {
// Confirm product intro is not included as the first step in the upper right breadcrumbs
cy.get('[data-attr=onboarding-breadcrumbs] > :first-child > * span').should('not.contain', 'Product intro')

// Navigate to the product intro page by clicking the left side bar
cy.get('[data-attr=menu-item-replay').click()
cy.window().then((win) => {
win.POSTHOG_APP_CONTEXT.current_team.has_completed_onboarding_for = {}
})

cy.get('[data-attr=menu-item-savedinsights]').click()

// Confirm we're on the product_intro page
cy.get('[data-attr=top-bar-name] > span').contains('Onboarding')
cy.get('[data-attr=product-intro-title]').contains('Watch how users experience your app')
cy.get('[data-attr=product-intro-title]').contains('Product analytics with autocapture')

// Go back to /products
cy.visit('/products')
cy.get('[data-attr=start-onboarding]').should('be.visible')
cy.get('[data-attr=skip-onboarding]').should('not.exist')
})

// Again get started on product analytics onboarding
cy.get('[data-attr=product_analytics-onboarding-card]').click()
// it('Step through PA onboarding', () => {
// cy.visit('/products')

// Navigate to the product intro page by changing the url
cy.visit(urls.onboarding('session_replay', 'product_intro'))
// // Get started on product analytics onboarding
// cy.get('[data-attr=product_analytics-onboarding-card]').click()

// Confirm we're on the product intro page
cy.get('[data-attr=top-bar-name] > span').contains('Onboarding')
cy.get('[data-attr=product-intro-title]').contains('Watch how users experience your app')
})
// // Installation should be complete
// cy.get('svg.LemonIcon.text-success').should('exist')
// cy.get('svg.LemonIcon.text-success').parent().should('contain', 'Installation complete')

// // Continue to configuration step
// cy.get('[data-attr=sdk-continue]').click()

// // Confirm the appropriate breadcrumb is highlighted
// cy.get('[data-attr=onboarding-breadcrumbs] > :nth-child(3) > * span').should('contain', 'Configure')
// cy.get('[data-attr=onboarding-breadcrumbs] > :nth-child(3) > * span').should('not.have.css', 'text-muted')

// // Continue to plans
// cy.get('[data-attr=onboarding-continue]').click()

// // Verify pricing table visible
// cy.get('.BillingHero').should('be.visible')
// cy.get('table.PlanComparison').should('be.visible')

// // Confirm buttons on pricing comparison
// cy.get('[data-attr=upgrade-Paid] .LemonButton__content').should('have.text', 'Upgrade')
// cy.get('[data-attr=upgrade-Free] .LemonButton__content').should('have.text', 'Current plan')

// // Continue
// cy.get('[data-attr=onboarding-skip-button]').click()

// // Click back to Install step
// cy.get('[data-attr=onboarding-breadcrumbs] > :first-child > * span').click()

// // Continue through to finish
// cy.get('[data-attr=sdk-continue]').click()
// cy.get('[data-attr=onboarding-continue]').click()
// cy.get('[data-attr=onboarding-skip-button]').click()
// cy.get('[data-attr=onboarding-continue]').click()

// // Confirm we're on the insights list page
// cy.url().should('contain', 'project/1/insights')

// cy.visit('/onboarding/product_analytics?step=product_intro')

// // Should see both an option to skip onboarding and an option to see the sdk instructions
// cy.get('[data-attr=skip-onboarding]').should('be.visible')
// cy.get('[data-attr=start-onboarding-sdk]').should('be.visible')

// cy.get('[data-attr=skip-onboarding]').first().click()
// cy.url().should('contain', 'project/1/insights')

// cy.visit('/onboarding/product_analytics?step=product_intro')
// cy.get('[data-attr=start-onboarding-sdk]').first().click()
// cy.url().should('contain', 'project/1/onboarding/product_analytics?step=install')

// cy.visit('/products')
// cy.get('[data-attr=return-to-product_analytics] > svg').click()
// cy.url().should('contain', 'project/1/insights')
// })

// it('Step through SR onboarding', () => {
// cy.visit('/products')
// cy.get('[data-attr=session_replay-onboarding-card]').click()

// // Installation should be complete
// cy.get('svg.LemonIcon.text-success').should('exist')
// cy.get('svg.LemonIcon.text-success').parent().should('contain', 'Installation complete')
// // Continue to configuration step
// cy.get('[data-attr=sdk-continue]').click()
// // Continue to plans
// cy.get('[data-attr=onboarding-continue]').click()
// // Verify pricing table visible
// cy.get('.BillingHero').should('be.visible')
// cy.get('table.PlanComparison').should('be.visible')
// // Confirm buttons on pricing comparison
// cy.get('[data-attr=upgrade-Paid] .LemonButton__content').should('have.text', 'Upgrade')
// cy.get('[data-attr=upgrade-Free] .LemonButton__content').should('have.text', 'Current plan')
// // Continue through to finish
// cy.get('[data-attr=onboarding-skip-button]').click()
// cy.get('[data-attr=onboarding-continue]').click()
// // Confirm we're on the recordings list page
// cy.url().should('contain', 'project/1/replay/recent')
// cy.visit('/onboarding/session_replay?step=product_intro')
// cy.get('[data-attr=skip-onboarding]').should('be.visible')
// cy.get('[data-attr=start-onboarding-sdk]').should('not.exist')
// })

// it('Step through FF onboarding', () => {
// cy.visit('/onboarding/feature_flags?step=product_intro')
// cy.get('[data-attr=start-onboarding-sdk]').first().click()
// cy.get('[data-attr=sdk-continue]').click()

// // Confirm the appropriate breadcrumb is highlighted
// cy.get('[data-attr=onboarding-breadcrumbs] > :nth-child(5) > * span').should('contain', 'Plans')
// cy.get('[data-attr=onboarding-breadcrumbs] > :nth-child(3) > * span').should('not.have.css', 'text-muted')

// cy.get('[data-attr=onboarding-skip-button]').click()
// cy.get('[data-attr=onboarding-continue]').click()

// cy.url().should('contain', '/feature_flags')

// cy.visit('/onboarding/feature_flags?step=product_intro')

// cy.get('[data-attr=skip-onboarding]').should('be.visible')
// cy.get('[data-attr=start-onboarding-sdk]').should('be.visible')

// cy.get('[data-attr=skip-onboarding]').first().click()
// })

// it('Step through Surveys onboarding', () => {
// cy.visit('/onboarding/surveys?step=product_intro')
// cy.get('[data-attr=skip-onboarding]').should('be.visible')
// cy.get('[data-attr=start-onboarding-sdk]').should('not.exist')
// cy.get('[data-attr=skip-onboarding]').first().click()
// cy.url().should('contain', 'survey_templates')

// cy.visit('/products')
// cy.get('[data-attr=surveys-onboarding-card]').click()
// // Installation should be complete
// cy.get('svg.LemonIcon.text-success').should('exist')
// cy.get('svg.LemonIcon.text-success').parent().should('contain', 'Installation complete')

// // Continue to configuration step
// cy.get('[data-attr=sdk-continue]').click()

// // Verify pricing table visible
// cy.get('.BillingHero').should('be.visible')
// cy.get('table.PlanComparison').should('be.visible')

// // Confirm buttons on pricing comparison
// cy.get('[data-attr=upgrade-Paid] .LemonButton__content').should('have.text', 'Upgrade')
// cy.get('[data-attr=upgrade-Free] .LemonButton__content').should('have.text', 'Current plan')

// // Continue
// cy.get('[data-attr=onboarding-skip-button]').click()
// cy.get('[data-attr=onboarding-continue]').click()

// cy.url().should('contain', '/survey_templates')
// })
})
117 changes: 108 additions & 9 deletions cypress/fixtures/api/billing-v2/billing-v2-unsubscribed.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@
"discord_integration",
"apps",
"boolean_flags",
"multivariate_flags",
"persist_flags_cross_authentication",
"feature_flag_payloads",
"multiple_release_conditions",
"release_condition_overrides",
"targeting_by_group",
"local_evaluation_and_bootstrapping",
"flag_usage_stats",
"experimentation",
"funnel_experiments",
"secondary_metrics",
"statistical_analysis",
"feature_flags_data_retention",
"console_logs",
"recordings_performance",
Expand Down Expand Up @@ -173,6 +178,14 @@
"limit": null,
"note": null
},
{
"key": "multivariate_flags",
"name": "Multivariate feature flags & experiments",
"description": "Create three or more variants of a feature flag to test or release different versions of a feature.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "persist_flags_cross_authentication",
"name": "Persist flags across authentication",
Expand Down Expand Up @@ -229,6 +242,38 @@
"limit": null,
"note": null
},
{
"key": "experimentation",
"name": "A/B testing",
"description": "Test changes to your product and evaluate the impacts those changes make.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "funnel_experiments",
"name": "Funnel & trend experiments",
"description": "Measure the impact of a change on a aggregate values or a series of events, like a signup flow.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "secondary_metrics",
"name": "Secondary experiment metrics",
"description": "Track additional metrics to see how your experiment affects other parts of your app or different flows.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "statistical_analysis",
"name": "Statistical analysis",
"description": "Get a statistical analysis of your experiment results to see if the results are significant, or if they're likely just due to chance.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "feature_flags_data_retention",
"name": "Data retention",
Expand Down Expand Up @@ -1717,6 +1762,14 @@
"limit": null,
"note": null
},
{
"key": "multivariate_flags",
"name": "Multivariate feature flags & experiments",
"description": "Create three or more variants of a feature flag to test or release different versions of a feature.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "persist_flags_cross_authentication",
"name": "Persist flags across authentication",
Expand Down Expand Up @@ -1773,6 +1826,38 @@
"limit": null,
"note": null
},
{
"key": "experimentation",
"name": "A/B testing",
"description": "Test changes to your product and evaluate the impacts those changes make.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "funnel_experiments",
"name": "Funnel & trend experiments",
"description": "Measure the impact of a change on a aggregate values or a series of events, like a signup flow.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "secondary_metrics",
"name": "Secondary experiment metrics",
"description": "Track additional metrics to see how your experiment affects other parts of your app or different flows.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "statistical_analysis",
"name": "Statistical analysis",
"description": "Get a statistical analysis of your experiment results to see if the results are significant, or if they're likely just due to chance.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "feature_flags_data_retention",
"name": "Data retention",
Expand Down Expand Up @@ -1879,14 +1964,6 @@
"limit": null,
"note": null
},
{
"key": "group_experiments",
"name": "Group experiments",
"description": "Target experiments to specific groups of users so everyone in the same group gets the same variant.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "funnel_experiments",
"name": "Funnel & trend experiments",
Expand All @@ -1911,6 +1988,22 @@
"limit": null,
"note": null
},
{
"key": "group_experiments",
"name": "Group experiments",
"description": "Target experiments to specific groups of users so everyone in the same group gets the same variant.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "multiple_environments",
"name": "Multi-environment support",
"description": "Test flags in local development or staging by using the same flag key across PostHog projects.",
"unit": null,
"limit": null,
"note": null
},
{
"key": "feature_flags_data_retention",
"name": "Data retention",
Expand Down Expand Up @@ -3637,5 +3730,11 @@
"discount_amount_usd": null,
"amount_off_expires_at": null,
"never_drop_data": null,
"stripe_portal_url": "https://billing.stripe.com/p/session/test_YWNjdF8xSElNRERFdUlhdFJYU2R6LF9QZzdwUjRPMXBobnRsdHdKaDVpbEVzbkREcE9RQnFT0100S0djyn8G"
"customer_trust_scores": {
"surveys": 0,
"feature_flags": 0,
"session_replay": 3,
"product_analytics": 3
},
"stripe_portal_url": "https://billing.stripe.com/p/session/test_YWNjdF8xSElNRERFdUlhdFJYU2R6LF9QaEVaQ0hCTUE0aE8wUFhlVWVqd29MaElGd3lwRjFa010044U4IxJp"
}
Loading
Loading