locale_sweep 0.4.0
locale_sweep: ^0.4.0 copied to clipboard
A CI quality gate for Flutter localization. Runs app flows across locales, device sizes, text scales, and RTL modes, then reports broken screens with screenshot proof.
Changelog #
0.4.0 #
Parallel sharding #
- Added
--shards N --shard-index ICLI flags for splitting variant matrices across CI jobs. - Flags pass through to
flutter test --total-shards/--shard-indexfor native Flutter test sharding. - Added
mergecommand to combine shard reports into a single HTML/Markdown/JSON report. - Merge supports
--github-prand--fail-onflags for CI integration.
Monorepo support #
- Added
scancommand to auto-discover packages containingtest/sweep/directories. - Auto-discovery checks for
melos.yamlfirst (parses package globs), then scans recursively. - Added
--packages apps/auth,apps/dashboardflag to run sweep across multiple packages. - Per-package reports are generated and merged into a single aggregate report.
Landscape viewport presets #
- Added 4 landscape presets:
phoneSmallLandscape(667x375),phoneLandscape(852x393),phoneWideLandscape(915x412),tabletLandscape(1024x768).
CLI improvements #
- Extracted CLI parsing logic into testable
cli_parser.dartlibrary. - Added real-time progress indicator — shows pass/fail counts during
flutter testruns. - Added environment variable overrides for all config values (
LOCALE_SWEEP_LOCALES,LOCALE_SWEEP_TOLERANCE, etc.) for CI without modifying YAML. - Added
setUpcallback tosweepTest()for loading custom fonts before the sweep group.
Bug fixes #
- Fixed ARB analyzer false positives on ICU plural/select syntax (
{count, plural, ...},{gender, select, ...}). - Fixed CLI crash when running
dart run locale_sweep— extractedDiffResultandOverflowErrorinto pure-Dart files to break transitivedart:uidependency chain. - Removed
httppackage dependency —GitHubReporternow usesdart:ioHttpClientdirectly.
Other #
- 55 new tests across 3 test files:
cli_parser_test.dart(43 tests),parallel_monorepo_test.dart(12 tests). - 283 tests total across 14 test files.
0.3.0 #
Screenshot diffing #
- Added pixel-level diff computation between golden and actual screenshots via
GoldenDiffer.computeDiff(). - Per-channel threshold of 2 absorbs anti-aliasing jitter — only real visual changes are flagged.
- Added
toleranceparameter tosweepTest()andlocale_sweep.yaml— screenshots within the tolerance pass even when pixels differ. Default0.0(exact match). SweepGoldenComparatorwraps Flutter'sGoldenFileComparator, intercepts golden comparisons, computes diff, and applies tolerance automatically.- 3-panel side-by-side diff images generated on mismatch: Golden | Actual | Diff (identical pixels dimmed, changed pixels highlighted in magenta).
- Diff images saved to
.locale_sweep/diffs/with_diff.pngsuffix. DiffResultmodel withdiffPercent,changedPixels,totalPixels,diffImagePath— full JSON serialization.
Diff data in reports #
- Markdown failure table gains a Diff % column showing the pixel-diff percentage for each failing variant.
- HTML report shows a diff badge on cards with non-zero diff percentage.
- HTML report includes a "View diff image" link to the 3-panel comparison PNG.
- JSON report includes
diffobject in each result with full diff metrics.
Updated config #
- Added
tolerancekey tolocale_sweep.yaml(number, 0.0–100.0). - Config validation now handles
numtype for tolerance field. SweepResultgainsdifffield with full JSON round-trip support.sweepTest()gainstoleranceanddiffOutputDirparameters.
Other #
- Exported
DiffResult,GoldenDiffer, andSweepGoldenComparatorfrom barrel file. - 35 new tests across 2 test files:
golden_diff_test.dart(19 unit tests) andscreenshot_diff_e2e_test.dart(16 end-to-end tests). - 202 tests total across 11 test files.
0.2.0 #
Dark mode testing #
- Added
darkModeparameter tosweepTest()— set totrueto test every variant in both light and dark brightness. - Added
lightTheme/darkThemeparameters — pass your app'sThemeDatasoTheme.of(context)works correctly inside the builder. Defaults toThemeData.light()andThemeData.dark()when omitted. - Added
dark_mode: truesupport inlocale_sweep.yamlconfig. SweepVariantgainsisDarkandbrightnessproperties.- Dark variants include "Dark" in
displayLabeland "dark" in file-safelabel.
Variant exclusion #
- Added
skipcallback tosweepTest()— returntrueto exclude specific locale/scale/viewport/brightness combinations from the test matrix. - Skipped variants show as
~(skipped) in Flutter test output, not failures.
Interactive HTML report #
- Added
ReportGenerator.generateHtml()— self-contained HTML dashboard with dark theme, no external dependencies. - Summary cards: total, passed, failed, overflows, ARB issues at a glance.
- Interactive filters: filter by status (pass/fail), locale, and flow.
- Screenshot gallery: cards grouped by flow with golden images, pass/fail badges, and issue details.
- Dark mode and RTL badges on variant cards.
- Locale summary table with failure row highlighting.
- CLI now outputs
report.htmlalongsidereport.mdandreport.json.
CI control #
- Added
--fail-onCLI flag — comma-separated categories (overflow,arb,golden,all,none) that control which issues trigger a non-zero exit code. - Added
screenshotLinkBuilderparameter toReportGenerator.generateMarkdown()— customize how screenshot paths render in PR comments.
Config validation #
SweepConfig.load()now warns on stderr about unknown keys (likely typos) and type mismatches.- Invalid YAML, empty files, and wrong types fall back to defaults with clear warning messages.
File-based result sink #
- Each
sweepTest()flow writes results to.locale_sweep/results/{flowName}.json— isolate-safe, no global state. - CLI reads result files for full overflow and ARB data instead of parsing
--machineoutput.
Other #
- Brightness field added to
SweepResult.toJson()/fromJson()serialization. - Comprehensive integration test covering all new features (167 tests total).
- Rewritten README with full documentation for every feature.
0.1.7 #
- Updated README with variantBody examples, SweepVariant API docs, untranslated detection docs.
0.1.6 #
- Auto-published on 2026-09-03.
0.1.5 #
- Expanded RTL locale detection: 10 locales (ar, he, fa, ur, ku, ps, yi, dv, sd, ug) with subtag support (e.g. ar_EG).
- CLI now reads
locale_sweep.yamlconfig file via--configflag. - CLI uses
GitHubReporterfor PR comments instead of duplicate HTTP logic. - Added
variantBodycallback tosweepTest()for locale-aware test interactions. - Added
ArbIssueType.untranslateddetection for strings identical to the base locale.
0.1.4 #
- Fixed Dart SDK constraint from ^3.11.5 to ^3.8.0 for broader compatibility.
- Centered title and badges on pub.dev README.
- Updated CI workflows to Flutter 3.41.9.
0.1.3 #
- Rewrote README for pub.dev compatibility — pure Markdown, proper image alignment.
- Added CI and auto-publish GitHub Actions workflows.
0.1.2 #
- Updated README with professional layout and screenshot gallery.
- Fixed GitHub repository URLs in pubspec.yaml.
0.1.1 #
- Add dartdoc comments to all public API elements.
- Add
example/example.dartfor pub.dev example tab. - Real-world validation: tested against Spotube (48k stars) and wger (960 stars).
0.1.0 #
- Initial release.
sweepTest()generateslocales × textScales × viewportstest matrix.OverflowDetectorcaptures RenderFlex overflow with pixel counts.ArbAnalyzerdetects missing ARB keys and placeholder mismatches.- Golden screenshot comparison (
runvsupdatecommands). - Markdown and JSON report generation.
- GitHub PR comment integration.
- Built-in viewport presets: phone, phoneSmall, phoneWide, tablet.
- RTL auto-detection for Arabic, Hebrew, and Farsi.