Hacker News new | ask | show | jobs
by worthless-trash 521 days ago
As I dont do frontend work, how do you "test" anything without an insane amount of browsers/hardware realistically ?

If I was to write tests, it'd be basically http get/post/put/delete requests and measuring the responses are what I expect.. how can HTMX be any different here ?

How do you "test" a button works without a browser engine ? Every browser engine ?

2 comments

We do have pseudo-browsers written in pure js that you can theoretically use:

https://github.com/jsdom/jsdom

https://github.com/capricorn86/happy-dom

but they're about as reliable as you can expect: it's difficult to keep up the pace with the big three (or two) on standards compliance, and they usually don't even try.

So the only reliable solution is a headless Chromium, Firefox, and/or WebKit-based noname browser like the sibling says.

https://pptr.dev/guides/what-is-puppeteer

https://playwright.dev/

https://www.selenium.dev/documentation/

You throw headless browsers into your CI/CD pipeline and try not to think about how many resources you're burning.
Might work for a small project, but a nightmare for medium to large projects. Imagine Microsoft tests their Outlook (web app) like that.
Microsoft tests Outlook?