一键导入
flutter-golden-testing
Step-by-step workflow for creating, configuring, and updating Flutter golden tests using the Alchemist package.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Step-by-step workflow for creating, configuring, and updating Flutter golden tests using the Alchemist package.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Process for creating mock data sources in the infrastructure layer.
Process for building, exporting, and registering reusable UI components in the packages/app_ui package. References design-to-code.md for design tokens (typography, colors, spacing).
Outlines the process for converting Figma designs into a structured, platform-aware Flutter implementation.
Use when completely removing the web platform from the project. Details how to delete directories/configurations, clean up app_ui web components, remove web-specific feature views (*_view_web.dart), prune conditional imports/logic, and run validation.
Use when asked to add, update, or group routes using GoRouter, or manage redirection guards.
Use when asked to create a new feature or sub-feature following the DDD-lite architecture, or set up state, view, and page layers for a domain.
| name | flutter-golden-testing |
| description | Step-by-step workflow for creating, configuring, and updating Flutter golden tests using the Alchemist package. |
This skill outlines the step-by-step process for implementing and updating golden tests for Flutter widgets.
alchemist is present in the dev_dependencies of pubspec.yaml. If it is missing, install it:
flutter pub add --dev alchemist
goldens/ directory adjacent to your target test file to store the generated .png reference files.Create the test file named [widget_name]_test.dart (or [widget_name]_golden_test.dart).
package:flutter_test/flutter_test.dart and package:alchemist/alchemist.dart).loadAppFonts() (if applicable) before running the tests to prevent text from rendering as the Ahem font.Implement the test using alchemist APIs instead of the standard testWidgets.
goldenTest: Define your test using the goldenTest function.CircularProgressIndicator).mocktail_image_network or network_image_mock).GoldenTestGroup and GoldenTestScenario to lay out all possible widget states (e.g., loading, success, error) and variations (light/dark mode, text scaling) within a single test execution.flutter test --update-goldens
.png files were correctly generated in the goldens/ directory.**/failures/ is in the project's .gitignore so test failure artifacts are not accidentally committed.If you are modifying an existing widget that already has golden tests, run the update command (flutter test --update-goldens) to regenerate the images. Never modify the .png files manually.