用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/gitbutlerapp/gitbutler --skill tui-tests命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
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.
Use when asked to add before/after screenshots of a Lite UI change to a pull request, when a PR touching apps/lite/ui needs its visual change shown, or when extending the screenshot catalogue in apps/lite/e2e/tests/screenshots.spec.ts. Captures both sides locally against seeded fixtures, publishes the surfaces that changed, and posts them to the PR.
Use when adding or modifying CLI command (`but` commands) under `crates/but/src`.
基于 SOC 职业分类
正在显示 SKILL.md
| name | tui-tests |
| description | Use when adding or modifying tests for one of GitButler's Ratatui TUIs |
crates/but/src/command/legacy/status/tui/tests/crates/but/src/tui/test_utils.rs and crates/but/src/command/legacy/status/tui/tests/utils.rscrates/but/src/command/legacy/status/tui/tests/snapshots/#[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"]);
}
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
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.
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.