If testing your UI is hard, you may want to look at your architecture. I isolate the UI from the rest of the system with a hard boundary. There is no business logic in the UI, and all communication between the UI and the back end is either through event-style messaging or a well-defined API. This makes testing pretty easy. The UI side is nothing but visual elements, and I test those manually by looking at them. The entire back end can be tested by simulating the UI layer—sending the same events or API requests that would be sent by interaction with the UI. Separation of concerns!

Source: x.com/allenholub/status/1848429342386168135