Delay edits to work around lack of millisecond precision in `stat` and migrate `pageSource` tests to use console logs (#2670)

Currently, CI is red due to two issues on Windows:

- hot_reload_breakpoints_test: On Windows, dart:io doesn't have enough precision to provide a millisecond-based stat. Instead, it just rounds to the nearest second. We use this to determine what files were modified in a recompile whereas we use DateTime.now (which does have millisecond precision) to mark the timestamp of the previous compile. This then potentially leads to frontend_server_common mistakenly not recompiling some files.

To fix this, we stage all the edits at once (if possible) and delay for 1 second to guarantee that stat will always give a time after the previous compile if the file was modified.

- hot_reload_test: This and a number of tests use innerHTML, document.body.append, and the pageSource API to modify the page text and then read it. A previous race condition where we tried to compute the page before main was done executing was resolved by waiting for a log at the end of main. However, this is insufficient, because the changes to the page still may not bubble up by the time we try to calculate the page source, which was the issue with hot_reload_test.

We could do a busy-loop calculating the page until we get the text we want, but that's erroneous and a better solution is to just use console logs, which fixes the original issue. As part of this, a WebkitDebugger is always initialized in the test context so we can inspect console logs regardless of whether DWDS debugging is enabled.
14 files changed
tree: 148da2a13cb6dd1cadbeb3af16eb266c33b09970
  1. .github/
  2. _analysis_config/
  3. dwds/
  4. example/
  5. fixtures/
  6. frontend_server_client/
  7. frontend_server_common/
  8. test_common/
  9. tool/
  10. webdev/
  11. .gitattributes
  12. .gitignore
  13. AUTHORS
  14. CONTRIBUTING.md
  15. mono_repo.yaml
  16. README.md
README.md

Dart

Packages

PackageDescriptionVersion
dwdsA service that proxies between the Chrome debug protocol and the Dart VM service protocol.pub package
frontend_server_clientClient code to start and interact with the frontend_server compiler from the Dart SDK.pub package
webdevA CLI for Dart web development. Provides an easy and consistent set of features for users and tools to build and deploy web applications with Dart.pub package

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.