playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature]is it possible to reuse static resouces cache of previous test run ?

Open Jabbar2010 opened this issue 1 year ago • 5 comments

Test Case 1 : new context() page.goto("https://example.com");

Test Case 2 new context() page.goto("https://example.com");

I want to reuse all the static resource cache from Test Case 1 in Test Case 2, so that this test case will not download the resources anymore, it will be very useful when it accesses some websites with large file resources

In Isolation mode, Is there a way to achieve it? PS: Just want to reuse the static resources not cookies or storage.

Jabbar2010 avatar May 06 '23 09:05 Jabbar2010

We don't share the disk cache between the isolated contexts. Leaving this open to collect more upvotes.

pavelfeldman avatar May 08 '23 16:05 pavelfeldman

@pavelfeldman Hi, is there another way to achieve it and reuse the disk cache?

Jabbar2010 avatar May 09 '23 02:05 Jabbar2010

Not at this point. Using caching HTTP proxy would solve it, but I get how it is somewhat hard to set up.

pavelfeldman avatar May 09 '23 19:05 pavelfeldman

This would be an useful feature to have and I've been asked about reducing the number of calls on our test server which we are running our test against, 600+ test cases all requesting the same resource over and over again. mocking and interception is used in some cases but majority of the time pages require script bundles to work properly, reusing them would be fantastic.

rolandz83 avatar May 10 '23 02:05 rolandz83

This would be an useful feature to have and I've been asked about reducing the number of calls on our test server which we are running our test against, 600+ test cases all requesting the same resource over and over again. mocking and interception is used in some cases but majority of the time pages require script bundles to work properly, reusing them would be fantastic.

Agree

Jabbar2010 avatar May 10 '23 06:05 Jabbar2010

Disk/memory resource caching can speed up tests quite a bit — and this is especially true for VR tests where page load might often be the most time-consuming task.

@pavelfeldman I can share some stats on how much of a difference this can make with a large internal test suite. Could you please point me to how and where I can go about (temporarily) make this change — in case it doesn't need a large overhaul of things.

pastelsky avatar Jul 07 '23 12:07 pastelsky

should be good to implement it. why waste network resources to redownload something you have in other context.

drRobertDev avatar Jul 02 '24 12:07 drRobertDev