AI Coding

How I Catch UI Bugs Without Writing a Single Line of Test Code

November 10, 20267 min read

The Lie of Codeless Testing

For my entire career, the Holy Grail of Quality Assurance was 'codeless testing'. But every 'codeless' tool I ever evaluated was just a glorified macro recorder with a shiny UI. You clicked around your staging environment, the tool secretly generated a brittle XPath or CSS selector script behind the scenes, and the moment a frontend engineer nested a `div` or renamed a CSS class, the entire test suite exploded.

Codeless testing wasn't actually codeless. It just hid the code from you until it broke. And it always broke.

We were spending 30% of our engineering cycles just maintaining the tests that were supposed to save us time.

The Fundamental Flaw of the DOM

The reason traditional testing fails—whether you write it in Cypress, Playwright, or use a legacy record-and-playback tool—is that it is inherently tied to the Document Object Model (DOM).

When you assert that `document.querySelector('.checkout-btn')` is visible, you are making an assertion about the implementation of the UI, not the UI itself. You do not actually care if the button is a `<button>`, an `<a>` tag, or a `<div>` with an onClick handler. You do not care if its class is `.checkout-btn` or `.btn-primary`.

What you actually care about is this: Can a human being see a button that says 'Checkout', and can they click it?

By coupling our tests to the DOM, we created a system where perfectly valid, bug-free code refactors would constantly trigger false alarms in our CI/CD pipelines. It was exhausting. And with the rise of AI coding assistants like Cursor and Copilot, which rewrite entire React components in seconds, DOM-based testing became entirely obsolete.

Enter Computer Vision: Testing the Pixels, Not the Code

I finally realized that the only way to escape this trap was to test the application exactly the same way a human user does: by looking at the screen.

This is why we built Beryl. Beryl does not read your HTML. It takes a screenshot of the viewport, parses the visual hierarchy using computer vision, and uses a multimodal LLM to understand the layout, the text, and the interactive elements.

Testing Anchor

How it Works

Failure Mode

Resilience to UI Refactors

DOM (Cypress / Selenium)

Parses HTML Tree to find elements

Fails when structure changes

Zero

Data-TestIDs

Finds specific tagged elements

Fails if developer forgets tag

Medium

Visual AI (Beryl)

Reads rendered pixels on screen

Only fails if UI is visually broken

Maximum

A Real-World Example: The Checkout Flow

Let's look at a standard e-commerce checkout flow. In a traditional E2E framework, asserting that the checkout total is correct requires a massive, brittle script. You have to mock the network, find the exact nested span containing the price, strip the currency symbol, and parse the float.


// The Old Way (Cypress) - 14 lines of brittle code
describe('Checkout', () => {
  it('should display correct total', () => {
    cy.get('[data-testid="cart-item-price"]').then(($prices) => {
      let total = 0;
      $prices.each((i, el) => {
        total += parseFloat(el.innerText.replace('$', ''));
      });
      cy.get('.checkout-summary > .total-val').should(($totalEl) => {
        const displayedTotal = parseFloat($totalEl.text().replace('$', ''));
        expect(displayedTotal).to.equal(total);
      });
    });
  });
});
    

This code is a liability. If the design team decides to move the total into a modal, or if they change the class `.total-val` to `.summary-total`, this test fails. The product isn't broken, but your pipeline is blocked.

Intent-Driven Verification

Now look at how I catch the exact same bug using Beryl's visual intent engine. I don't write a script. I write an intent.


// The Beryl Way - 1 line of Intent
await beryl.expectVisualMatch({ 
  intent: "The order total displayed is the correct sum of the items in the cart" 
});
    

That's it. Beryl's computer vision looks at the screen, identifies the line items, identifies the total, does the math, and verifies the outcome. It doesn't care if the total is in a modal, a sticky footer, or a sidebar. It just cares that the visual information presented to the user is mathematically and contextually correct.

The Hidden Benefit: Catching Z-Index and CSS Bugs

Because Beryl tests the pixels, it catches bugs that traditional tests physically cannot see. Have you ever deployed a feature where a z-index bug caused a transparent overlay to block a primary call-to-action button?

A standard DOM test will tell you the button is visible and enabled. It will pass. But a user clicking their mouse will hit the invisible overlay instead of the button. Beryl catches this instantly because it evaluates the actual interactive layer of the rendered viewport, just like a real browser engine would.

When you stop testing the implementation, you free your engineering team to iterate at the speed of thought.

Throwing Away the Test Suite

The day I deleted our legacy Cypress suite was one of the most terrifying and liberating days of my career. We replaced thousands of lines of maintenance-heavy code with simple, plain-English visual intents.

Our CI/CD pipeline stopped turning red for CSS changes. Our QA engineers stopped writing DOM selectors and started focusing on complex user journeys and edge cases. And most importantly, we caught three critical UI bugs in the first week that our old test suite had completely missed because they were visual layout issues, not logic errors.

Codeless testing used to be a lie. AI finally made it real. And I am never going back.

Author

Tanay Agarwal

Tanay Agarwal

Software Engineer