{"id":13547883,"url":"https://github.com/bamlab/adaptive_test","last_synced_at":"2026-03-09T03:35:10.537Z","repository":{"id":56865995,"uuid":"520808276","full_name":"bamlab/adaptive_test","owner":"bamlab","description":"Devtools to write stunning widget test in Flutter. Made by Theodo Apps ❤️💙💛","archived":false,"fork":false,"pushed_at":"2025-10-08T15:23:20.000Z","size":15396,"stargazers_count":21,"open_issues_count":5,"forks_count":10,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-08T17:43:19.620Z","etag":null,"topics":["dart","flutter"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bamlab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-08-03T09:01:43.000Z","updated_at":"2025-09-16T11:02:11.000Z","dependencies_parsed_at":"2023-02-01T05:46:01.767Z","dependency_job_id":"7d0b25d2-f433-465e-a2d1-5932799284f8","html_url":"https://github.com/bamlab/adaptive_test","commit_stats":{"total_commits":39,"total_committers":4,"mean_commits":9.75,"dds":0.641025641025641,"last_synced_commit":"831b070e04b9acdcc28e0d07b239edb7a543d58a"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/bamlab/adaptive_test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bamlab%2Fadaptive_test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bamlab%2Fadaptive_test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bamlab%2Fadaptive_test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bamlab%2Fadaptive_test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bamlab","download_url":"https://codeload.github.com/bamlab/adaptive_test/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bamlab%2Fadaptive_test/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30281573,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T02:57:19.223Z","status":"ssl_error","status_checked_at":"2026-03-09T02:56:26.373Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","flutter"],"created_at":"2024-08-01T12:01:02.638Z","updated_at":"2026-03-09T03:35:05.525Z","avatar_url":"https://github.com/bamlab.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# Adaptive Test\n\n\u003cp\u003e\n  \u003ca href=\"https://apps.theodo.com\"\u003e\n  \u003cimg  alt=\"logo\" src=\"https://raw.githubusercontent.com/bamlab/theodo_analysis/main/doc/theodo_apps_white.png\" width=\"200\"/\u003e\n  \u003c/a\u003e\n  \u003c/br\u003e\n  \u003cp\u003eDevtools to write stunning widget test in Flutter.\u003c/br\u003e Made by \u003ca href=\"https://apps.theodo.com\"\u003eTheodo Apps\u003c/a\u003e ❤️💙💛.\u003c/p\u003e\n\u003c/p\u003e\n\n![Example](https://raw.githubusercontent.com/bamlab/adaptive_test/main/doc/example.png)\n\n## Table of Contents\n1. [Features](#features)\n2. [Getting Started](#getting-started)\n3. [Usage](#usage)\n   - [Rendering Custom Fonts](#rendering-custom-fonts)\n   - [Setting Up Test Devices](#setting-up-test-devices)\n   - [Configuring Difference Threshold](#configuring-difference-threshold)\n   - [Enforcing Test Platform](#enforcing-test-platform)\n   - [Writing a Test](#writing-a-test)\n4. [Migration Guide](#migration-guide)\n5. [Additional Information](#additional-information)\n\n## Features\n\nUse this package in your tests to:\n- Generate golden files for different devices during tests\n- Load fonts\n- Set window sizes and pixel density\n- Await image rendering\n- Render physical and system UI layers\n- Render a keyboard during tests\n- Set a preferred OS for running tests\n- Configure a difference tolerance threshold for file comparison\n\n## Getting Started\n\n1. Add `adaptive_test` to your dev dependencies.\n\n2. Create a `flutter_test_config.dart` file at the root of your `test` folder with a `testExecutable` function:\n\n```dart\nFuture\u003cvoid\u003e testExecutable(FutureOr\u003cvoid\u003e Function() testMain) async {\n  await testMain();\n}\n```\n\nFor more information, see the [official Flutter documentation](https://api.flutter.dev/flutter/flutter_test/flutter_test-library.html).\n\n## Usage\n\n### Rendering Custom Fonts\n\n1. Add your fonts to your app assets folders.\n2. Add your fonts to your Flutter assets in `pubspec.yaml`:\n\n```yaml\nflutter:\n  fonts:\n  - family: Roboto\n    fonts:\n      - asset: fonts/Roboto-Black.ttf\n```\n\n3. In your `flutter_test_config.dart`, call `loadFonts()`:\n\n```dart\nFuture\u003cvoid\u003e testExecutable(FutureOr\u003cvoid\u003e Function() testMain) async {\n  TestWidgetsFlutterBinding.ensureInitialized();\n  await loadFonts();\n  await testMain();\n}\n```\n\n\u003e ℹ️ `loadFonts()` loads fonts from `pubspec.yaml` and from every separate package dependency as well.\n\n### Setting Up Test Devices\n\n1. Define a set of device variants:\n\n```dart\nfinal defaultDeviceConfigs = {\n  iPhone16,\n  pixel9,\n};\n```\n\n2. Use the `AdaptiveTestConfiguration` singleton to set variants:\n\n```dart\nFuture\u003cvoid\u003e testExecutable(FutureOr\u003cvoid\u003e Function() testMain) async {\n  TestWidgetsFlutterBinding.ensureInitialized();\n  AdaptiveTestConfiguration.instance\n    ..setDeviceVariants(defaultDeviceConfigs);\n  await loadFonts();\n  await testMain();\n}\n```\n\n### Configuring Difference Threshold\n\nTo allow for small pixel differences between processors, add `setupFileComparatorWithThreshold()` to your `flutter_test_config.dart`:\n\n```dart\nFuture\u003cvoid\u003e testExecutable(FutureOr\u003cvoid\u003e Function() testMain) async {\n  TestWidgetsFlutterBinding.ensureInitialized();\n  AdaptiveTestConfiguration.instance\n    ..setDeviceVariants(defaultDeviceConfigs);\n  await loadFonts();\n  setupFileComparatorWithThreshold();\n  await testMain();\n}\n```\n\n### Enforcing Test Platform\n\nConfigure `AdaptiveTestConfiguration` to enforce a specific test platform:\n\n```dart\nFuture\u003cvoid\u003e testExecutable(FutureOr\u003cvoid\u003e Function() testMain) async {\n  TestWidgetsFlutterBinding.ensureInitialized();\n  AdaptiveTestConfiguration.instance\n    ..setEnforcedTestPlatform(TargetPlatform.macOS)\n    ..setDeviceVariants(defaultDeviceConfigs);\n  await loadFonts();\n  setupFileComparatorWithThreshold();\n  await testMain();\n}\n```\n\nTo skip tests instead of throwing an error on unintended platforms:\n\n```dart\nAdaptiveTestConfiguration.instance\n  ..setEnforcedTestPlatform(TargetPlatform.macOS)\n  ..setFailTestOnWrongPlatform(false)\n  ..setDeviceVariants(defaultDeviceConfigs);\n```\n\n### Writing a Test\n\nUse the `testAdaptiveWidgets` function:\n\n```dart\nvoid main() {\n  testAdaptiveWidgets(\n    'Test description',\n    (tester, variant) async {\n      await tester.pumpWidget(\n        AdaptiveWrapper(\n          windowConfig: variant,\n          tester: tester,\n          child: const App(),\n        ),\n      );\n\n      await tester.expectGolden\u003cApp\u003e(variant);\n    },\n  );\n}\n```\n\n## Migration Guide\n\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003eMigrating to version 0.7.x\u003c/summary\u003e\nVersion 0.7.0 introduces several breaking changes and new features:\n\n1. **Breaking Change**: `loadFonts()` no longer accepts a `packages` argument. `loadFontsFromPackage()` was removed.\n   - Update your `flutter_test_config.dart`:\n     ```dart\n     // Old\n     await loadFonts('my_package');\n     // or\n     await loadFontsFromPackage(\n       package: Package(\n         name: 'my_package',\n         relativePath: '../package',\n       ),\n     );\n\n     // New\n     await loadFonts();\n     ```\n   - `loadFonts()` now supports custom icon fonts like material_symbols_icons.\n\n2. **Breaking Change**: `WindowConfigData` now includes a `keyboardName` property.\n   - Update your custom device configurations to include this new property.\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003eMigrating to version 0.5.x\u003c/summary\u003e\n\nVersion 0.5.0 introduces a new default file name for goldens that's compatible with Windows file systems. To rename your existing golden files, use the following script:\n\n```bash\n#!/bin/bash\n\nrename_files_in_preview() {\n    find . -type d -name \"preview\" | while read -r dir; do\n        echo \"Processing directory: $dir\"\n        find \"$dir\" -type f | while read -r file; do\n            new_name=$(echo \"$file\" | sed 's/:/-/g')\n            if [ \"$file\" != \"$new_name\" ]; then\n                mv \"$file\" \"$new_name\"\n                echo \"Renamed $file to $new_name\"\n            fi\n        done\n    done\n}\n\nrename_files_in_preview\n```\n\nSave this script as a `.sh` file and run it from your project root directory.\n\n\u003c/details\u003e\n\n## Additional Information\n\nWe welcome feedback, issues, contributions, and suggestions! Feel free to contribute to the development of this package.\n\n👉 About Theodo Apps\n\nWe are a 130 people company developing and designing universal applications with React Native and Flutter using the Lean \u0026 Agile methodology. To get more information on the solutions that would suit your needs, feel free to get in touch by email or through or contact form!\n\nWe will always answer you with pleasure 😁\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbamlab%2Fadaptive_test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbamlab%2Fadaptive_test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbamlab%2Fadaptive_test/lists"}