I’m working on setting up automated testing for my Angular project using TeamCity as our continuous integration platform. I need to configure both Karma unit tests and Protractor end-to-end tests to run properly in this environment.
I’m not sure about the best approach for browser configuration in this setup. Would it be better to use a headless browser option for these tests, or should I stick with a regular browser instance? What are the pros and cons of each approach?
Also, could someone guide me through the actual implementation steps? I want to make sure the tests run reliably without any display issues on the CI server. Any configuration examples or best practices would be really helpful.
Thanks in advance for any advice on this testing setup!
I run similar setups on different CI platforms. Use headless Firefox with Chrome - you get better cross-browser coverage without the extra overhead. For TeamCity, install Xvfb as backup. Headless mode randomly fails sometimes, so having a virtual display ready saves your builds. User permissions killed me once - the CI agent needs write access to temp directories or Chrome won’t start. Docker containers work great for test runs. They isolate browser dependencies and make everything portable between CI environments. Memory matters too - give each browser instance at least 2GB or you’ll get random timeouts that are hell to debug.
totaly! headless chrome is def the way to go in CI. just toss in those flags in ur karma config. way smoother, and no display probs! it runs sweet on TeamCity. best of luck!
Yeah, headless browsers are way more stable for CI. I’ve had regular Chrome crash constantly on servers without display drivers - total pain. For Karma, use --no-sandbox and --disable-web-security flags with headless mode. With Protractor, set longer timeouts since headless browsers take forever to start up. Heads up - headless Chrome still eats tons of memory. Keep an eye on your build agent’s resources and maybe run tests in smaller chunks if things get tight. Also, visual regression tests can act weird in headless mode. You’ll probably need to tweak some test expectations.