Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does anyone have any good resources on writing front-end integration tests? I've had nothing but terrible experiences with selenium. And I recently tried Nightmare (which is Electron-based), but it wasn't much better.


I too have had selenium nightmares but have landed someplace pretty good. Here are some quick tips. YMMV.

Don’t think “integration” — think “full stack” these will find configuration and connectivity bugs more than business logic bugs. These can’t be your only tests.

They need to run as part of your CD/CI pipeline automatically, otherwise, they won’t get run and will decay from disuse.

Headless browsers (HTMLUnit and PhantomJS) are easier to work with than “real” browsers. Haven’t used Chrome headless yet.

Front end bugs are often fiddly and visual. Screenshots + human review can be a cost effective supplement to manual testing, but can never replace it.

Good error logging and reporting is also key. If your front end tests break something, having the backend tell you what broke will save you time.

I tend to keep these “full stack” tests to happy path scenarios, as they are slower to write and to run than lower level integration tests.

Good luck.


I have done a little with NightmareJS and really liked it. A bit of syntatic sugar over Mocha with the option to drop down when required. Very succinct, I thought, and easy to start with. I, too, prefer to avoid Selenium, though.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: