Open Syuking opened 3 years ago
Cause i hope to reduce the number of requests
@Syuking Does it hit performance of the page loading in your tests?
Cause i hope to reduce the number of requests
@Syuking Does it hit performance of the page loading in your tests?
maybe, i just want to try for this
It would be nice if it was possible to mock responses on some routes while keeping non-matched routes in cache.
Use case: replace the content of some files/scripts loaded by a website with local versions, without slowing down the navigation by having to http load everything else everytime.
As a workaround I use a MITM proxy but that is not ideal.
I need this too!
I need this too!
As I detail it in #10414, it's possible to enable/disable http cache with Network.setCacheDisabled from Chrome DevTools Protocol. But I find it not very readable. So for more readability, just like the API Puppeteer: page.setCacheEnabled we could have this API in Playwright.
I would like this, too. I want to use page.route() to abort requests to images and other unnecessary resources, but it defeats the purpose if I then lose the ability to cache scripts etc.
Is there a technical reason why using route disables the http cache?
Any update on this? My usecase is also the same i want to mock some files but at the same time check if cache was hit for others on reload.
also need this
I really need this feature
I found this._client.send('Network.setCacheDisabled', { cacheDisabled: true }),
in files, that disable cache after enabling routing
I have just comment this line and build playwright, and cache enabled
Sorry for my English
I found
this._client.send('Network.setCacheDisabled', { cacheDisabled: true }),
in files, that disable cache after enabling routing I have just comment this line and build playwright, and cache enabledSorry for my English
is any way to config this without rebuild?
https://github.com/microsoft/playwright/commit/aabdac83804bfb28fba0a93a5d4f61ce17920f41 related to this change?
Is there any new? I really need this too. As a service, it will be more effective~
Would be happy to have this option back as well.
+1
I also need this feature.
+1
I also need this feature.
+1
Workaround
// package.json
"scripts": {
+ "prepare": "node prepare.js",
}
// prepare.js
import path from 'path'
import {readFileSync, writeFileSync} from 'fs'
const modules = path.resolve(`node_modules`)
const destination = path.join(modules, 'playwright-core', 'lib', 'server', 'chromium', 'crNetworkManager.js')
const buffer = readFileSync(destination)
writeFileSync(destination, buffer.toString().replace('cacheDisabled: true', 'cacheDisabled: false'))
+1
I'm sorely missing the Page.setCacheEnabled
API too. We want to use Playwright to run automated tests for our analytics script, and there are cases where the testing code is much simpler when it can explicitly enable or disable the cache within a single test case.
Seems that using page.context().on('response', handler)
does not affect caching (requests are still cached). Can someone confirm this?
@aslushnikov What kind of feedback do you need for this? I also need this feature to reduce network traffic and not warm up the planet)
I also need this feature to make it more efficient, faster! And of course I want to reduce network traffic and not contribute to warming up the planet
Is there a reason why Playwright disables the cache when using page.route
?
need this
+1
It definitely seems like something a route should allow when you are using playwright for integration testing. Keeping it alive before a resolver bot gets it.
It would be great to know why the cache is disabled when using route()
at the very least
+1
Chromium will cache js & css files ,but the cache is disabling when using route action So,Is there any way to enable http cache when using route ? Cause i hope to reduce the number of requests