eBay / flutter_glove_box

Various eBay tools for Flutter development
BSD 3-Clause "New" or "Revised" License
319 stars 68 forks source link

bug: multiScreenGoldens with autoHeight: true ignores device width #176

Open supposedlysam-bb opened 1 year ago

supposedlysam-bb commented 1 year ago

Is there an existing issue for this?

Steps to reproduce

  1. Create a new project with flutter create golden_toolkit_auto_height_bug
  2. Install latest golden_toolkit as a dev dependency (min version 0.15.0)
  golden_toolkit:
    dependency: "direct dev"
    description:
      name: golden_toolkit
      sha256: "8f74adab33154fe7b731395782797021f97d2edc52f7bfb85ff4f1b5c4a215f0"
      url: "https://pub.dev"
    source: hosted
    version: "0.15.0"
  1. Update test/widget_test.dart with provided group
  2. Run flutter test --update-goldens and compare the generated goldens

Expected results

Generated Goldens will be the same width as specified by the provided Device config

Actual results

Golden generated using autoHeight: true has a different width than the provided Device config

Code sample

widget_test.dart ```dart // This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:golden_toolkit/golden_toolkit.dart'; import 'package:golden_toolkit_auto_height_bug/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); group('goldens', () { const iphone10 = Device( size: Size(375, 812), devicePixelRatio: 3.0, name: 'iPhone_X', ); setUpAll(loadAppFonts); testGoldens('autoHeight: false', (tester) async { await tester.pumpWidgetBuilder( const MyApp(), wrapper: materialAppWrapper(), surfaceSize: const Size(3000, 3000), ); await multiScreenGolden( tester, 'counter.autoHeight_false', devices: [iphone10], autoHeight: false, ); }); testGoldens('autoHeight: true', (tester) async { await tester.pumpWidgetBuilder( const MyApp(), wrapper: materialAppWrapper(), surfaceSize: const Size(3000, 3000), ); await multiScreenGolden( tester, 'counter.autoHeight_true', devices: [iphone10], autoHeight: true, ); }); }); } ```

Screenshots

Screenshots | autoHeight: false | autoHeight: true | |--------------|--------------| | ![counter autoHeight_false iPhone_X](https://github.com/eBay/flutter_glove_box/assets/61704697/2c8b4b44-c153-4972-9625-3e9d50b1c6ce) | ![counter autoHeight_true iPhone_X](https://github.com/eBay/flutter_glove_box/assets/61704697/11d75559-9364-4bf1-888a-36e4d2fa507d) |

Flutter Doctor Verbose output

Doctor output ```console [✓] Flutter (Channel stable, 3.10.5, on macOS 13.4.1 22F82 darwin-x64, locale en-US) • Flutter version 3.10.5 on channel stable at /Users/supposedlysam/fvm/versions/3.10.5 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 796c8ef792 (5 weeks ago), 2023-06-13 15:51:02 -0700 • Engine revision 45f6e00911 • Dart version 3.0.5 • DevTools version 2.23.1 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1) • Android SDK at /Users/supposedlysam/Library/Android/sdk • Platform android-34, build-tools 33.0.0-rc1 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E300c • CocoaPods version 1.12.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.80.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.68.0 [✓] VS Code (version 1.81.0-insider) • VS Code at /Users/supposedlysam/Applications/Visual Studio Code - Insiders.app/Contents • Flutter extension version 3.68.0 [✓] Connected device (3 available) • macOS (desktop) • macos • darwin-x64 • macOS 13.4.1 22F82 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.198 [✓] Network resources • All expected network resources are available. • No issues found! ```