Selenium for React componenets


(Musa) #1

Our team is currently working with Jest + Enzyme. We’re researching the benefits adding Selenium to our testing, I was wondering if anyone here has experience introducing Selenium to their testing suite in a predominately React project?

Any pros/cons? Or any strong feelings against?

Thanks!


(Mjgmusic) #2

@apollomusa

I am using Selenium to test a few different projects, and yes there are cons in certain scenarios. Most of the issues occur with elements not existing when running tests - which cause failures. Certain elements generate new IDs every time the page loads and developers don’t always consider putting in test-id or something static to anchor selenium calls to. Most interacting with elements identifying by xpath, css etc etc.

In my research I’ve concluded it’s best to discuss with developers during product design how they intend to accommodate e2e testing. If anyone else has insight I’d like to hear it, and will also update the forum with any other findings!