The test seems to fail, at least for me, only when using Chrome and the servlet engine runs inside a Docker container. I can't reproduce the test failure when using Jetty standalone (running directly on the host) and, what's more puzzling for me, I can't even reproduce when testing manually on the same test XWiki instance. The difference is that:
I'm using my local Chrome (running directly on the host), while the test is using a Chrome instance running inside a Docker container.
I'm accessing the test XWiki instance (running on Tomcat in a Docker container) using localhost and the exposed port, while during the test the Chrome instance from the Docker container accesses XWiki using xwikiweb domain that is configured when the Docker container is started.
I've added debug logs and can tell for sure that:
the image URL is fine (the test even asserts it before it fails asserting the image width)
Still Chrome shows it as broken / missing. This is not a wait problem. The screencast continues a few seconds after the assert fails, and the image remains broken. The image is very small and displayed before during the test so it surely was cached by the browser.
Moreover, the image is properly loaded is I reset the image URL:
let src = image.src;
image.src = '';
image.src = src;
I don't understand why the image appears broken in Chrome. Maybe something aborts the image loading (e.g. because we update the image URL while the image is being loaded), but we see the image earlier in the test so it must be cached, so the loading should be instant. From the screencast it seems the image becomes broken right after realtime editing is established (right after connecting to the realtime session), which seems to correspond to the time when we patch the content (but there should be no change affecting the image). But why doesn't it reproduce when using Jetty standalone or when testing manually?...
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.