Repository: flutter
Issue: [integration_test] [web] Screenshot Testing Still Broken
Labels: a: tests,team,platform-web,f: integration_test,P2,c: tech-debt,team-web,triaged-web

(This is a continuation of #117077)

Screenshot testing is still breaking in the web platform.

The latest error discovered by @kenzieschmoll happens when the `onScreenshot` function returns `false` to indicate that the screenshot is not correct; that triggers a chain of (seemingly) uncaught exceptions that end up in the driver as a message similar to this one:

```
{
  "isError": false,
  "response": {
    "message":"{\"result\":\"false\",\"failureDetails\":[\"{\\\"methodName\\\":\\\"verify text\\\",\\\"details\\\":\\\"══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════\\\\nThe following _Exception was thrown running a test:\\\\nException: Web Driver Command failed:\\\\nWebDriverCommandType.screenshot with exception Exception: Web\\\\nDriver Command WebDriverCommandType.screenshot failed while\\\\nwaiting for driver side\\\\n\\\\nWhen the exception was thrown, this was the stack:\\\\ndart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:49  throw_\\\\npackages/integration_test/_callback_web.dart 82:7                             _sendWebDriverCommand\\\\ndart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50            <fn>\\\\ndart-sdk/lib/async/zone.dart 1406:47                                          _rootRunUnary\\\\ndart-sdk/lib/async/zone.dart 1307:19                                          runUnary\\\\ndart-sdk/lib/async/future_impl.dart 147:18                                    handleValue\\\\ndart-sdk/lib/async/future_impl.dart 767:44                                    handleValueCallback\\\\ndart-sdk/lib/async/future_impl.dart 796:13                                    _propagateToListeners\\\\ndart-sdk/lib/async/future_impl.dart 567:5                                     [_completeWithValue]\\\\ndart-sdk/lib/async/future_impl.dart 640:7                                     callback\\\\ndart-sdk/lib/async/schedule_microtask.dart 40:11                              _microtaskLoop\\\\ndart-sdk/lib/async/schedule_microtask.dart 49:5                               _startMicrotaskLoop\\\\ndart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 177:15           <fn>\\\\n\\\\nThe test description was:\\\\n  verify text\\\\n═════════════════════════════════════════════════════════════════\\\\n\\\"}\"],\"data\":{\"screenshots\":[]}}"
  }
}
```

(Notice the `isError: false`, and the multiple layers of JSON encoding (nested exceptions) inside the `response`)

<details>

<summary>
Click for a formatted version of the JSON above (losing the multiple-levels of re-re-encoding) 👆
</summary>


```
{
  "isError": false,
  "response": {
    "message": {
      "result": "false",
      "failureDetails": [
        {
          "methodName": "verify text",
          "details": "
            ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════
            The following _Exception was thrown running a test:
            Exception: Web Driver Command failed:
            WebDriverCommandType.screenshot with exception Exception: Web
            Driver Command WebDriverCommandType.screenshot failed while
            waiting for driver side
            
            When the exception was thrown, this was the stack:
            dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:49  throw_
            packages/integration_test/_callback_web.dart 82:7                             _sendWebDriverCommand
            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                                     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 177:15           <fn>
            
            The test description was:
              verify text
            ═════════════════════════════════════════════════════════════════
          "
        }
      ],
      "data": { "screenshots": [] }
    }
  }
}
```
</details>

(Here's a [branch](https://github.com/kenzieschmoll/flutter/tree/integration-test-issue) with some experiments.)

**`integration_test` in the web should support accepting/rejecting screenshots.**