mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
test: make network cache test pass on all browsers (#374)
This commit is contained in:
parent
cf6f04893c
commit
04bf728364
@ -779,12 +779,11 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.setCacheEnabled', function() {
|
describe('Page.setCacheEnabled', function() {
|
||||||
// FIXME: 'if-modified-since' is not set for some reason even if cache is on.
|
it('should enable or disable the cache based on the state passed', async({page, server}) => {
|
||||||
it.skip(WEBKIT)('should enable or disable the cache based on the state passed', async({page, server}) => {
|
|
||||||
await page.goto(server.PREFIX + '/cached/one-style.html');
|
await page.goto(server.PREFIX + '/cached/one-style.html');
|
||||||
const [cachedRequest] = await Promise.all([
|
const [cachedRequest] = await Promise.all([
|
||||||
server.waitForRequest('/cached/one-style.html'),
|
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.
|
// Rely on "if-modified-since" caching in our test server.
|
||||||
expect(cachedRequest.headers['if-modified-since']).not.toBe(undefined);
|
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);
|
await page.setCacheEnabled(false);
|
||||||
const [nonCachedRequest] = await Promise.all([
|
const [nonCachedRequest] = await Promise.all([
|
||||||
server.waitForRequest('/cached/one-style.html'),
|
server.waitForRequest('/cached/one-style.html'),
|
||||||
page.reload(),
|
page.goto(server.PREFIX + '/cached/one-style.html'),
|
||||||
]);
|
]);
|
||||||
expect(nonCachedRequest.headers['if-modified-since']).toBe(undefined);
|
expect(nonCachedRequest.headers['if-modified-since']).toBe(undefined);
|
||||||
});
|
});
|
||||||
|
@ -234,7 +234,7 @@ class TestServer {
|
|||||||
response.end();
|
response.end();
|
||||||
return;
|
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());
|
response.setHeader('Last-Modified', this._startTime.toISOString());
|
||||||
} else {
|
} else {
|
||||||
response.setHeader('Cache-Control', 'no-cache, no-store');
|
response.setHeader('Cache-Control', 'no-cache, no-store');
|
||||||
|
Loading…
Reference in New Issue
Block a user