dwp / design-system

One place for service teams to find and share the styles, components and patterns for designing DWP services.
MIT License
15 stars 3 forks source link

Test assets building and caching processes #613

Closed simoneduca closed 4 weeks ago

simoneduca commented 4 months ago

We want to avoid possible scenarios where assets are built wrong and consequently cached wrong.

Test 1. test how assets are generated

Assumption:

Generate in production mode (in test?)

  1. Load the page and check an element has correct style
  2. Load the rev-manifest.json and check it has been injected into the page

Q: what happens if we are not running this in production mode - added tag for production test

Test 2. test assets are cached when no change occurred

Assumption:

  1. We load a page and check assets are loaded for the first time
  2. We load the same page and check assets have been cached

Q: Can we actually check status, and is status 304 or 200? - as though the server returns 200

We can use the page event to track the response end.

When cached this is usually about 0.100 rather then vs 20.

Test 3. test fresh copies of assets are served when they've changed

Assumption:

We'd need to spin up a server, check it, and make a change, is this any different to check 2?

Suggestion: I don't think this is an end2end we could look to add uint tests against our build scripts, but this would probably be more a general thing?

Test 4. performance testing cached vs fresh assets fetching

Assumption:

We need to investigate web prefs metrics in playwright, we can do this in web page speed test, but wouldn't be part of the build

Suggestion: this isn't part of our e2e tests since the numbers will change over time, all we could really say is that call 2 is faster then call 1

Example:

Largest Contentful Paint: .503S vs .435S Page Weight: 44kb vs 5k