Now that Kitten¹ is rather stable, I’ve decided to write some regression tests before refactoring to add class-based route/component support (in addition to the current—easy to get started with/use—function-based workflow).
I tried using Playwright but it’s quite heavy and not quite right for my needs (Kitten is more than just a server and I need control of it during testing). ~100 lines of code later, I have something that works well using tape and JSDOM :)
Aral Balkan
in reply to Aral Balkan • • •PS. This is the Browser helper:
codeberg.org/kitten/app/src/br…
And this is the Kitten process helper:
codeberg.org/kitten/app/src/br…
The only thing I’ll eventually need to add is a WebSocket helper so I can mock Kitten’s htmx¹/Streaming HTML² requests and that should give me pretty good coverage without having to resort to orchestrating actual browsers.
(Also, the unit tests are in quite a dismal state so there’s lots to do.)
¹ kitten.small-web.org/tutorials…
² kitten.small-web.org/tutorials…
#Kitten #htmx #testing
app/tests/helpers/Browser.js at regression-tests
Codeberg.org