Repository navigation
[codex] Document Reborn WebUI legacy E2E coverage - #5376
ilblackdragon wants to merge 10 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request ports legacy automation management and CSP/browser-safety checks to Reborn WebUI v2. The feedback suggests improving the CSP violation test by using a fresh page context instead of reloading an existing one to ensure initial load violations are captured, and replacing wait_for_timeout with page.wait_for_function to make the test more robust.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| async def test_reborn_legacy_csp_no_violations_on_load(reborn_v2_page): | ||
| """Port of legacy CSP console violation check to the Reborn shell.""" | ||
| violations = [] | ||
| _record_csp_console_errors(reborn_v2_page, violations) | ||
|
|
||
| await reborn_v2_page.reload(wait_until="load") | ||
| await expect(reborn_v2_page.locator(SEL_V2["chat_composer"])).to_be_visible( | ||
| timeout=15000 | ||
| ) | ||
| await reborn_v2_page.wait_for_timeout(2000) | ||
|
|
||
| assert violations == [], ( | ||
| "CSP violations detected on Reborn page load:\n" + "\n".join(violations) | ||
| ) |
There was a problem hiding this comment.
Using reborn_v2_page (which has already loaded the page once during fixture setup) and then calling reload() is inefficient and can miss CSP violations or console errors that only occur on the very first page load (e.g., due to initial state, redirection, or caching).
Instead, we should create a fresh page context, register the console listener, and then perform the initial navigation, similar to how test_reborn_legacy_csp_no_js_errors_on_page_load is implemented.
Additionally, avoid using wait_for_timeout in tests. Prefer page.wait_for_function to poll for a specific condition (such as the document load state) to make the test more robust.
async def test_reborn_legacy_csp_no_violations_on_load(
reborn_v2_server, reborn_v2_browser
):
"""Port of legacy CSP console violation check to the Reborn shell."""
violations = []
context = await reborn_v2_browser.new_context(viewport={'width': 1280, 'height': 720})
page = await context.new_page()
_record_csp_console_errors(page, violations)
try:
await page.goto(f'{reborn_v2_server}/v2/?token={REBORN_V2_AUTH_TOKEN}')
await expect(page.locator(SEL_V2['chat_composer'])).to_be_visible(timeout=15000)
await page.wait_for_function("() => document.readyState === 'complete'")
finally:
await context.close()
assert violations == [], (
'CSP violations detected on Reborn page load:\n' + '\n'.join(violations)
)References
- In tests, prefer
page.wait_for_functionto poll for a specific condition instead of using a fixedwait_for_timeout. This creates more robust tests by waiting for an expected state change rather than an arbitrary duration.
|
/canary all |
|
Started Reborn WebUI v2 live canary for |
c7cbcfc to
7250adb
Compare
|
Superseded. Closing. |
Summary
Validation
tests/e2e/.venv/bin/python -m py_compile tests/e2e/scenarios/test_reborn_webui_v2_legacy_automations.py tests/e2e/scenarios/test_reborn_webui_v2_legacy_csp.pytests/e2e/.venv/bin/pytest tests/e2e/scenarios/test_reborn_webui_v2_legacy_*.py -q(159 passed in 152.24s)cargo build -p ironclaw_reborn_cli --features webui-v2-betaStacked after #5375.