Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit: does SW use offline-first caching? (or use s-w-r?) #1646

Open
jeffposnick opened this issue Feb 6, 2017 · 2 comments
Open

Audit: does SW use offline-first caching? (or use s-w-r?) #1646

jeffposnick opened this issue Feb 6, 2017 · 2 comments

Comments

@jeffposnick
Copy link
Contributor

jeffposnick commented Feb 6, 2017

While the test for a "200 OK" response to an offline navigation does a good job of confirming that a web app works offline, it doesn't check that navigations are handled via an offline-first strategy. Currently, a web app might use a network-falling-back-to-cache strategy for handling navigations and still get a perfect Lighthouse score, even though the network request will behave poorly in a lie-fi or a high-latency network.

Would it be possible to create a new test which checked whether the HTTP request used for a navigation was fulfilled via a network request, and fail that test if it was?

One wrinkle is that a web app which used a stale-while-revalidate strategy for navigations should pass the test, since the HTTP request was fulfilled from the cache. While there's a network request made, the network doesn't block the page from getting the cached result.

Based on my last attempt at a related PR, I'm not sure that I have the familiarity with Chrome's debugging protocol to properly implement this, but I'm happy to review PRs, and provide some passing and failing test cases.

CC: @addyosmani @slightlyoff

@brendankenny
Copy link
Member

Would this require debugger protocol or just analysis of the network logs? The current fourth pass (mostly DoBetterWeb gatherers) has network recording on and the page should be well cached by then if it's going to be.

One wrinkle is that a web app which used a stale-while-revalidate strategy for navigations should pass the test, since the HTTP request was fulfilled from the cache. While there's a network request made, the network doesn't block the page from getting the cached result.

It seems like this should be identical to testing a site that's serving from the cache, you just don't want to get distracted by a separate request that never gets returned to the page

@jeffposnick
Copy link
Contributor Author

¯\_(ツ)_/¯ regarding as to whether it would need debugger protocol. I'm really ignorant here.

The question to answer is: did the response used to fulfill the navigation request come from the network?

@paulirish paulirish changed the title Test for offline-first navigations Nov 1, 2017
@paulirish paulirish added the P3 label Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants