Skip to content

feat: add wizard e2e test query edge case#35380

Merged
jonathanlab merged 5 commits intomasterfrom
wizard-query-e2e-check
Jul 21, 2025
Merged

feat: add wizard e2e test query edge case#35380
jonathanlab merged 5 commits intomasterfrom
wizard-query-e2e-check

Conversation

@jonathanlab
Copy link
Copy Markdown
Contributor

Problem

To support the fixture generation during E2E tests in the @posthog/wizard package, we need to support mocking the cache value, since we never authenticate through the browser in the E2E flow.

Context: PostHog/wizard#101

Changes

  • Add the ability to mock wizard data if PostHog is running in debug and the X-PostHog-Wizard-Fixture-Generation header is specified.
  • Upped the Wizard rate limit in development.

How did you test this code?

Added tests for checking the changed functionality.

Did you write or update any docs for this change?

  • No docs needed for this change

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

@jonathanlab jonathanlab requested a review from joshsny July 21, 2025 16:12
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR adds support for fixture generation in E2E tests for the @posthog/wizard package by introducing the ability to mock wizard data in debug mode and increasing rate limits for development environments. The changes involve two main components:

  1. Adding support for mock wizard data when PostHog is running in debug mode and a specific header (X-PostHog-Wizard-Fixture-Generation) is present
  2. Increasing the wizard rate limit in development from 20/day to 1000/day

The test coverage is comprehensive, with new test cases that verify both the positive and negative scenarios for mock data usage.

Confidence score: 2/5

  1. Can be merged with caution, but needs attention to critical issues.
  2. There is a critical bug in the rate limit setting that needs to be fixed.
  3. The rate limit change in rate_limit.py needs immediate attention.

The bug in rate_limit.py is severe - the rate setting code has an assignment error. The line:

if settings.DEBUG:
    "1000/day"

This code creates a string literal but doesn't assign it to anything. It should be:

if settings.DEBUG:
    rate = "1000/day"

This bug means that the rate limit will remain at 20/day even in debug mode, which will affect the E2E testing functionality this PR aims to enable.

2 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Comment thread posthog/rate_limit.py Outdated
Copy link
Copy Markdown
Contributor

@joshsny joshsny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@jonathanlab jonathanlab enabled auto-merge (squash) July 21, 2025 17:28
@jonathanlab jonathanlab merged commit 6f2e116 into master Jul 21, 2025
154 of 155 checks passed
@jonathanlab jonathanlab deleted the wizard-query-e2e-check branch July 21, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants