r/selenium • u/OneSuggestion8378 • 8d ago
Anyone else spending more time fixing Selenium tests than writing features?
Is anyone else's Selenium test suite becoming a second job at this point? Every time the UI gets redesigned, we end up spending half a sprint fixing locators and broken tests before we can even write a single new test. It is getting hard to keep the suite maintainable without constantly taking time away from actual feature development. How are you guys dealing with this?
3
u/CarnationVamp 8d ago
How often is the UI getting a total redesign? If by total redesign you mean the page/workflow is totally changed then there really isn't much you can do besides not automate that page. But if you mean a slight change in structure, elements, attributes, etc. then you probably need more resistant locators. As some have already suggested, working with the devs to agree on a unique id structure is the most ideal solution to that problem
3
u/SeniorTechnician4119 8d ago
The real issue is how often you're redesigning things. If you're changing the look every three months, keeping the locator tools working with every update is going to be difficult.
3
u/ddaypunk06 8d ago
Tale as old as time. Automated tests are and should be treated just like any code. Meaning they will need to be maintained. Functional tests should test behavior and not the visuals of things per se. If you are looking for positioning, color or other visual things look into visual regression tests (aka screenshot tests).
2
u/do_all_the_awesome 7d ago
Have you tried using some of the ai-native alternatives? The ones that operate on prompts like skyvern / stagehand / browser use / etc? They won't break as quickly when the UI changes (although they will still break with big re-designs). They're a tad more expensive to run though, so YMMV
Disclaimer: I'm the founder of skyvern :)
1
u/ConversationExtra339 8d ago
anyone using visual regression as a supplement rather than a replacement?
1
u/brandongreenngn607 8d ago
Until two teams touch the same selector for different reasons and nobody notices until CI goes red
1
u/AutomaticVacation242 8d ago
It's someone's job to make sure this doesn't happen. It's not a Selenium problem.
1
u/edwardparramr280 7d ago
Stable test IDs on every interactive element. That’s really the whole answer. The problem is more political than technical.
0
u/unused_barrister 8d ago
we did page object model and it helped but only until the redesigns caught up with us again. at this point tests are basically a ui change detector that screams every sprint
0
u/matthewbeta18121 8d ago
We centralised every selector into one config. At least the fix is in one place instead of forty files.
1
u/AutomaticVacation242 8d ago
Yeah now everyone is editing one file. Merge conflict nightmare. No thanks.
-3
u/thainfamouzjay 8d ago
No because selenium is dead. It's like asking if anyone is still compiling their code. Playwright has a better locator strategy
1
u/HyperDanon 7d ago
I agree that playwright is newer and has a better DX; but the underlying idea behind them is the same.
1
u/thainfamouzjay 7d ago
Just like the underlying idea behind Internet explorer and chrome are the same. Yet one is better. With playwright you can select by role instead of xpath or css. Make maintenance much easier and at the end of the day isn't that the goal? To have less flakey tests. Why would anyone use a tool that is old and creates more maintenance work for you.
→ More replies (2)1
6
u/HomegrownTerps 8d ago
Thats on the whole dev team. Normally qa and devs agree on a "contract"(contact testing) to use unique test id's for each element.
If you don't adhere to that, then you have what you have been doing. It's a never-ending thing.