• keppo-bot[bot]'s avatar
    test: deflake setup and context E2E flows (#3319) · 30300641
    keppo-bot[bot] 提交于
    ## Summary
    - Deflake setup-flow E2E by clearing the fake OPENAI_API_KEY when a test
    explicitly wants the setup screen.
    - Update custom provider key setup to wait for the saved masked key UI
    instead of the raw secret text.
    - Wait for Smart Context settings persistence and give cloud sandbox
    undo enough time to finish snapshot reconciliation.
    
    ## Root cause
    Run: https://github.com/dyad-sh/dyad/actions/runs/25189808932
    
    The red setup-flow failure was caused by two test assumptions drifting
    from app behavior. The setup-screen fixture could inherit OPENAI_API_KEY
    from an earlier test in the same worker, causing the setup banner to
    disappear. The provider helper also waited for the full raw test API
    key, while the app now saves and renders the key masked as test...2345.
    
    Two retry-only flakes were separate E2E timing contracts: the Smart
    Context test sent the next dump prompt before the off setting was
    persisted, and cloud sandbox undo could still be syncing/restarting when
    the digest poll hit the LONG timeout.
    
    ## Why this fix is correct
    - Tests that opt into showSetupScreen now get an environment without the
    fake OpenAI key, matching the setup-screen contract.
    - The provider helper waits for the persisted saved-key state the UI
    actually exposes, without asserting raw secret text.
    - The Smart Context test waits on the settings file before sending the
    prompt that depends on it.
    - Cloud sandbox undo already uses EXTRA_LONG for preview startup;
    applying the same budget to undo reconciliation matches the slower cloud
    path seen in CI.
    
    ## Test plan
    - npm run fmt && npm run lint:fix && npm run ts
    - npm test
    - PYTHON=/usr/bin/python3 npm run build
    - PLAYWRIGHT_HTML_OPEN=never npm run e2e -- e2e-tests/setup_flow.spec.ts
    - PLAYWRIGHT_HTML_OPEN=never npm run e2e --
    e2e-tests/context_manage.spec.ts e2e-tests/cloud_sandbox.spec.ts
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    ---------
    Co-authored-by: 's avatarWill Chen <7344640+wwwillchen@users.noreply.github.com>
    30300641