Test automation

Tests fail after UI changes

A redesign or component library upgrade should not force a week of test rewrites. When every visual change breaks automation, the bottleneck moves from frontend to QA.

What it looks like on your team

Mass failures after a single PR

Dozens of tests red on a CSS or component rename.

Locator patch marathons

QA updates XPath while frontend ships the next change.

Fear of refactoring

Teams avoid improving UI because of automation cost.

Visual tweaks break unrelated tests

Tests assert on classes designers treat as private.

Root causes

  1. Selectors tied to layout structure

    Deep XPath and nth-child break when hierarchy shifts.

  2. No contract with engineering

    data-testid and accessible names are missing on new components.

  3. Tests duplicate UI knowledge

    Every screen change requires hunting references across the suite.

  4. iframes and dynamic portals

    Modals and embedded views change without notice to automation.

What to do

  1. Use semantic, user-facing locators

    Roles, labels, and agreed test IDs survive visual refactors.

  2. Shift-left on testability

    Include QA in design reviews for new screens and components.

  3. Heal or re-record instead of hand-editing

    Let tools propose selector updates after DOM diffs.

  4. Scope tests to behavior

    If the user outcome is unchanged, the test should still pass.

FAQ

Why do CSS changes break UI tests?

Tests that target classes or DOM position break when styling or structure changes even if behavior is identical.

Should developers add test IDs to every element?

Add stable hooks on interactive and assertable elements - not every decorative node.

How does Auto-Heal help after a redesign?

It detects locator mismatches and applies updated selectors so you review changes instead of rewriting from scratch.

Try QAlity on your hardest flows

Record, run in the cloud, and recover from UI changes with less manual work.