I have about 100 interaction tests that make a single network request, which is mocked out using msw when running locally and in PRs. I want to remove the mock when merging to master to e2e test the stories against our QA API.
When I remove the mock, all of the tests pass locally in the UI, and they all pass individually when run in the test runner, however when run together, 1 or 2 will fail.
I believe that occasionally the network request is failing or taking too long, but its very hard to debug. Because of CORS issues I have to run chromium so that I can use '--disable-web-security', and then use 'page.on('console', (err) => {' to get it to log the browser console, however since there are just over 100 tests its pretty hard to dig into whats going on, and I cant just narrow it down to one test.
I thought I could just set the flakey test to retry, but I havent found a way to tell the test runner to retry, is that possible?
Another idea was to just set the mock service worker to act as a spy and not a mock, and log out any failed responses, but it seems that the only way to do that is to use passthrough(), and that doesnt give access to the response. I tried manually intercepting the response in MSW and then sending a fetch to the API based on the request, but that seemed to break MSW completely with no logs.
Any other ideas for workarounds for this? Can I slow the tests down or batch them to avoid overloading the API? Is there another way to inspect the network requests to confirm that it is infact failing, or being too slow? thanks.
To Reproduce
Create 100+ tests that make a network request to a potentially flaky API?
Describe the bug
I have about 100 interaction tests that make a single network request, which is mocked out using msw when running locally and in PRs. I want to remove the mock when merging to master to e2e test the stories against our QA API. When I remove the mock, all of the tests pass locally in the UI, and they all pass individually when run in the test runner, however when run together, 1 or 2 will fail. I believe that occasionally the network request is failing or taking too long, but its very hard to debug. Because of CORS issues I have to run chromium so that I can use '--disable-web-security', and then use 'page.on('console', (err) => {' to get it to log the browser console, however since there are just over 100 tests its pretty hard to dig into whats going on, and I cant just narrow it down to one test. I thought I could just set the flakey test to retry, but I havent found a way to tell the test runner to retry, is that possible? Another idea was to just set the mock service worker to act as a spy and not a mock, and log out any failed responses, but it seems that the only way to do that is to use passthrough(), and that doesnt give access to the response. I tried manually intercepting the response in MSW and then sending a fetch to the API based on the request, but that seemed to break MSW completely with no logs. Any other ideas for workarounds for this? Can I slow the tests down or batch them to avoid overloading the API? Is there another way to inspect the network requests to confirm that it is infact failing, or being too slow? thanks.
To Reproduce
Create 100+ tests that make a network request to a potentially flaky API?
System
Additional context
No response