oduwsdl / ipwb

InterPlanetary Wayback: A distributed and persistent archive replay system using IPFS
MIT License
613 stars 39 forks source link

Write test case for serviceWorker in replay #142

Open machawk1 opened 7 years ago

machawk1 commented 7 years ago

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.

machawk1 commented 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 ?

ibnesayeed commented 7 years ago

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.

ibnesayeed commented 7 years ago

Another interesting read https://medium.com/dev-channel/testing-service-workers-318d7b016b19