Skip to content

Two TUI tests scan the whole screen and fail on the cwd, session name or build changelog #1555

Description

@Kenmege

Two jcode-tui lib tests scan the whole rendered screen for a token, so their outcome depends on text unrelated to what they assert.

1. test_file_activity_scroll_reproduces_trailing_ghost_after_native_scroll_like_mutation

crates/jcode-tui/src/tui/app/tests/scroll_copy_01/part_01.rs uses 'Z' as the injected ghost marker, but both checks search the whole screen: !clean.contains('Z') before injection and scrolled.contains('Z') after. The status line and header render the working directory and the session name, so:

  • when the tests run from a path containing Z, or the random session name contains one, the pre-injection check fails;
  • in the same situation the post-scroll check passes even if the injected cells were repainted, so it no longer tests anything.

Reproduction (run the built lib test binary from a directory whose path contains Z; the test does not read the cwd otherwise):

cargo test -p jcode-tui --lib --no-run
mkdir -p /tmp/Zulu && cd /tmp/Zulu
COLORTERM=truecolor <path-to>/jcode_tui-<hash> --test-threads=1 \
  test_file_activity_scroll_reproduces_trailing_ghost_after_native_scroll_like_mutation
# panicked at .../scroll_copy_01/part_01.rs:707: ghost marker must not be present before injection
# the screen dump in the panic shows the Z-containing directory on the status line

The same binary passes from a directory without Z.

2. widgets_render_detail_layer_without_repeating_status_line_facts

crates/jcode-tui/src/tui/ui_tests/swarm_buffer.rs collects the text of every rounded box on screen and asserts that status-line facts such as "main", "OpenAI" or "29%" do not appear in it. The Updates box is also a rounded box, and it lists the latest commit subjects embedded at build time (JCODE_CHANGELOG). A build whose recent commit subjects contain one of those words fails the test. Pinning the Updates box to a single subject ci: keep main green with the existing set_unseen_changelog_entries_override_for_tests reproduces it:

"main" is a status-line fact and must not repeat in widgets:
 ╭─────── Updates ───────╮
 │ • ci: keep main green │
test result: FAILED. 0 passed; 1 failed

Expected

Both tests check only what they are about: the injected row for (1), and widget detail with the Updates box pinned empty for (2), as other UI tests already do with that override.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions