Open machawk1 opened 7 years ago
A potential approach to accomplish this:
Tie-in some browser automation tool in the TravisCI / pytest config, the modern equivalent of Selenium, which supports Service Worker. From there we should be able to tell (a) If the service worker fired (b) If the request was intercepted when it should have been (c) If the request returns 404 when resource is not in the archive
Ideas for testing, @ibnesayeed ?
Unit testing ServiceWorker is not an easy task to perform reliably. For our case, there could be a few approaches such as preserving the interaction in HAR files and analyzing that. Or adding a custom header in all the requests originated from SW to analyze any leakage.
Another interesting read https://medium.com/dev-channel/testing-service-workers-318d7b016b19
Per #88: Write test cases for validating that the service worker intercepts the requests and a representation from the live web is not included in the replay system.