Skip to content

Conversation

@aslushnikov
Copy link
Contributor

This patch:

  • introduces test/assets/cached folder and teaches server to cache
    all the assets from the folder
  • introduces test/assets/serviceworkers folder that stores all the
    service workers and makes them register with unique URL prefix
  • introduces Response.fromCache() and Response.fromServiceWorker()
    methods

Fixes #1551.

ebidel and others added 2 commits February 5, 2018 17:15
This patch:
- introduces `test/assets/cached` folder and teaches server to cache
  all the assets from the folder
- introduces `test/assets/serviceworkers` folder that stores all the
  service workers and makes them register with unique URL prefix
- introduces `Response.fromCache()` and `Response.fromServiceWorker()`
  methods

Fixes puppeteer#1551.
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this State. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.


expect(responses.size).toBe(2);
expect(responses.get('one-style.html').status()).toBe(304);
expect(responses.get('one-style.html').fromCache()).toBe(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a 200 code where it wasn’t cached?

Copy link
Contributor Author

@aslushnikov aslushnikov Feb 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean instead of 304 we currently have?
This will make the test less isolated: if there's some other test that loads the same URL, it will be cached.

For this reason the test explicitly reloads the page to trigger caching.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to. Have a css file that has cache busting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache-busting example is covered in the other place: see line 2670. Is it enough?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I missed that. All good

@aslushnikov aslushnikov merged commit ecc3adc into puppeteer:master Feb 5, 2018
@aslushnikov aslushnikov deleted the response-from-cache branch May 9, 2018 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Response.fromDiskCache/fromServiceWorker for better offline PWA testing

4 participants