From 87fb2e7e20cd936b4f5766952d01730ad7f3ecf6 Mon Sep 17 00:00:00 2001 From: Corey Sprague Date: Fri, 30 Oct 2020 11:28:20 -0700 Subject: [PATCH] revving version #, updating changelog, and cleaning up one stale piece of info from the documentation --- packages/golden_toolkit/CHANGELOG.md | 32 ++++++++++++-------- packages/golden_toolkit/README.md | 12 ++------ packages/golden_toolkit/example/pubspec.lock | 2 +- packages/golden_toolkit/pubspec.yaml | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/golden_toolkit/CHANGELOG.md b/packages/golden_toolkit/CHANGELOG.md index 7aa39b9..5f6d567 100644 --- a/packages/golden_toolkit/CHANGELOG.md +++ b/packages/golden_toolkit/CHANGELOG.md @@ -1,19 +1,27 @@ # Changelog +## 0.7.0 + +Thanks to @moonytoes29 for the following enhancements: + +A new helper widget `DeviceBuilder` has been added. This works conceptually similar to `GoldenBuilder` but is used for displaying multiple device renderings of a widget in a single golden. This is an alternative to the existing `multiScreenGolden()` API which captures separate golden images for each device variation under test. + +To assist with usage of `DeviceBuilder`, there is a new helper API: `tester.pumpDeviceBuilder(builder)` which assists in easily pumping a DeviceBuilder widget in your tests. Check out the documentation for more details. + ## 0.6.0 -Added the ability to configure the default set of devices to use for ```multiScreenGolden``` assertions globally. +Added the ability to configure the default set of devices to use for `multiScreenGolden` assertions globally. For example: -```GoldenToolkitConfiguration(defaultDevices: [Device.iphone11, Device.iphone11.dark()])``` +`GoldenToolkitConfiguration(defaultDevices: [Device.iphone11, Device.iphone11.dark()])` -As part of this, the default parameter value has been removed from ```multiScreenGolden```. +As part of this, the default parameter value has been removed from `multiScreenGolden`. There was also a minor breaking change in that the const constructor of GoldenToolkitConfiguration is no longer const. ## 0.5.1 -Improved the reliability of the default behavior for ```tester.waitForAssets()``` to handle additional cases. +Improved the reliability of the default behavior for `tester.waitForAssets()` to handle additional cases. ## 0.5.0 @@ -23,7 +31,7 @@ A new mechanism has been added for ensuring that images have been decoded before This may be a breaking change for some consumers. If you run into issues, you can revert to the old behavior, by applying the following configuration: -```GoldenToolkitConfiguration(primeAssets: legacyPrimeAssets);``` +`GoldenToolkitConfiguration(primeAssets: legacyPrimeAssets);` Additionally, you can provide your own implementation that extends the new default behavior: @@ -48,7 +56,7 @@ GoldenToolkit.runWithConfiguration((){/* callback() */}, config: GoldenToolkitCo ### Added the ability to customize the generated filenames -When using ```screenMatchesGolden``` or ```multiGoldenFile```, you can now supply your own functions for controlling the naming of the files. This can be done using the configuration API mentioned above. +When using `screenMatchesGolden` or `multiGoldenFile`, you can now supply your own functions for controlling the naming of the files. This can be done using the configuration API mentioned above. ```dart GoldenToolkit.runWithConfiguration((){ /* callback() */}, config: GoldenToolkitConfiguration(fileNameFactory: (filename) => '' /*output filename*/)); @@ -56,8 +64,8 @@ GoldenToolkit.runWithConfiguration((){ /* callback() */}, config: GoldenToolkitC There are two methods that can be overridden: -* ```fileNameFactory``` is used for screenMatchesGolden -* ```deviceFileNameFactory``` is used for multiScreenGolden +- `fileNameFactory` is used for screenMatchesGolden +- `deviceFileNameFactory` is used for multiScreenGolden Future releases will likely consolidate these APIs. @@ -65,9 +73,9 @@ Thanks to @christian-muertz for this enhancement. ### Added additional utility functions for preparing for goldens -Extracted out some public extension methods that were previously private implementation details of ```multiScreenGolden``` & ```screenMatchesGolden``` +Extracted out some public extension methods that were previously private implementation details of `multiScreenGolden` & `screenMatchesGolden` -Added the following extensions. These can be used with any vanilla golden assertions and do not require ```multiScreenGolden```, ```screenMatchesGolden```, or ```GoldenBuilder```. +Added the following extensions. These can be used with any vanilla golden assertions and do not require `multiScreenGolden`, `screenMatchesGolden`, or `GoldenBuilder`. ```dart // configures the simulated device to mirror the supplied device configuration (dimensions, pixel density, safe area, etc) @@ -95,7 +103,7 @@ A few API / parameters were marked as deprecated and will be removed in future r ### Configuration API -Added a configuration API so that you can control the behavior of skipping golden assertions in a single location, rather than at each call to ```screenMatchesGolden``` or ```multiScreenGolden```. +Added a configuration API so that you can control the behavior of skipping golden assertions in a single location, rather than at each call to `screenMatchesGolden` or `multiScreenGolden`. You can now call: @@ -109,7 +117,7 @@ GoldenToolkit.configure(GoldenToolkitConfiguration(skipGoldenAssertion: () => /* ### Auto-Sized Goldens -A new optional parameter ```autoHeight``` has been added to ```screenMatchesGolden``` and ```multiScreenGolden```. If set to true, the height of the golden will adapt to fit the widget under test. Thanks to @christian-muertz! +A new optional parameter `autoHeight` has been added to `screenMatchesGolden` and `multiScreenGolden`. If set to true, the height of the golden will adapt to fit the widget under test. Thanks to @christian-muertz! ## 0.3.2 diff --git a/packages/golden_toolkit/README.md b/packages/golden_toolkit/README.md index dd4240c..33faa47 100644 --- a/packages/golden_toolkit/README.md +++ b/packages/golden_toolkit/README.md @@ -74,7 +74,6 @@ The output of this test will be this golden file: `weather_accessibility.png`: See tests for usage examples: [golden_builder_test.dart](example/test/golden_builder_test.dart) - ### DeviceBuilder DeviceBuilder class is like the GoldenBuilder except that it constrains scenario widget sizes to Device configurations. This removes the need @@ -83,9 +82,6 @@ to specify a column or grid based layout. It will generate a widget that lays out its scenarios vertically and the Device configurations of those scenarios horizontally. All in one single golden png file. -In the case of a single scenario the helper method of (#multiDeviceGolden) can simplify DeviceBuilder usage. For multiple scenarios, DeviceBuilder -can help - ```dart testGoldens('DeviceBuilder - multiple scenarios - with onCreate', (tester) async { @@ -142,7 +138,6 @@ This will generate the following golden: ![example widget captured](example/test/goldens/flutter_demo_page_multiple_scenarios.png) - ### multiScreenGolden The multiScreenGolden assertion is used to capture multiple goldens of a single widget using different simulated device sizes & characteristics. @@ -227,10 +222,7 @@ If you use VSCode, we highly recommend adding this configuration to your `.vscod "request": "launch", "type": "dart", "codeLens": { - "for": [ - "run-test", - "run-test-file" - ] + "for": ["run-test", "run-test-file"] }, "args": ["--update-goldens"] } @@ -358,7 +350,7 @@ See more usage examples here: [golden_builder_test.dart](test/golden_builder_tes There are global settings that can be configured by calling the following API: -```GoldenToolkit.runWithConfiguration()``` +`GoldenToolkit.runWithConfiguration()` Currently, the primary option is to allow consumers to holistically skip golden assertions. For example, perhaps you only want to perform golden assertions on certain platforms. diff --git a/packages/golden_toolkit/example/pubspec.lock b/packages/golden_toolkit/example/pubspec.lock index c124a8a..2468b44 100644 --- a/packages/golden_toolkit/example/pubspec.lock +++ b/packages/golden_toolkit/example/pubspec.lock @@ -66,7 +66,7 @@ packages: path: ".." relative: true source: path - version: "0.6.0" + version: "0.7.0" matcher: dependency: transitive description: diff --git a/packages/golden_toolkit/pubspec.yaml b/packages/golden_toolkit/pubspec.yaml index 33da5f6..71fe463 100644 --- a/packages/golden_toolkit/pubspec.yaml +++ b/packages/golden_toolkit/pubspec.yaml @@ -1,6 +1,6 @@ name: golden_toolkit description: Common patterns for screenshot-based widget testing using Goldens. -version: 0.6.0 +version: 0.7.0 homepage: https://github.com/eBay/flutter_glove_box/ repository: https://github.com/eBay/flutter_glove_box/tree/master/packages/golden_toolkit issue_tracker: https://github.com/eBay/flutter_glove_box/issues