Loading WURK...
RomanMotion
RomanMotion
Product ad & launch videos · 3D product visuals · app & AI builder. Concept to final cut in days. Open for projects.

How to automate UI, UX and localization QA with AI agents

Set up QA with AI agents for layout, flows and translations: Playwright screenshots per locale, code checks, agent review and CI, step by step.

Published on October 22, 202610 min read

You shipped a small change on Friday. On Monday a user in Germany sends a screenshot: the "Jetzt kaufen" button is cut in half on mobile, the price shows as $1,234.50 instead of 1.234,50 €, and the checkout page has a string that literally says checkout.cta.confirm. None of your tests caught it, because your tests check that things work, not that they look right in every language on every screen.

That gap is where most visible bugs live. The good news: you can close most of it in an afternoon with a browser automation tool, a few targeted checks, and an AI agent that looks at screenshots the way a picky reviewer would.

Short version: run your key pages across a handful of viewports and locales, save screenshots, run text-overflow and translation checks in code, and let an agent review the screenshots that changed. Wire it into CI so every pull request gets a report. Below is the setup step by step, with code you can copy.

What you're actually testing

Split it into three layers, because each one needs a different kind of check.

UI (does it look right?)

  • Layout breaks across viewports: overlapping elements, horizontal scroll on mobile, buttons pushed off screen.
  • Visual regressions: something moved, changed color or disappeared since the last approved version.

UX (can people get through it?)

  • Core flows: signup, login, checkout, settings, password reset.
  • Broken paths: dead links, buttons that do nothing, forms that never confirm.
  • Basics an agent can spot in a screenshot: tap targets too small to hit, text too faint to read, error messages that never show.

Localization (does it work in every language you ship?)

  • Text overflow and truncation when strings get longer.
  • Untranslated strings, raw translation keys, leftover placeholders like {{name}}.
  • Right-to-left layout for Arabic or Hebrew.
  • Date, number and currency formats.
  • Font fallback: missing glyphs that show up as empty boxes.

Code is good at the precise checks (is there a violation, does this element overflow). An agent is good at the fuzzy ones (does this page look broken). Use both.

Step 1: Set up Playwright with viewports and locales

Start a project with npm init playwright@latest, then define one project per combination you care about. Keep the list short: a desktop, a phone, your longest language and one right-to-left language cover most real bugs.

// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  retries: process.env.CI ? 2 : 0,
  use: {
    baseURL: process.env.BASE_URL ?? 'http://localhost:3000',
    trace: 'on-first-retry',
  },
  projects: [
    { name: 'desktop-en', use: { ...devices['Desktop Chrome'], locale: 'en-US' } },
    { name: 'mobile-en',  use: { ...devices['Pixel 7'], locale: 'en-US' } },
    { name: 'mobile-de',  use: { ...devices['Pixel 7'], locale: 'de-DE', timezoneId: 'Europe/Berlin' } },
    { name: 'desktop-ar', use: { ...devices['Desktop Chrome'], locale: 'ar-SA' } },
  ],
});

The locale option sets the browser language and the Accept-Language header. If your app picks its language from a URL prefix or a cookie instead, set that in the test.

Step 2: Capture screenshots per project

The agent in Step 4 needs something to look at. Have each test save a full-page screenshot of every key page, per project, so you get the same page on a desktop, a phone, in German and in Arabic side by side:

import { test } from '@playwright/test';

const pages = ['/', '/pricing', '/signup', '/checkout', '/settings'];

for (const path of pages) {
  test(`capture ${path}`, async ({ page }, info) => {
    await page.goto(path);
    await page.screenshot({
      path: `shots/${info.project.name}${path === '/' ? '_home' : path.replace(/\//g, '_')}.png`,
      fullPage: true,
    });
  });
}

Comparing these against approved baselines with pixel thresholds is its own discipline, with its own tricks for dynamic content. I cover that in the visual regression guide. Here the screenshots are input for the checks and the agent.

