-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add integration tests for frontend path #5712
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
base: main
Are you sure you want to change the base?
Add integration tests for frontend path #5712
Conversation
CodSpeed Performance ReportMerging #5712 will not alter performanceComparing Summary
|
There was a problem hiding this 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 introduces integration testing for frontend path functionality, specifically addressing issue #5674 where on_load
and on_mount
handlers fail to redirect properly when Reflex applications are served from non-root frontend paths (e.g., '/prefix').
The changes include two main components:
-
Environment Variable Addition: A new
REFLEX_FRONTEND_PATH
environment variable is added to theEnvironmentVariables
class inreflex/environment.py
. This string variable defaults to an empty string and provides the configuration mechanism for specifying the base path under which the frontend is served. -
Comprehensive Integration Test: A new test file
tests/integration/tests_playwright/test_frontend_path.py
creates a complete end-to-end test using Playwright. The test creates a Reflex app with redirect pages and validates that redirects work correctly both in normal conditions and when served from a non-root frontend path.
The integration test uses two fixtures - one for production mode and another that sets the REFLEX_FRONTEND_PATH
to '/prefix'. It employs parametrized testing to verify both scenarios, with the prefix case marked as xfail
since it demonstrates the known bug that should be resolved by the related PR #5698.
This change fits into the broader Reflex ecosystem by enabling proper deployment behind reverse proxies, a common pattern where multiple applications are served from different paths on the same domain. The environment variable provides a clean configuration interface that other parts of the codebase can reference to adjust their behavior for non-root deployments.
Confidence score: 4/5
- This PR introduces well-structured integration testing with minimal risk to existing functionality
- Score reflects solid test design and environment variable implementation, though the xfail test indicates known issues
- Pay close attention to the test file to ensure proper cleanup of environment variables and test isolation
2 files reviewed, 2 comments
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Note I'm using simple |
619abbb
to
e5d9f9b
Compare
e5d9f9b
to
26c3be7
Compare
a8e571d
to
26c3be7
Compare
26c3be7
to
02650f3
Compare
Introduces an integration test for #5674.
This xfails on
main
but passes on #5698Edit: also fixed an apparent bug in
test_link_hover.py
. There may be a deeper issue here.Edit: removed xfail after merging main which now includes #5698.
Edit: added a test for 404s.