How to test a wasm app fully?

This might not fully be rust specific, but using cargo to test is so convenient that I kinda want to use it...

So, I have this desktop app which is well tested, which I'm converting to a wasm app. There's not much coding needed (after I moved IO up the call chain), so in turn the library making up the code for the wasm app is well tested.

But, the full "app" consists of some other code as well, some html and quite some JS. I'd really like to fully test this (if at all possible with different browsers), but I have no idea how to do this (particularly not how to integrate this with cargo test). Guess I need to spin up a web server... and then? There's a html form to fill out, a submit button to click, and then there's a download that probably needs to be accepted and then checked for correctness.

Maybe someone can point me in the right direction. Thanks in advance!

The wasm behavior is browser-dependent. Your tests can fail in Firefox and succeed in Chrome. This means you need to spawn a browser of your choice (usually headless one made for testing).

There are UI testing frameworks where you can pragmatically take actions such as mouse clicks, moves, keystrokes. Then assert the values or take the screenshot and compare pixel-to-pixel.

Thanks, I found playwright-rs after your suggestion, that looks pretty fine. Now I just need a webserver, but I guess the basic one from python would be workable.

For my tests, I create my own webserver similar to this for each test -> Example test server · algesten/ureq · Discussion #1178 · GitHub and it works pretty well. I also wouldn't be surprised if someone created a crate to do a similar thing.