Repository: flutter
Issue: Calling TextEditingController.clear() prevents changing text with WidgetTester.enterText() 
Labels: a: tests,tool,platform-web,f: integration_test,has reproducible steps,P2,found in release: 3.7,found in release: 3.8,team-web,triaged-web

## Steps to Reproduce

I wrote simple to understand example which represents an issue. Example contains TextField and button which clears this textfield. Also I wrote integration test for this app. This test type text to field, then reset field and type another text to it. In flutter 3.3.1 it works fine, but in flutter 3.7.1 test fails.


**Expected results:** All tests passed

<details>
  <summary>Actual results:</summary>

```
flutter_delay flutter drive --driver=test_driver/integration_test.dart --target=integration_test/main_test.dart --device-id=chrome
Running "flutter pub get" in flutter_delay...
Resolving dependencies... 
  archive 3.3.2 (3.3.6 available)
  collection 1.17.0 (1.17.1 available)
  js 0.6.5 (0.6.7 available)
  matcher 0.12.13 (0.12.14 available)
  meta 1.8.0 (1.9.0 available)
  path 1.8.2 (1.8.3 available)
  test_api 0.4.16 (0.4.18 available)
  vm_service 9.4.0 (10.1.2 available)
  webdriver 3.0.1 (3.0.2 available)
Got dependencies!
Launching integration_test/main_test.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...             19,2s
This app is linked to the debug service: ws://127.0.0.1:59438/WmmFxpTY_eQ=/ws
Debug service listening on ws://127.0.0.1:59438/WmmFxpTY_eQ=/ws

💪 Running with sound null safety 💪
00:00 +0: main test
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: exactly one matching node in the widget tree
  Actual: _TextFinder:<zero widgets with text "another text" (ignoring offstage widgets)>
   Which: means none were found but one was expected

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49  throw_
packages/test_api/src/expect/expect.dart 134:31                               fail
packages/test_api/src/expect/expect.dart 129:3                                _expect
packages/test_api/src/expect/expect.dart 46:3                                 expect$
packages/flutter_test/src/widget_tester.dart 460:16                           expect$
main_test.dart 23:5                                                           <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50            <fn>
dart-sdk/lib/async/zone.dart 1406:47                                          _rootRunUnary
dart-sdk/lib/async/zone.dart 1307:19                                          runUnary
dart-sdk/lib/async/future_impl.dart 147:18                                    handleValue
dart-sdk/lib/async/future_impl.dart 767:44                                    handleValueCallback
dart-sdk/lib/async/future_impl.dart 796:13                                    _propagateToListeners
dart-sdk/lib/async/future_impl.dart 567:5                                     [_completeWithValue]
dart-sdk/lib/async/future_impl.dart 640:7                                     <fn>
dart-sdk/lib/async/zone.dart 1398:13                                          _rootRun
dart-sdk/lib/async/zone.dart 1300:19                                          run
dart-sdk/lib/async/zone.dart 1208:7                                           runGuarded
dart-sdk/lib/async/zone.dart 1248:23                                          callback
dart-sdk/lib/async/schedule_microtask.dart 40:11                              _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5                               _startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15           <fn>

The test description was:
  main test
════════════════════════════════════════════════════════════════════════════════════════════════════
00:04 +0: main test [E]
  Test failed. See exception logs above.
  The test description was: main test

00:04 +0 -1: (tearDownAll)
00:04 +1 -1: Some tests failed.
Failure Details:
Failure in method: main test
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════
The following TestFailure was thrown running a test:
Expected: exactly one matching node in the widget tree
  Actual: _TextFinder:<zero widgets with text "another text"
(ignoring offstage widgets)>
   Which: means none were found but one was expected

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49  throw_
packages/test_api/src/expect/expect.dart 134:31                               fail
packages/test_api/src/expect/expect.dart 129:3                                _expect
packages/test_api/src/expect/expect.dart 46:3                                 expect$
packages/flutter_test/src/widget_tester.dart 460:16                           expect$
main_test.dart 23:5                                                           <fn>
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50            <fn>
dart-sdk/lib/async/zone.dart 1406:47                                          _rootRunUnary
dart-sdk/lib/async/zone.dart 1307:19                                          runUnary
dart-sdk/lib/async/future_impl.dart 147:18                                    handleValue
dart-sdk/lib/async/future_impl.dart 767:44                                    handleValueCallback
dart-sdk/lib/async/future_impl.dart 796:13                                    _propagateToListeners
dart-sdk/lib/async/future_impl.dart 567:5                                     [_completeWithValue]
dart-sdk/lib/async/future_impl.dart 640:7                                     <fn>
dart-sdk/lib/async/zone.dart 1398:13                                          _rootRun
dart-sdk/lib/async/zone.dart 1300:19                                          run
dart-sdk/lib/async/zone.dart 1208:7                                           runGuarded
dart-sdk/lib/async/zone.dart 1248:23                                          callback
dart-sdk/lib/async/schedule_microtask.dart 40:11                              _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5                               _startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15           <fn>

The test description was:
  main test
═════════════════════════════════════════════════════════════════

end of failure 1



Application finished.
```

</details>


<details>
<summary>main.dart</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final TextEditingController controller = TextEditingController();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          TextField(controller: controller),
          TextButton(
            onPressed: () {
              controller.clear();
            },
            child: const Text('reset'),
          ),
        ],
      ),
    );
  }
}
```
</details>

<details>
<summary>test_driver/integration_test.dart</summary>

```dart
import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();
```
</details>


<details>
<summary>integration_test/main_test.dart</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter_delay/main.dart' as app;
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  
  testWidgets('main test', (WidgetTester wt) async {
    await wt.pumpWidget(const app.MyApp());
    await wt.pumpAndSettle();
    
    await wt.enterText(find.byType(TextField), 'text');
    await wt.pumpAndSettle();
    expect(find.text('text'), findsOneWidget);
    
    await wt.tap(find.byType(TextButton));
    await wt.pumpAndSettle();
    
    await wt.enterText(find.byType(TextField), 'another text');
    await wt.pumpAndSettle();
    expect(find.text('another text'), findsOneWidget);
  });
}
```
</details>

<details>
  <summary>Logs</summary>

```
➜  flutter_delay flutter analyze
Analyzing flutter_delay...                                              
No issues found! (ran in 1.2s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
➜  flutter_delay flutter doctor -v
[✓] Flutter (Channel stable, 3.7.1, on macOS 12.6 21G115 darwin-x64, locale ru-RU)
    • Flutter version 3.7.1 on channel stable at /Users/dmitrijrepin/sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7048ed95a5 (5 days ago), 2023-02-01 09:07:31 -0800
    • Engine revision 800594f1f4
    • Dart version 2.19.1
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
    • Android SDK at /Users/dmitrijrepin/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0-rc2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • 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 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2022.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • 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

[✓] VS Code (version 1.75.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.58.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 12.6 21G115 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 109.0.5414.119

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

</details>

To reproduse the issue, please follow [this instruction](https://docs.flutter.dev/cookbook/testing/integration/introduction) to run integration test for web.