News for hackers. Stuff that matters.
Re:Ask HN: What do you use to test Frontend code? by MartinCron on Saturday September 03, 2011 @01:48PM (#2957725)
I live in constant worry of changing css and totally screwing up a completely unrelated bit of the web app

I understand this worry, but it makes me think that it may be a design problem with the CSS. Unrelated bits shouldn't be using the same CSS, related bits should probably change together.

In a more practical note, I have created selenium tests which capture screenshots and then saved those screenshots as artifacts in the CI (TeamCity) system. Having a human look at a bunch of static images makes for a faster and less error-prone sanity test to see if things are totally broken.

Re:Ask HN: What do you use to test Frontend code? by riffraff on Sunday September 04, 2011 @03:28AM (#2959007)
I agree it may be a design problem with the CSS, I agree.

But my point is exactly that: I can't just go in and _improve the code_ (extracting classes, rewriting it in less/sass or whatever) because to verify the changes do not mess up the UI requires clicking around many pages in half a dozen browsers in three OSes.

And thank you very much for the practical note, it's an interesting idea!

Re:Ask HN: What do you use to test Frontend code? by MartinCron on Sunday September 04, 2011 @07:16PM (#2960549)
You're in the catch-22 of being unable to write tests without refactoring, and unable to refactor without test coverage. I get it.

I hope the automated screenshot idea helps. I personally found it more useful in theory than in practice, but I wasn't doing a lot of UI polish work.

Re:Ask HN: What do you use to test Frontend code? by MartinCron on Tuesday September 06, 2011 @09:37PM (#2967981)
One other practical note, you can create a single (test) page that showcases all of the visual styles currently in use, so there is one page to check manually.