'Cucumber testing on WSL2 not showing UI for Google Chrome

I'm testing my Rails project and there are some problems when the test is running.

cucumber features/test.feature

I have installed chromedriver for WSL2 and the test can run fine. However, the browser showing up is not rendered at all, it only has a border and transparent body like this. enter image description here

I can still open google-chrome and it is displayed correctly. And the project used to work on WSL1. I can also take screenshots when testing, it's just that the browser's UI is not rendered.

I have installed the driver for GPU as stated in the WSL guide but the problem still persisted.

Has anyone encountered this problem and how can I fix it? Thank you very much.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source