Add integration tests for frontend path#5712
Add integration tests for frontend path#5712tartansandal wants to merge 15 commits intoreflex-dev:mainfrom
Conversation
CodSpeed Performance ReportMerging #5712 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
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_PATHenvironment variable is added to theEnvironmentVariablesclass 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.pycreates 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
mainbut 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.