Repository: flutter
Issue: Integration Test - A SemanticsHandle was active at the end of the test. - Windows
Labels: framework,a: accessibility,platform-windows,a: error message,f: integration_test,P3,team-accessibility,triaged-accessibility

### Steps to reproduce

1. Create a new flutter project 
2. Add integration_test folder
3. Add to pubspec.yaml

  integration_test:
    sdk: flutter


4. add new test file with the following code

```dart
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized(); // Use the custom binding


  testWidgets('Empty test', (tester) async {
    await tester.pumpWidget(Container());
    await tester.pumpAndSettle();
  });
}
```

Run test in debug to see full error

### Expected results

Test runs successfuly.

### Actual results

On Macos the test runs fine.

On Windows I get the below error:

```console
Building Windows application...                                     8.9s
√ Built build\windows\x64\runner\Debug\flutter_integration_test_scemantics_barebones_test.exe
Connecting to VM Service at ws://127.0.0.1:53922/3R6gWPN4cBE=/ws

Connected to the VM Service.
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test:
A SemanticsHandle was active at the end of the test.
All SemanticsHandle instances must be disposed by calling dispose() on the SemanticsHandle.

When the exception was thrown, this was the stack:
#0      WidgetTester._verifySemanticsHandlesWereDisposed (package:flutter_test/src/widget_tester.dart:1075:7)
widget_tester.dart:1075
#1      WidgetTester._endOfTestVerifications (package:flutter_test/src/widget_tester.dart:1066:5)
widget_tester.dart:1066
#2      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1044:22)
binding.dart:1044
2
<asynchronous suspension>
(elided one frame from package:stack_trace)

The test description was:
  Empty test
════════════════════════════════════════════════════════════════════════════════════════════════════
```

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized(); // Use the custom binding


  testWidgets('Empty test', (tester) async {
    await tester.pumpWidget(Container());
    await tester.pumpAndSettle();
  });
}
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

Windows:

```console
[√] Flutter (Channel stable, 3.24.0, on Microsoft Windows [Version 10.0.22631.4037], locale en-GB)
    • Flutter version 3.24.0 on channel stable at C:\dev\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 80c2e84975 (3 weeks ago), 2024-07-30 23:06:49 +0700
    • Engine revision b8800d88be
    • Dart version 3.5.0
    • DevTools version 2.37.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\\AppData\Local\Android\sdk
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/windows-android-setup for more details.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.12.0 Preview 1.0)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Preview
    • Visual Studio Enterprise 2022 version 17.12.35209.166
    • The current Visual Studio installation is a pre-release version. It may not be supported by Flutter yet.
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Users\tmfdo\AppData\Local\Programs\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)

[√] IntelliJ IDEA Community Edition (version 2024.1)
    • IntelliJ at C:\Users\\AppData\Local\Programs\IntelliJ IDEA Community Edition
    • Flutter plugin version 80.0.2
    • Dart plugin version 241.17890.8

[√] IntelliJ IDEA Ultimate Edition (version 2023.3)
    • IntelliJ at C:\Users\\AppData\Local\Programs\IntelliJ IDEA Ultimate
    • Flutter plugin version 77.0.1
    • Dart plugin version 233.13135.65

[√] VS Code, 64-bit edition (version unknown)
    • VS Code at C:\Program Files\Microsoft VS Code Insiders
    • Flutter extension version 3.95.20240801
    X Unable to determine VS Code version.

[√] VS Code (version 1.93.0-insider)
    • VS Code at C:\Users\\AppData\Local\Programs\Microsoft VS Code Insiders
    • Flutter extension version 3.95.20240801

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.4037]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 127.0.6533.120
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 127.0.2651.105

[√] Network resources
    • All expected network resources are available.
```

Macos:

```console
[✓] Flutter (Channel stable, 3.24.0, on macOS 15.1 24B5024e darwin-arm64, locale en-GB)
    • Flutter version 3.24.0 on channel stable at /Users//dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 80c2e84975 (3 weeks ago), 2024-07-30 23:06:49 +0700
    • Engine revision b8800d88be
    • Dart version 3.5.0
    • DevTools version 2.37.2

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users//Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B5001e
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Users//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.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Community Edition (version 2024.1.4)
    • IntelliJ at /Users//Applications/IntelliJ IDEA Community Edition.app
    • Flutter plugin version 81.0.2
    • Dart plugin version 241.18808

[✓] VS Code (version 1.93.0-insider)
    • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents
    • Flutter extension version 3.95.20240801

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 15.1 24B5024e darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 15.1 24B5024e darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 127.0.6533.120

[✓] Network resources
    • All expected network resources are available.
```

</details>