I think you tried most of the elegant options.
Since your problem seems to be serverside and your application does not give so much as a beep to tell you when it is done, you may have to slide a bit more to the dark side.
A less elegant option that sometimes doe the trick for me is to write a loop that checks for the desired result.
So click a thing, wait 5 secs for the desired result, if not there, click again, rinse and repeat.
The things we have to do to make UI automation work with Mendix... :)
I have used two ways to handle retries. Playwright’s built-in expect().toPass() assertion block works in some cases, and I’ve also implemented a custom retry function in JavaScript. Both approaches help to some extent, but they don’t fully solve the issue.
The core problem isn’t that the element on page X isn’t visible—Playwright sees it and can interact with it. The issue is that even after the element appears, Mendix is still running microflows in the background. So while Playwright is happily clicking through to the next state (let’s call it page X+1), the app sometimes resets back to page X or an earlier state, likely due to a microflow completing and triggering a UI update.
I’m curious—have you found a way to reliably retry a block of code in cases where all the UI elements are visible and enabled, but there’s still some hidden process running that causes instability later in the test? I’m trying to avoid hardcoded waits, because those don’t guarantee that all microflows are done and usually the automation engineer ends up 'upping' the hard wait amounts whenever the tests are failing in for example a pipeline.