From 04bf728364b63c9004ed8944ed1f03f801e4d43a Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Fri, 3 Jan 2020 15:34:51 -0800 Subject: [PATCH] test: make network cache test pass on all browsers (#374) --- test/page.spec.js | 7 +++---- utils/testserver/index.js | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/test/page.spec.js b/test/page.spec.js index d40534fd46..00cac23168 100644 --- a/test/page.spec.js +++ b/test/page.spec.js @@ -779,12 +779,11 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF }); describe('Page.setCacheEnabled', function() { - // FIXME: 'if-modified-since' is not set for some reason even if cache is on. - it.skip(WEBKIT)('should enable or disable the cache based on the state passed', async({page, server}) => { + it('should enable or disable the cache based on the state passed', async({page, server}) => { await page.goto(server.PREFIX + '/cached/one-style.html'); const [cachedRequest] = await Promise.all([ server.waitForRequest('/cached/one-style.html'), - page.reload(), + page.goto(server.PREFIX + '/cached/one-style.html'), ]); // Rely on "if-modified-since" caching in our test server. expect(cachedRequest.headers['if-modified-since']).not.toBe(undefined); @@ -792,7 +791,7 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF await page.setCacheEnabled(false); const [nonCachedRequest] = await Promise.all([ server.waitForRequest('/cached/one-style.html'), - page.reload(), + page.goto(server.PREFIX + '/cached/one-style.html'), ]); expect(nonCachedRequest.headers['if-modified-since']).toBe(undefined); }); diff --git a/utils/testserver/index.js b/utils/testserver/index.js index 85f2d1fdd7..37ebf109a3 100644 --- a/utils/testserver/index.js +++ b/utils/testserver/index.js @@ -234,7 +234,7 @@ class TestServer { response.end(); return; } - response.setHeader('Cache-Control', 'public, max-age=31536000'); + response.setHeader('Cache-Control', 'public, max-age=31536000, no-cache'); response.setHeader('Last-Modified', this._startTime.toISOString()); } else { response.setHeader('Cache-Control', 'no-cache, no-store');