question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow for the browser caching of files during tests

See original GitHub issue

What would you like?

The ability to browser cache files in Cypress tests.

Why is this needed?

In applications that leverage the microfrontend architecture, each microfrontend has a single entry point (*.js file). In many cases, this single *.js file includes everything in that module and it can be somewhat large. Code splitting is possible, but it does not fully mitigate the problem described below.

An application that uses the microfrontend architecture relies heavily on browser caching. Each *.js file is versioned with a unique URL and has a cache-control header with a large max-age ie. it’s browser cached for a long time. This means that the initial load time of a new version of a microfrontend is long, but subsequent loads in a browser are fast.

Since browser caching files is not possible in Cypress tests, every Cypress test (it block) for a microfrontend has a long initial load time because it’s downloading the *.js file in full and not retrieving it from browser cache. Having Cypress tests always taking a long time to execute is quite suboptimal.

Other

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:7

github_iconTop GitHub Comments

2reactions
wasongcommented, May 11, 2022

Came across this issue as well. My js bundles are identical and loading them is 80% of the test duration.

0reactions
mellis481commented, Jun 8, 2022

@pmk1c Thanks for sharing. I had not come across Vite before. In the microfrontend ecosystem, each microfrontend does not have an *.html file (there is only one *.html file in the entire ecosystem). From what I was able to quickly read in their documentation, Vite is entirely based on the entry point being one or more *.html files so Vite will not work for single-spa-based microfrontends.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Web Developer's Guide to Browser Caching - Medium
In Chrome, we can go to chrome://cache to view the contents of the cache. This will display a page of links to a...
Read more >
How does the browser cache work? - Pressidium
The browser cache is a mechanism used by browsers to store locally web page resources. This adds performance gains, minimises bandwidth ...
Read more >
Testing for Browser Cache Weaknesses - OWASP Foundation
Caching is used to improve performance, so that previously displayed information doesn't need to be downloaded again.
Read more >
How to enable caching in google chrome in cypress
js file. Running tests on Cypress every time a "cy.Visit" loads it, if using Google. Other browsers don't have this problem, they cache...
Read more >
How to Fix the Leverage Browser Caching Warning in ... - Kinsta
There are two headers related to browser caching: Cache-Control and Expires. At least one must be present to enable browser caching for your ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found