Skip to content

Flutter goldens Android on windows not working #171126

@asaworld

Description

@asaworld

Steps to reproduce

Inside an integration test run using "flutter test integration_test/app_test.dart" on windows and an android emulator or physical device. I have tested this code on a mac with and iOS simulator and it works fine.

await expectLater(find.byWidget(appWidget), matchesGoldenFile("test.png"));

@matanlurey This might be in your wheelhouse as your name keeps popping up as I research the solution to this :-)

Expected results

Takes or compares a snapshot as part of the test

Actual results

01:24 +0 -1: loading C:/code/.../login_test.dart [E]
  Invalid argument(s): Uri c:/code/.../integration_test/login_test.dart must have scheme 'file:'.
  package:path/src/style/windows.dart 86:7                           WindowsStyle.pathFromUri
  package:path/src/context.dart 1040:40                              Context.fromUri
  package:file/src/interface/file_system.dart 158:24                 FileSystem.getPath
  package:file/src/backends/local/local_file_system.dart 26:54       LocalFileSystem.file
  package:flutter_tools/src/base/error_handling_io.dart 139:83       ErrorHandlingFileSystem.file
  package:flutter_tools/src/test/test_golden_comparator.dart 87:19   TestGoldenComparator._processForTestFile
  package:flutter_tools/src/test/test_golden_comparator.dart 153:56  TestGoldenComparator._compareGoldens
  ===== asynchronous gap ===========================
  package:flutter_tools/src/test/test_golden_comparator.dart 126:28  TestGoldenComparator.compare
  ===== asynchronous gap ===========================
  package:flutter_tools/src/test/flutter_platform.dart 559:17        FlutterPlatform._listenToVmServiceForGoldens.<fn>

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Counter App',
      home: Text('Counter App Home Page'),
    );
  }
}

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  group('end-to-end test', () {
    testWidgets('tap on the floating action button, verify counter', (
      tester,
    ) async {
      final appWidget = MyApp();
      await tester.pumpWidget(appWidget);
      await expectLater(find.byWidget(appWidget), matchesGoldenFile("test.png"));
    });
  });
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
flutter doctor -v                                              
[√] Flutter (Channel stable, 3.32.4, on Microsoft Windows [Version 10.0.26100.4351], locale en-US) [758ms]
    • Flutter version 3.32.4 on channel stable at C:\code\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6fba2447e9 (12 days ago), 2025-06-12 19:03:56 -0700
    • Engine revision 8cd19e509d
    • Dart version 3.8.1
    • DevTools version 2.45.1

[√] Windows Version (Windows 11 or higher, 24H2, 2009) [6.1s]

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [2.9s]
    • Android SDK at C:\Users\asade\AppData\Local\Android\Sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = C:\Users\asade\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web [224ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.14.2) [222ms]
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
    • Visual Studio Build Tools 2022 version 17.14.36121.58
    • Windows 10 SDK version 10.0.26100.0

[√] Android Studio (version 2024.2) [40ms]
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.11+0--11852314)

[√] VS Code (version 1.101.1) [35ms]
    • VS Code at C:\Users\asade\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.112.0

[√] Connected device (4 available) [476ms]
    • Pixel 3 (mobile)  • 019XS1UMP • android-arm64  • Android 12 (API 31)
    • Windows (desktop) • windows   • windows-x64    • Microsoft Windows [Version 10.0.26100.4351]
    • Chrome (web)      • chrome    • web-javascript • Google Chrome 137.0.7151.120
    • Edge (web)        • edge      • web-javascript • Microsoft Edge 137.0.3296.93

[√] Network resources [1,513ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: tests"flutter test", flutter_test, or one of our testsfound in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyplatform-windowsBuilding on or for Windows specificallyteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions