Description
dev/bots/service_worker_test.dart
used to be a small file that focused on testing if the service worker pre-cache and cache behavior worked as expected.
However in the last few months, more features have been tested using the same infrastructure, and the file is getting a little bit too big and hard to maintain.
A couple of bits that stand out:
- The app that is under test uses different HTML and Dart entrypoints. This is handled by copying around different index.html files, and using -t lib/some_other_main.dart with different logic. Copying the files is ad-hoc code, and would benefit from [web] Customize path of index.html and/or web directory. #78254
- There's a lot of copy-pasta maintaining the "server that logs how many hits each requested file has" to do assertions later, there's at least 3 copies of very similar code in the file (I just had to add the 3rd!), where most of it could be reused.
Code:
- https://github.com/flutter/flutter/blob/master/dev/bots/service_worker_test.dart
- https://github.com/flutter/flutter/tree/master/dev/integration_tests/web (service_worker_* apps under test)
Proposal
Audit all the different usages of dev/integration_tests/web/lib/*.dart, and see if there are more integration tests that build those apps... and how they do it. Maybe service_worker_test.dart is not the only file that could benefit from this refactor (?)
Tweak dev/bots/service_worker_test.dart to reuse code, start web apps more properly (after #78254), and in general, show it some TLC.