Step 3: Localization checks that code does better than eyes

Add these to the capture tests. They're cheap and they don't argue.

Clipped text, the most common localization bug:

const clipped = await page.evaluate(() =>
  [...document.querySelectorAll('button, label, h1, h2, h3, [role="tab"], nav a')]
    .filter(el => el.clientWidth > 0 && el.scrollWidth > el.clientWidth + 1)
    .map(el => (el.textContent ?? '').trim().slice(0, 60)));
expect(clipped).toEqual([]);

Untranslated strings and leftovers, run in your non-English projects:

const text = await page.locator('body').innerText();
expect(text).not.toMatch(/\{\{|\}\}|%s|undefined|\[object Object\]/);
expect(text).not.toMatch(/\b[a-z]+(\.[a-z0-9_]+){2,}\b/); // raw keys like checkout.cta.confirm

Tune the key pattern to your own key format; it will also match things like domain names, so keep a small allowlist.

Formats: in the German project, assert what a German user should see, for example that prices contain € and use a comma for decimals. The browser's Intl API gives you the expected value instead of hardcoding it: new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(1234.5) returns 1.234,50 €.

RTL: in the Arabic project, check that document.documentElement.dir is rtl, then let the screenshot review catch the rest (arrows pointing the wrong way, icons stuck on the left, text aligned the wrong side).

A trick worth stealing: pseudo-localization. Before real translations exist, generate a fake locale that swaps letters for accented ones and pads every string by roughly a third (Settings becomes [Šéţţîñĝš ~~~]). Run your screenshots in it. Any English text still visible was never wired for translation, and anything clipped will break in real long languages too.

Step 4: Add an agent that reviews screenshots

Pixel diffs tell you that something changed. They don't tell you whether it's broken. That's the job for an agent: send each new or changed screenshot to a vision-capable model with a strict prompt and ask for structured findings.

A prompt that keeps it useful:

You are reviewing a screenshot of the {page} page, {viewport}, locale {locale}. Report only problems you can see in this image: overlapping or cut-off text, elements outside the screen, untranslated or placeholder text, wrong text direction, missing glyphs shown as boxes, broken images, unreadable contrast. For each problem return JSON: {"severity": "high|medium|low", "category": "...", "where": "...", "evidence": "the exact text or element"}. If nothing is wrong, return []. Do not guess about anything not visible.

Rules that keep the noise down:

  • Review only screenshots that changed or failed, not the whole set every run.
  • Pass the baseline next to the new image when there is one, so the agent judges the difference.
  • Require evidence (the exact text or element) for every finding. Findings without evidence get dropped automatically.

You can go one step further and let an agent drive the browser itself, for example through Playwright's MCP server, to click through a flow and report where it got stuck. That's useful for exploration. Keep the agent's own clicking out of your pass/fail gate, though: tests you reviewed and approved are what you keep for repeatable coverage.

Step 5: Don't forget the flows

Screenshots tell you a page looks right. They don't tell you whether signup actually completes. The UX layer needs end-to-end flow tests for your three to five most valuable paths, plus a human exploring the product now and then. That's a different technique, and the exploratory and user-journey testing guide walks through it, accessibility passes included.

Flow tests are also the part most small teams never finish: they take the longest to write and rot fastest when the UI changes. If that's you, this is what AnyTest is built for. You give it a URL, its agents explore the product, find paths like signup, login and checkout, and write end-to-end tests that they leave for you to review and keep. It slots into the agent setup above instead of replacing it: it runs an MCP server (Streamable HTTP, bearer-token auth), so the same coding agent you already use can drive it with a config like this:

{
  "mcpServers": {
    "anytest": {
      "url": "https://autoqa.fly.dev/mcp",
      "headers": { "Authorization": "Bearer ${ANYTEST_API_TOKEN}" }
    }
  }
}

The token comes from its signup API (POST https://autoqa.fly.dev/fe/agent/signup, then /fe/agent/signup/verify with the 6-digit code it emails you). From there the agent can call testagent_enqueue to explore or write tests, test_run_start and test_run_wait to run them, and pending_change_approve or pending_change_discard when the agents propose changes to your suite. The localization checks and screenshot review above keep running alongside it.

Step 6: Hook it into CI

Run everything on each pull request against a preview deployment:

# .github/workflows/ui-qa.yml
name: ui-qa
on: [pull_request]
jobs:
  qa:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npx playwright install --with-deps
      - run: npx playwright test
        env:
          BASE_URL: ${{ secrets.PREVIEW_URL }}
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: playwright-report
          path: playwright-report

Then add a step that runs the screenshot agent on the changed images and posts its findings as one PR comment. One comment, grouped by page, beats twenty.

One gotcha: fonts render differently between operating systems, so the agent may flag "font looks wrong" on a CI runner that is just missing your web fonts. Make sure fonts load in CI (and wait for document.fonts.ready before capturing) so the agent reviews what users see.

Step 7: Triage what comes back

Every finding goes into one of four buckets:

  1. Real bug. Fix it, and add a code check if it's the kind of bug that can come back.
  2. Intended change. Note it in the PR so the next review doesn't flag it again.
  3. Flaky. The agent flags it on one run and not the next. Usually that means the screenshot was taken before the page settled; wait for the right element before capturing.
  4. Agent false positive. Note it in the prompt as a known exception ("the cropped hero image is intentional").

Keep "flaky or unclear" as its own visible bucket instead of hiding it inside pass or fail. That's the bucket that needs a human, and it's where trust in the suite is won or lost. AnyTest's results use the same idea: PASSED, FAILED with a step-by-step timeline of what happened, or NEEDS ATTENTION when a person should judge. If you connected it over MCP, test_run_get and test_run_events_list let your agent pull a run and its events into the same triage notes as everything else.

Pitfalls to avoid

  • Testing every page in every locale. Start with 5 pages times 4 projects. Grow from bugs you actually ship, not from a matrix.
  • Letting the agent block merges on its own. Agent findings are a review aid. Code checks and approved tests are the gate.
  • Vague prompts. "Find bugs" gets you opinions about design. Name the exact problems to look for and demand evidence.
  • Trusting machine translation checks to the agent. It can spot English left in a German page. It can't tell you the German is good. Get a native speaker to read the key screens once.
  • Reviewing everything every run. Cost and noise both grow with the number of images. Review what changed.

A checklist to screenshot

  • Key pages listed (start with 5)
  • Projects: desktop, phone, longest language, one RTL language
  • Full-page screenshots per project
  • Clipped-text check on buttons, labels, headings, tabs
  • Raw keys and placeholder check in non-English locales
  • Currency, number and date assertions per locale
  • dir="rtl" check for RTL locales
  • Pseudo-locale run before new translations ship
  • Agent review on changed screenshots, evidence required
  • Flow tests for signup, login, checkout
  • CI on every PR, one grouped report
  • Triage buckets: bug, intended, flaky, false positive

If you'd rather not build it

Everything above runs on free tools, and it's worth knowing how the pieces fit even if you never build them yourself. If your team would rather spend the afternoon shipping, anytest.dev gives you the flow-testing part from just a URL, with a human review step built in. To see what it would cover first, its free capability audit needs no account: POST https://crm.anytest.dev/api/public/free-test with your site_url and email (or use the form at anytest.dev/try) and you get back the list of tests it can run on your site. It reads public pages only and runs nothing, so it costs nothing to look.


If this guide saved you an afternoon of debugging, a small tip on this post helps me keep writing practical ones like it. Next in this series: visual regression across browsers and devices and exploratory and user-journey testing.

Conversation

Join the conversation

Share your thoughts with the author and other readers.

Comments0

Checking your account…

Latest comments

0
No comments yet. Be the first to share your thoughts.