E2E Tests failing with error "You are probably offline." #34856
-
I've been at this for a few days now... Our e2e tests are based off I've constructed my own version of both of these packages to include in my plugin, doing so has made it simpler for my team and I to make modifications as per our preferences for use across our own repos (we maintain about 25 different plugins both on WordPress.org and self-hosted). I haven't upgraded our packages in a while so I've been doing so and in doing so the first test in the test suite started to fail with the error "You are probably offline" I traced this back to, I believe, an error being thrown by apiFetch: gutenberg/packages/api-fetch/src/index.js Line 130 in 257ba1e This error presents itself only when run in a CI (I started on Travis and have switched to GitHub actions because I hoped it would either go away or at the very least be easier to debug). The most recent failure as of this moment: https://github.com/gocodebox/lifterlms/runs/3614087294?check_suite_focus=true#step:13:18 The test in question has been reduced, more or less, to the following: describe( 'something', () => {
it ( 'should not fetch a thing.', async () => {
expect( 1 ).toBeTruthy();
} );
} ); And when I run that the test suite fails with "You are probably offline." After several days of debugging what I assumed was a problem with my code/plugin/test I've now found that this error is happening when the test does basically nothing. The I've found a similar-ish issue here: google/site-kit-wp#2674 but the solution closing that issue doesn't do much. I've attempted to trace every apiFetch request and none of the ones I can follow via this sort of method seem to throw an error. I have not been able to fully decouple my code enough to get a reduced test case (I tried install gutenberg for development but I'm not sure what else to do or where to look. I'm a few days into debugging the same error message and I'm still at a loss. Thanks <3 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@thomasplevy You mention:
Does this mean you depend on the scripts package or not? It sounds like you have a heavily customised environment, so helping might be difficult. I did recently update the puppeteer version that scripts uses (#33327), so it might be worth checking you're using the right version of puppeteer in your project. There was also a change to how offline mode and network emulation works (#33410) as part of that. If you're using an up-to-date version of scripts and an outdated version of puppeteer you may experience unexpected results. |
Beta Was this translation helpful? Give feedback.
-
@thomasplevy I did encounter this situation yesterday! It turns out I was misusing the Maybe that offers some clues about what's happening for you. I can think of two things
|
Beta Was this translation helpful? Give feedback.
@thomasplevy You mention:
Does this mean you depend on the scripts package or not?
It sounds like you have a heavily customised environment, so helping might be difficult.
I did recently update the puppeteer version that scripts uses (#33327), so it might be worth checking you're using the right version of puppeteer in your project. There was also a change to how offline mode and network emulation works (#33410) as part of that. If you're using an up-to-date version of scripts and an ou…