본문으로 건너뛰기
cccskills
무료GitHub에 공개

tui-tests

Add or update tests for GitButler’s Ratatui terminal interfaces. It guides simulated key input, selection checks, SVG snapshots that record expected screen output, and commands for running tests or updating snapshots.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

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

설치 방법 보기

이럴 때 유용합니다

  • Test cursor movement and selection
  • Check screen output after key input
  • Update expected SVG snapshots
  • Run related tests after a change

포함된 파일(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.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

but

무료

Manage version control through GitButler’s but CLI. Select files or hunks, meaning sections of a diff, for commits; organize dependent branches, split or combine history, resolve conflicts, and create pull requests using task-specific command workflows.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Commit selected files or sections of a diff
  • Split, combine, or reorder commits
  • Arrange branches by dependency
gitbutlerapp/gitbutler2.2만2026년 10월 19일 업데이트

Review captured agent sessions related to a GitButler branch, pull request, or change. Start with a chronological overview of previous discussions and actions, then inspect specific turns when the rationale or supporting evidence needs clarification.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Catch up on previous work on the current branch
  • Review discussions related to a pull request
  • Understand the reasons behind earlier changes
gitbutlerapp/gitbutler2.2만2026년 10월 19일 업데이트

Create, update, run, and debug shell-based performance scenarios for the but CLI. It separates repository setup from the operation being measured, uses Hyperfine for timing, and guides focused validation and inspection of test output.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Add a performance scenario for a but CLI operation
  • Update repository fixtures for an existing benchmark
  • Run a short benchmark for one scenario
gitbutlerapp/gitbutler2.2만2026년 10월 19일 업데이트

Implement or modify GitButler’s but commands using its established structure. It covers typed arguments, input validation, execution, and human-readable, shell, or JSON output, while keeping operations usable from the terminal interface.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Add a new but command
  • Define arguments for branches and commits
  • Separate input validation from execution
gitbutlerapp/gitbutler2.2만2026년 10월 19일 업데이트

Update visible interfaces in Lite and but.dev using @gitbutler/ui-react. It guides component reuse, relevant design references, concise screen text, and visual checks in light and dark themes for forms, dialogs, notifications, and other surfaces.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Add forms or confirmation dialogs
  • Improve empty states and notifications
  • Rewrite labels and hints
gitbutlerapp/gitbutler2.2만2026년 10월 19일 업데이트

Prevent and investigate excessive rendering in Lite React screens. It guides data transformations, context use, and store subscriptions, then checks compiler output and measures rendering time before and after changes to verify their effect.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Investigate lag when selecting rows in Lite
  • Review data transformations during rendering
  • Design narrower context and store subscriptions
gitbutlerapp/gitbutler2.2만2026년 10월 19일 업데이트

gitbutlerapp의 스킬 모두 보기

이 스킬의 문제 신고