This fixes a bug with our asset capturing where we cache a response and then return it whenever the same path is encountered again.
That logic is fine when we're dealing with a static asset, but it's faulty when dealing with tests that may have some back and forth with an API.
For example, a test could invoke a POST /things to create a thing, and then wait for the UI to refresh with the new thing. But with a standard REST API, there could be another request to GET /things in order to fetch all the things to render. Currently, the asset watcher will match on /things and return the response for the POST, which will most definitely break the test.
Reasoning
We only need to capture assets that will be loaded when we take the DOM snapshot and render it in a browser. At that point, the javascript tags will have been modified so that they don't run. So the only requests being made will be GET requests from src, href, url(), etc markup elements.
How to test
Run playwright tests, check Chromatic build.
Change Type
[ ] maintenance
[ ] documentation
[x] patch
[ ] minor
[ ] major
📦 Published PR as canary version: 0.0.35--canary.32.9eb328c.0
:sparkles: Test out this PR locally via:
```bash
npm install @chromaui/test-archiver@0.0.35--canary.32.9eb328c.0
# or
yarn add @chromaui/test-archiver@0.0.35--canary.32.9eb328c.0
```
Issue: AP-3798
What Changed
Only archive assets fetched via GET.
This fixes a bug with our asset capturing where we cache a response and then return it whenever the same path is encountered again.
That logic is fine when we're dealing with a static asset, but it's faulty when dealing with tests that may have some back and forth with an API.
For example, a test could invoke a
POST /things
to create a thing, and then wait for the UI to refresh with the new thing. But with a standard REST API, there could be another request toGET /things
in order to fetch all the things to render. Currently, the asset watcher will match on/things
and return the response for thePOST
, which will most definitely break the test.Reasoning We only need to capture assets that will be loaded when we take the DOM snapshot and render it in a browser. At that point, the javascript tags will have been modified so that they don't run. So the only requests being made will be GET requests from
src
,href
,url()
, etc markup elements.How to test
Run playwright tests, check Chromatic build.
Change Type
maintenance
documentation
patch
minor
major
📦 Published PR as canary version:
0.0.35--canary.32.9eb328c.0
:sparkles: Test out this PR locally via: ```bash npm install @chromaui/test-archiver@0.0.35--canary.32.9eb328c.0 # or yarn add @chromaui/test-archiver@0.0.35--canary.32.9eb328c.0 ```