Betterment / alchemist

A Flutter tool that makes golden testing easy.
MIT License
268 stars 36 forks source link

fix: Alchemist doesn't run on Flutter 3.13.0 #94

Closed Arthurius closed 1 year ago

Arthurius commented 1 year ago

Is there an existing issue for this?

Version

0.6.1

Description

Running Alchemist golden tests in Flutter 3.13.0 throws an error:

: Error: A value of type 'void Function(String, Future<void> Function(WidgetTester), {int? retry, bool semanticsEnabled, bool? skip, dynamic tags, Timeout? timeout, TestVariant<Object?> variant})' can't be assigned to a variable of type 'FutureOr<void> Function(String, Future<void> Function(WidgetTester), {Duration? initialTimeout, bool semanticsEnabled, bool? skip, dynamic tags, Timeout? timeout, TestVariant<Object?> variant})'.
golden_test_adapter.dart:53
 - 'Future' is from 'dart:async'.
- 'WidgetTester' is from 'package:flutter_test/src/widget_tester.dart' ('../../../../Development/flutter/packages/flutter_test/lib/src/widget_tester.dart').
widget_tester.dart:1
- 'Timeout' is from 'package:test_api/src/backend/configuration/timeout.dart' ('../../../../.pub-cache/hosted/pub.dev/test_api-0.6.0/lib/src/backend/configuration/timeout.dart').
timeout.dart:1
- 'TestVariant' is from 'package:flutter_test/src/widget_tester.dart' ('../../../../Development/flutter/packages/flutter_test/lib/src/widget_tester.dart').
widget_tester.dart:1
 - 'Object' is from 'dart:core'.
 - 'Duration' is from 'dart:core'.
TestWidgetsFn defaultTestWidgetsFn = testWidgets;

Steps to reproduce

  1. start an empty template project
  2. add the Alchemist dev dependency
  3. add a test from the examples
    
    import 'package:alchemist/alchemist.dart';
    import 'package:flutter/material.dart';
    import 'package:flutter_test/flutter_test.dart';

void main() { group('ListTile Golden Tests', () { goldenTest( 'renders correctly', fileName: 'list_tile', builder: () => GoldenTestGroup( scenarioConstraints: const BoxConstraints(maxWidth: 600), children: [ GoldenTestScenario( name: 'with title', child: ListTile( title: Text('ListTile.title'), ), ), GoldenTestScenario( name: 'with title and subtitle', child: ListTile( title: Text('ListTile.title'), subtitle: Text('ListTile.subtitle'), ), ), GoldenTestScenario( name: 'with trailing icon', child: ListTile( title: Text('ListTile.title'), trailing: Icon(Icons.chevron_right_rounded), ), ), ], ), ); }); }


4. Run

### Expected behavior

Tests should run (and fail without adding the golden files first)

### Screenshots

![Screenshot 2023-08-17 at 10 34 30](https://github.com/Betterment/alchemist/assets/4608671/a74308ff-7c3d-4a90-9bff-c7b547f4e1ee)

### Additional context and comments

_No response_
jeroen-meijer commented 1 year ago

Thanks for creating this issue!

@Kirpal @samandmoore I'll research this issue and provide a PR with my findings and a fix.

ABausG commented 1 year ago

I also noticed this and opened a PR for it https://github.com/Betterment/alchemist/pull/95

ilyachange commented 1 year ago

Any updates on this? 🙏

Arthurius commented 1 year ago

Any update on when this fix will be released? Thanks!

Kirpal commented 1 year ago

@Arthurius it's out now 🙂