Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[web] Improve dev/bots/service_worker_test #106225

Open
@ditman

Description

@ditman

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: tests"flutter test", flutter_test, or one of our testsc: tech-debtTechnical debt, code quality, testing, etc.platform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions