本文へ移動
cccskills
無料GitHub で公開

tui-tests

Use when adding or modifying tests for one of GitButler's Ratatui TUIs

インストール方法を見る

含まれるファイル(1)

  • SKILL.md2.9 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Where tests live

  • Main TUI tests: crates/but/src/command/legacy/status/tui/tests/
  • Test harness/helpers: crates/but/src/tui/test_utils.rs and crates/but/src/command/legacy/status/tui/tests/utils.rs
  • Snapshots: crates/but/src/command/legacy/status/tui/tests/snapshots/

Basic pattern

#[test]
fn describes_behavior_under_test() {
    let env = Sandbox::init_scenario_with_target_and_default_settings("one-stack").unwrap();
    env.setup_metadata(&["A"]).unwrap();

    let mut tui = test_status_tui(env);

    tui.input_then_render(KeyCode::Down)
        .assert_rendered_term_svg_eq(file!["snapshots/describes_behavior_under_test_001.svg"]);
}

Driving the TUI

Useful input examples:

tui.input_then_render(None);                                       // render without inputs
tui.input_then_render('j');                                        // single char input
tui.input_then_render(KeyCode::Down);                              // special key
tui.input_then_render(Shift('j'));                                 // keys with shift
tui.input_then_render(Control('j'));                               // keys with control
tui.input_then_render([KeyCode::Down, KeyCode::Down]);             // multiple keys from array
tui.input_then_render("commit message text");                      // multiple keys from string
tui.reload();                                                      // reload state after making external changes

Assertions

Generally prefer

  • assert_current_line_eq(str![...]) for cursor/selection behavior.
  • assert_rendered_term_svg_eq(file!["snapshots/test_function_name_001.svg"]) for everything else.

Generally you should include one assert_rendered_term_svg_eq per logical group of inputs, to catch bad states early.

Be careful using assert_rendered_contains and assert_rendered_not_contains since they might lead to false positives. They're intended to use while iterating on a test where snapshots would cause too much churn.

Read crates/but/src/tui/test_utils.rs and crates/but/src/command/legacy/status/tui/tests/utils.rs for more specialized assertions.

You're not allowed to add new kinds of assertions to crates/but/src/tui/test_utils.rs or crates/but/src/command/legacy/status/tui/tests/utils.rs. Rely entirely on the existing assertions.

Don't reuse snapshots from other tests. Give each test its own snapshots.

Avoid using tui.env().invoke_git("..."). Prefer performing operations via the TUI.

Running tests

  • cargo test -p but <test-name> to run one test.
  • SNAPSHOTS=overwrite cargo test -p but <test-name> to run and update snapshots.
  • cargo test -p but tui to run all tui tests. Do this after changing things.

If a test fails the output will include the rendered state of the test backend. This can be used when iterating on a test as a way of inspecting the state.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

but

無料

Commit, push, branch, and manage version control with GitButler. Use for commits, selective dirty-file or hunk commits, branches, diffs, PRs, history edits, squashes, amends, undo, merge, apply, and unapply. For selected dirty files or hunks, inspect with `but diff`; use compact `but status` for commit order, branch/stack placement, or conflict overview; use `but status -fv` when file/hunk IDs or per-commit file details matter. Replaces git write commands.

日本語の概要は準備中です。原文の説明を表示しています。

gitbutlerapp/gitbutler2.2万2026年10月11日 更新

Use for prompts like "get context for branch", "catch up on this branch", "recover branch context", or "what prior agent work happened here". Skim prior agent work from `but agentlog` captures for a GitButler branch, review / pull request / merge request, or change. Prefer this over generic git branch/diff inspection when the user asks for context, history, prior work, or branch catch-up.

日本語の概要は準備中です。原文の説明を表示しています。

gitbutlerapp/gitbutler2.2万2026年10月11日 更新

Use when creating, changing, running, or debugging shell-based `but` CLI performance scenarios under `crates/but/tests/performance`, including Hyperfine runs, fixture setup, setup-to-test state, and output inspection.

日本語の概要は準備中です。原文の説明を表示しています。

gitbutlerapp/gitbutler2.2万2026年10月11日 更新

Use when adding or modifying CLI command (`but` commands) under `crates/but/src`.

日本語の概要は準備中です。原文の説明を表示しています。

gitbutlerapp/gitbutler2.2万2026年10月11日 更新

Use when changing what users see in an app built on `@gitbutler/ui-react` — Lite, the but.dev web app — adding or restyling a component, modal, form, list, empty state or toast, or writing the words on screen. Not for logic, data or backend work, even inside a UI file.

日本語の概要は準備中です。原文の説明を表示しています。

gitbutlerapp/gitbutler2.2万2026年10月11日 更新

Use when working on React code in `apps/lite` that derives values during render, adds or consumes a context, subscribes to the redux store or a query, or renders lists of row components — and whenever the lite UI is reported slow, laggy, or re-rendering too much. React Compiler does not prevent these regressions; load this skill BEFORE writing such code, not only when debugging it.

日本語の概要は準備中です。原文の説明を表示しています。

gitbutlerapp/gitbutler2.2万2026年10月11日 更新

gitbutlerapp のスキルをすべて見る

このスキルの問題を報告する