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

chore: longer timeout on insight and dashboard cypress tests #27159

Merged
merged 4 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
1 change: 0 additions & 1 deletion .github/workflows/ci-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ jobs:
uses: cypress-io/github-action@v6
with:
config-file: cypress.e2e.config.ts
config: retries=2
spec: ${{ matrix.chunk }}
install: false
# We were seeing suprising crashes in headless mode
Expand Down
6 changes: 3 additions & 3 deletions cypress.e2e.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const checkFileDownloaded = async (filename: string, timeout: number, delayMs =

export default defineConfig({
video: false,
defaultCommandTimeout: 20000,
requestTimeout: 8000,
defaultCommandTimeout: 40000,
requestTimeout: 16000,
pageLoadTimeout: 80000,
projectId: 'twojfp',
viewportWidth: 1200,
Expand All @@ -34,7 +34,7 @@ export default defineConfig({
// cypress default is 'top' this means sometimes the element is underneath the top navbar
// not what a human would do... so, set it to center to avoid this weird behavior
scrollBehavior: 'center',
retries: { runMode: 2 },
retries: { runMode: 3 },
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
Expand Down
58 changes: 32 additions & 26 deletions cypress/e2e/billing.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,39 @@ describe('Billing', () => {
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')
it(
'Show and submit unsubscribe survey',
{
retries: 4,
},
() => {
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()
cy.get('.LemonModal h3').should('contain', 'Unsubscribe from Product analytics')
cy.get('[data-attr=unsubscribe-reason-too-expensive]').click()
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')
expect(matchingEvent.properties.$survey_response_2.length).to.equal(1)
expect(matchingEvent.properties.$survey_response_2[0]).to.equal('Too expensive')
})

cy.get('.LemonModal').should('not.exist')
cy.wait(['@unsubscribeProductAnalytics'])
})
cy.get('[data-attr=more-button]').first().click()
cy.contains('.LemonButton', 'Unsubscribe').click()
cy.get('.LemonModal h3').should('contain', 'Unsubscribe from Product analytics')
cy.get('[data-attr=unsubscribe-reason-too-expensive]').click()
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')
expect(matchingEvent.properties.$survey_response_2.length).to.equal(1)
expect(matchingEvent.properties.$survey_response_2[0]).to.equal('Too expensive')
})

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()
Expand Down
Loading