4 ms·
My personal experience working on frontend is that it's often fastest to get everything looking right in the browser, and then go back and write tests. There is
by wonnage 5y ago
My personal experience working on frontend is that it's often fastest to get everything looking right in the browser, and then go back and write tests. There is a ton of manual testing involved (i.e, getting UI into all its possible states) that just goes out the window when writing unit tests because you can't easily test for stuff like the correct whitespace between elements.
But then react-storybook and Happo came along (I'm sure the concepts have existed long before). I can actually commit the states I was trying to test to the repo (as stories), and CI can render them and take screenshot diffs with Happo; these are now the unit tests. So now the work I'm doing during development doubles as the tests as well, and there's no second pass required.
My first exposure to this was really eye opening. All my career I've been getting preached to that I should personally write more tests, and never stopped to think how I could make "developing" and "testing" the same thing. I'm imagining a magical tool someday that records all the things I do during manual testing and turns them into unit tests.
- porker 5y ago> But then react-storybook and Happo came along (I'm sure the concepts have existed long before). I can actually commit the states I was trying to test to the repo (as stories), and CI can render them and take screenshot diffs with Happo; these are now the unit tests. So now the work I'm doing during development doubles as the tests as well, and there's no second pass required. Ohhh. Thanks, I didn't know this was possible (the committing of states, screenshots I've done before). I'm still in the hell of manual-testing the front end on multiple browsers and resolutions to check that changes don't break anything.