Skip to content

test: make session resume E2E retries reliable - #10588

Merged
Light2Dark merged 2 commits into
mainfrom
codex/fix-flaky-shutdown-e2e
Aug 21, 2026
Merged

test: make session resume E2E retries reliable#10588
Light2Dark merged 2 commits into
mainfrom
codex/fix-flaky-shutdown-e2e

Conversation

@Light2Dark

@Light2Dark Light2Dark commented Aug 19, 2026

Copy link
Copy Markdown
Member

📝 Summary

The shutdown resume E2E test could connect to the shared edit server even though its fixture configured a dedicated port. Failed attempts also left resumable sessions behind, while page-wide text assertions raced with the restored form DOM.

This routes explicitly ported edit fixtures to their dedicated server and makes the resume test establish clean retry state before asserting exact output within the resumed cell. This keeps the test focused on session restoration and prevents stale sessions or duplicate locators from affecting retries.

📋 Pre-Review Checklist

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes (optional).

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

Written by GPT-5 on Codex Desktop

@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview Aug 19, 2026 6:59am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Light2Dark Light2Dark added the internal A refactor or improvement that is not user facing label Aug 19, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

Architecture diagram
sequenceDiagram
    participant Test as Playwright Test
    participant Config as playwright.config.ts
    participant App as Marimo App Server
    participant Page as Browser Page
    participant Kernel as Python Kernel

    Note over Test,Config: Test Setup - Resolve App URL
    Test->>Config: getAppUrl("shutdown.py")
    Config->>Config: Look up server options

    alt Edit command with dedicated port configured
        Config->>Config: Use dedicated port URL
        Config-->>Test: Return http://localhost:<dedicated-port>
    else Edit command without dedicated port
        Config->>Config: Use shared EDIT_PORT with ?file= query param
        Config-->>Test: Return shared port URL
    end

    Note over Test,Page: Session Resume Flow
    Test->>Page: Navigate to app URL
    Test->>Page: maybeRestartKernel()
    Page->>Kernel: Restart kernel if needed (clean state)

    Page->>Kernel: Execute shutdown.py
    Kernel-->>Page: Render form with initial output 'None'

    Test->>Page: Wait for "'None'" text visible
    Test->>Page: Fill form textbox with "12345"
    Page->>Kernel: Submit form via button click
    Kernel-->>Page: Process form data, render output

    alt Output rendering
        Page-->>Test: Show "'12345'" in second cell (exact match)
        Page-->>Test: Show "54321" in second cell (exact match)
    end

    Test->>Page: Reload page
    Page->>Kernel: Reconnect to existing session (resume)
    Kernel-->>Page: Restore form state and output cells

    Test->>Page: Wait for "You have reconnected to an existing session." visible

    alt Session data preserved after reload
        Page->>Kernel: Query resumed session state
        Kernel-->>Page: Return restored values
        Page-->>Test: Show "'12345'" in second cell (exact match)
        Page-->>Test: Show "54321" in second cell (exact match)
    end

    Test->>Test: Take screenshot for evidence
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread frontend/e2e-tests/shutdown.spec.ts
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./frontend

Status Category Percentage Covered / Total
🔵 Lines 78.75% 81907 / 104006
🔵 Statements 78.75% 81907 / 104006
🔵 Functions 71.66% 703 / 981
🔵 Branches 79.36% 4931 / 6213
File CoverageNo changed files found.
Generated in workflow #20592 for commit e125382 by the Vitest Coverage Report Action

@Light2Dark
Light2Dark marked this pull request as ready for review August 19, 2026 06:38
Copilot AI lite review requested due to automatic review settings August 19, 2026 06:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves Playwright E2E reliability for the “shutdown session resume” scenario by ensuring explicitly ported edit-mode fixtures connect to their dedicated server, and by tightening the resume test’s setup/assertions to avoid stale session state and DOM races.

Changes:

  • Update getAppUrl to route edit fixtures with an explicit port directly to that server (instead of the shared edit server).
  • Make the shutdown “resume session” test reset retry state via maybeRestartKernel and assert resumed output more precisely within the target cell.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
frontend/playwright.config.ts Routes explicitly ported edit apps to their dedicated server URL to avoid cross-test session leakage.
frontend/e2e-tests/shutdown.spec.ts Stabilizes the resume-session E2E flow by restarting on resumed sessions and scoping assertions to the resumed cell.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread frontend/e2e-tests/shutdown.spec.ts Outdated
@Light2Dark
Light2Dark merged commit cad0f45 into main Aug 21, 2026
35 checks passed
@Light2Dark
Light2Dark deleted the codex/fix-flaky-shutdown-e2e branch August 21, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal A refactor or improvement that is not user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants