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

widget-test

Add or update Flutter widget tests in this repository using the existing test layout, Riverpod provider overrides, generated localization, shared theme setup, and FVM test commands. Use when a task asks for widget tests, UI regression coverage, test coverage for a screen/component, or when implementation work changes visible Flutter behavior.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md4.2 KB

SKILL.md(原文)

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

Flutter Template Widget Tests

Use this skill when adding focused widget coverage for a screen, shared component, or UI state in this Flutter template.

Read First

  • AGENTS.md
  • docs/PROJECT_OVERVIEW.md
  • docs/PROJECT_GUIDELINES.md
  • Nearby tests under test/
  • The widget, provider, and state files being covered

When To Add Widget Tests

  • A shared widget gets new behavior, styling states, callbacks, or accessibility expectations.
  • A feature screen adds meaningful loading, empty, error, or success states.
  • A bug fix changes what the user sees or can tap.
  • A regression would be cheap to catch with a pumpWidget test.

Do not add broad snapshot-style tests that only restate the widget tree. Prefer behavior and contract checks: visible text, enabled/disabled states, callbacks, navigation events, empty/error rendering, and provider-driven state transitions.

Test Location

  • Shared UI: test/common/<widget_name>_test.dart
  • Feature UI: test/features/<feature>/<feature>_page_content_test.dart
  • Provider-heavy feature states may also need focused provider tests; keep them near the feature test folder unless the repo already has a stronger local pattern.

Harness Pattern

Call Configuration.setup(flavor: Flavor.develop) at the top of main() before any test runs — existing tests in test/common/ do this and widgets that read configuration fail without it.

Build the smallest wrapper that gives the widget the dependencies it expects:

Widget buildSubject({
  List<Override> overrides = const [],
}) {
  return ProviderScope(
    overrides: overrides,
    child: MaterialApp(
      localizationsDelegates: AppLocalizations.localizationsDelegates,
      supportedLocales: AppLocalizations.supportedLocales,
      theme: AppTheme.getThemeData(brightness: Brightness.light),
      home: const Scaffold(
        body: SubjectWidget(),
      ),
    ),
  );
}

Adapt imports to the current code. If the existing nearby tests use patrolWidgetTest, pumpWidgetAndSettle, or another helper, reuse that style instead of creating a parallel harness.

Riverpod Guidance

  • Wrap provider-dependent widgets in ProviderScope.
  • Override IO, auth, storage, and notifier providers rather than hitting real services.
  • Keep overrides explicit in each test group so state does not leak between tests.
  • For one-off event flows, assert the visible side effect when possible. If navigation/snackbars are difficult to observe directly, test the notifier event separately and keep the page listener thin.

Route And Localization Guidance

  • If the widget uses context.router, prefer an AutoRoute-aware harness or test the lower-level content widget instead of the route page.
  • If the widget reads context.locale, include generated localization delegates.
  • Add localization keys in assets/localization/app_en.arb and run make gen before relying on generated getters.

Workflow

  1. Read the widget and the closest existing tests.
  2. Pick the smallest test subject that still covers the behavior.
  3. Add or update test files under test/.
  4. Use tester.pumpWidget(...), tester.pump(), and tester.pumpAndSettle() intentionally; avoid arbitrary waits.
  5. Assert user-observable behavior with find, callback counters, and provider state.
  6. Run the narrow test file first:
    fvm flutter test test/path/to/file_test.dart
    
  7. Run the full test suite when the change touches shared UI or state:
    fvm flutter test
    

Completion Criteria

  • Tests are deterministic and isolated.
  • No real network, Firebase, storage, or platform side effects run during widget tests.
  • Test names describe behavior, not implementation details.
  • fvm flutter test or the relevant narrowed test command passes.

レビュー

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

同じリポジトリのスキル

概要と使いどころ

Build/test/lint verification pass for this Flutter app — runs codegen, analyze, test, then iOS + Android native builds in parallel, then `dart format`. Does NOT commit anything; leaves the working tree dirty so the user can review and commit on demand. Used at the end of the prd → techspec → tasks → implement-tasks-sequence flow before `pr-review`, and can also be invoked manually when the user says "verify build", "run full verification", or "check everything".

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

strvcom/flutter-template242026年6月18日 更新

create-pr

無料

Create or update a GitHub PR for this Flutter repository using gh CLI. Verifies the work with build-verify and pr-review, generates an inline PR description, commits pending changes when approved, pushes, and opens or updates the PR. Supports stacked PRs by asking for the base branch when detection is ambiguous. Use when the user says "create PR", "open PR", "push PR", or wants to submit their work for review.

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

strvcom/flutter-template242026年6月18日 更新

Build a full feature in this Flutter repository that includes backend or storage data flow: read API schema, create DTOs, map DTOs to entities, add Riverpod use cases, connect feature state, and render UI data. Use when a task goes beyond a screen and needs real data integration.

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

strvcom/flutter-template242026年6月18日 更新

Create a new Flutter screen in this repository using the existing feature structure, AutoRoute setup, Riverpod state pattern, and code generation workflow. Use when adding a new page, route, stateful screen, or feature folder in this template.

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

strvcom/flutter-template242026年6月18日 更新

implement

無料

Implement a single Flutter task following this repository's Riverpod, Freezed, AutoRoute, DTO/entity, codegen, and verification conventions. Reads the task definition, PRD, and tech spec, then executes the implementation. When invoked standalone, verifies the change; when invoked by implement-tasks-sequence, writes code only and leaves verification to start-job/build-verify. Use when the user says "implement task X", "work on task X", or wants to execute a specific task from the task list.

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

strvcom/flutter-template242026年6月18日 更新

Orchestrates implementation of all tasks for a feature using an agent team. Respects task dependencies, runs tasks in correct order, parallelizes independent tasks. Does NOT build, run tests, or commit at any point — verification is delegated to the caller (typically `/start-job`, which runs `build-verify` and `pr-review uncommitted` afterwards). Use when the user says "implement all tasks", "run the task sequence", "implement the feature", or wants to execute multiple tasks from a task list end-to-end.

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

strvcom/flutter-template242026年6月18日 更新

strvcom のスキルをすべて見る

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