
Summary
Key points of this document
- 1. Background and Challenges
- 2. Technical Breakdown of the 3 Major Verification Points
- To prevent situations where only the frontend UI state is updated and writes to the DB are lost,
Overview
Architecture for Automating Human-Performed Operational Verification: Integrated Design of Functional Completeness, Zero-Tolerance, and Geometric Layout Auditing
1. Background and Challenges
In web application development, even with comprehensive unit tests, component tests, and API-level integration tests in a CI environment, it is still common to see humans manually perform "operational verification" by opening a browser just before release or after deployment.
The fundamental reason why this human-performed operational verification (acceptance testing, smoke testing) is carried out is that traditional automated tests cannot fully verify the comprehensive behavior of the browser runtime.
1.1 Implicit Verifications Handled by Manual Checks
When humans interact with the screen for verification, they unconsciously process the following complex perspectives simultaneously:
- True Persistence of State: Is the data registered or changed on the screen saved to the backend DB without disappearing even after reloading the screen (F5)?
- Runtime Health: Does the screen freeze when a button is clicked? Are there any red-text errors (JavaScript exceptions or API communication failures) in the browser console?
- Visual Appearance and Integrity: Is there any display corruption? Are characters cut off? Is horizontal scrolling occurring on smartphone displays? Are Japanese characters in tables squashed vertically, one by one?
1.2 Limitations of Manual Verification and Cognitive Biases
Manual verification not only incurs significant man-hours but also comes with the following structural flaws:
- Occurrence of Missed Verifications: It is practically difficult to click all buttons and links on a screen, often leading to only specific "happy paths" being traced and considered complete.
- Overlooking Environmental Differences and Screen Widths: Even if it's confirmed to be fine at desktop width, display issues at tablet width (768px) or mobile width (390px) might be overlooked.
- Invisibility of Internal Errors: Even if the screen appears visually intact, one might not notice frequent 404/500 communication errors or unhandled JavaScript errors occurring in the background.
- Misconception of Pseudo-CRUD Success: The screen updates only through client-side state management (React State or Vue Store), leading to the illusion that it's "working" even when API submission or DB persistence has failed.
In this article, we will systematize and explain an architecture that deterministically and mechanically automates these complex verification tasks, which are currently performed manually by humans, using Playwright and modern browser APIs.
2. Technical Breakdown of the 3 Major Verification Points
Analyzing the perspectives of human-performed operational verification reveals that they essentially converge into the following three layers:
2.1 Comparison of the 3 Major Verification Axes
| Verification Axis | Verification Target | Main Detection Content / Pass Criteria | Difference from Human Manual Verification |
|---|---|---|---|
| 1st Axis: Functional Completeness and State Persistence | Data round-trip, DB persistence, boundary values | Persistence must be maintained even after an F5 reload immediately following Create/Update/Delete. Normal rendering of empty states and validation errors. |
---3. Concrete Automation Implementation Examples Using PlaywrightFrom here, we will present practical implementation code using TypeScript and Playwright.
3.1 Building a Zero-Tolerance Error Monitoring HarnessFirst, we will build a test fixture (harness) that traps all warnings, exceptions, communication errors, and resource loading failures that occur during test execution, and forces the test to terminate if even one is detected.---
3.2 DB Persistence Verification with Round-Trip CRUD and F5 Reload
To prevent situations where only the frontend UI state is updated and writes to the DB are lost,
"Create → F5 Reload → Verify", "Update → F5 Reload → Verify", "Delete → F5 Reload → Verify"
// fixtures/zero-tolerance.fixture.ts
import { test as base, expect, Page, Request, Response } from '@playwright/test';
export interface ZeroToleranceErrors {
consoleErrors: string[];
pageErrors: string[];
failedRequests: string[];
brokenImages: string[];
}
export const test = base.extend<{ zeroToleranceTrap: ZeroToleranceErrors }>({
zeroToleranceTrap: async ({ page }, use) => {
const errors: ZeroToleranceErrors = {
consoleErrors: [],
pageErrors: [],
failedRequests: [],
brokenImages: [],
};
// 1. Capture console.error
page.on('console', (msg) => {
if (msg.type() === 'error') {
errors.consoleErrors.push(`[Console Error] ${msg.text()}`);
}
});
// 2. Capture uncaught JavaScript exceptions (runtime crashes)
page.on('pageerror', (exception) => {
errors.pageErrors.push(`[Page Crash] ${exception.message}\n${exception.stack ?? ''}`);
});
// 3. Capture network communication failures (HTTP 4xx / 5xx)
page.on('response', (response: Response) => {
const status = response.status();
const url = response.url();
// Filter here if you need to exclude intentional external beacons, etc.
if (status >= 400) {
errors.failedRequests.push(`[HTTP ${status}] ${url}`);
}
});
// 4. Capture network-level connection disconnections (DNS failure, connection refused)
page.on('requestfailed', (request: Request) => {
const failure = request.failure();
errors.failedRequests.push(
`[Request Failed] ${request.method()} ${request.url()} - ${failure?.errorText ?? 'Unknown error'}`
);
});
await use(errors);
// Verify broken image links just before test completion
const brokenImages = await page.evaluate(() => {
const images = Array.from(document.querySelectorAll('img'));
return images
.filter((img) => !img.complete || img.naturalWidth === 0)
.map((img) => img.src || img.getAttribute('data-src') || 'unknown image');
});
errors.brokenImages.push(...brokenImages);
// Zero Tolerance check: Assert that there are 0 errors in all categories
const totalDefects =
errors.consoleErrors.length +
errors.pageErrors.length +
errors.failedRequests.length +
errors.brokenImages.length;
if (totalDefects > 0) {
const errorReport = [
'=== ZERO-TOLERANCE QUALITY GATE FAILED ===',
errors.consoleErrors.length > 0 ? `Console Errors (${errors.consoleErrors.length}):\n${errors.consoleErrors.join('\n')}` : '',
errors.pageErrors.length > 0 ? `Page Exceptions (${errors.pageErrors.length}):\n${errors.pageErrors.join('\n')}` : '',
errors.failedRequests.length > 0 ? `Failed Network Requests (${errors.failedRequests.length}):\n${errors.failedRequests.join('\n')}` : '',
errors.brokenImages.length > 0 ? `Broken Images (${errors.brokenImages.length}):\n${errors.brokenImages.join('\n')}` : '',
]
.filter(Boolean)
.join('\n\n');
throw new Error(errorReport);
}
},
});
export { expect };Implement test cases that thoroughly enforce.
// e2e/crud-persistence.spec.ts
import { test, expect } from '../fixtures/zero-tolerance.fixture';
test.describe('Project Management CRUD Roundtrip and State Persistence Verification', () => {
const timestamp = Date.now();
const initialTitle = `Automated Test Item_${timestamp}`;
const updatedTitle = `Automated Test Item_Updated_${timestamp}`;
const targetPrice = '12800';
test('Full process persistence: Create -> F5 -> Update -> F5 -> Delete -> F5', async ({ page, zeroToleranceTrap }) => {
await page.goto('/projects');
await expect(page.locator('h1')).toHaveText('Project List');
// -------------------------------------------------------------------------
// Step 1: Create (New Creation)
// -------------------------------------------------------------------------
await page.getByRole('button', { name: 'Register New' }).click();
await page.getByLabel('Project Name').fill(initialTitle);
await page.getByLabel('Unit Price').fill(targetPrice);
await page.getByRole('button', { name: 'Save' }).click();
// Confirm that it is reflected on the screen
const itemRow = page.getByRole('row', { name: new RegExp(initialTitle) });
await expect(itemRow).toBeVisible();
// [CRITICAL] Perform a forced reload (F5) to verify true persistence
await page.reload({ waitUntil: 'networkidle' });
const persistedItemRow = page.getByRole('row', { name: new RegExp(initialTitle) });
await expect(persistedItemRow).toBeVisible({
message: 'After F5 reload immediately after Create, the data was not persisted in the DB and disappeared from the list.',
});
await expect(persistedItemRow.getByText(targetPrice)).toBeVisible();
// -------------------------------------------------------------------------
// Step 2: Update
// -------------------------------------------------------------------------
await persistedItemRow.getByRole('button', { name: 'Edit' }).click();
await page.getByLabel('Project Name').clear();
await page.getByLabel('Project Name').fill(updatedTitle);
await page.getByRole('button', { name: 'Update' }).click();
// Confirm update on screen
const updatedRow = page.getByRole('row', { name: new RegExp(updatedTitle) });
await expect(updatedRow).toBeVisible();
// [CRITICAL] Perform a forced reload (F5) to verify persistence of updated values
await page.reload({ waitUntil: 'networkidle' });
const persistedUpdatedRow = page.getByRole('row', { name: new RegExp(updatedTitle) });
await expect(persistedUpdatedRow).toBeVisible({
message: 'After F5 reload immediately after Update, the changes were not retained in the DB.',
});
// -------------------------------------------------------------------------
// Step 3: Delete
// -------------------------------------------------------------------------
await persistedUpdatedRow.getByRole('button', { name: 'Delete' }).click();
// Handle delete confirmation modal
await page.getByRole('dialog').getByRole('button', { name: 'Delete Permanently' }).click();
// Confirm disappearance from the screen
await expect(page.getByRole('row', { name: new RegExp(updatedTitle) })).toHaveCount(0);
// [CRITICAL] Perform a forced reload (F5) to verify prevention of re-appearance (zombification)
await page.reload({ waitUntil: 'networkidle' });
await expect(page.getByRole('row', { name: new RegExp(updatedTitle) })).toHaveCount(0, {
message: 'After F5 reload immediately after Delete, the deleted data reappeared (zombified).',
});
});
test('Boundary value, input validation, and Empty State verification', async ({ page, zeroToleranceTrap }) => {
// 1. Validation error verification
await page.goto('/projects/new');
await page.getByRole('button', { name: 'Save' }).click();
await expect(page.getByText('Project name is required')).toBeVisible();
// 2. Empty State verification
await page.goto('/projects?query=non_existent_keyword_99999');
await expect(page.getByRole('status')).toContainText('No matching projects found');
});
});3.3 Traversal of All Operable Elements and Dynamic Reversibility Testing
Dynamically collect links, buttons, input forms, select boxes, etc., present on the screen via DOM traversal, verify that no exceptions occur for any of them, and that scroll lock on the background is properly released when modals and drawer menus are "opened → closed".
// e2e/exhaustive-interaction.spec.ts
import { test, expect } from '../fixtures/zero-tolerance.fixture';
test.describe('Exhaustive traversal of all interactive elements and dynamic component resilience', () => {
test('No exceptions should occur when exhaustively traversing interactive elements on the screen', async ({ page, zeroToleranceTrap }) => {
await page.goto('/dashboard');
await page.waitForLoadState('networkidle');
// Collect selectors for interactive elements (excluding destructive actions like delete buttons and logout)
const interactiveElements = await page.evaluate(() => {
const selectors = [
'button:not([disabled]):not([data-destructive])',
'a[href]:not([target="_blank"])',
'input:not([type="hidden"]):not([disabled])',
'select:not([disabled])',
'[role="button"]:not([aria-disabled="true"])',
'[tabindex="0"]',
];
const elements = Array.from(document.querySelectorAll<HTMLElement>(selectors.join(',')));
return elements.map((el, index) => {
const text = el.innerText?.slice(0, 30).trim() || el.getAttribute('aria-label') || el.tagName;
return { index, tag: el.tagName, text };
});
});
// Verify the number of collected elements
expect(interactiveElements.length).toBeGreaterThan(0);
// Verify open/close resilience of dropdowns and menus
const dropdownTriggers = page.locator('[data-testid="dropdown-trigger"]');
const triggerCount = await dropdownTriggers.count();
for (let i = 0; i < triggerCount; i++) {
const trigger = dropdownTriggers.nth(i);
await trigger.click();
const menu = page.locator('[role="menu"]');
await expect(menu).toBeVisible();
// Close with Escape key or by clicking the trigger again
await page.keyboard.press('Escape');
await expect(menu).toBeHidden();
}
// Verify open/close of modal components and restoration of body scroll lock
const modalTrigger = page.locator('[data-testid="open-modal-btn"]').first();
if (await modalTrigger.isVisible()) {
await modalTrigger.click();
const modal = page.locator('[role="dialog"]');
await expect(modal).toBeVisible();
// Verify that body has overflow: hidden when modal is open
const bodyOverflowLocked = await page.evaluate(() => {
return window.getComputedStyle(document.body).overflow === 'hidden';
});
expect(bodyOverflowLocked).toBe(true);
// Cancel/close the modal
await modal.getByRole('button', { name: 'Cancel' }).click();
await expect(modal).toBeHidden();
// Verify that body overflow is restored after modal closes
const bodyOverflowRestored = await page.evaluate(() => {
return window.getComputedStyle(document.body).overflow !== 'hidden';
});
expect(bodyOverflowRestored).toBe(true);
}
});
});4. Mathematical Judgment Logic for Geometric Layout Audits
The biggest weakness of relying on manual "visual inspection" for display collapse is the absence of objective judgment criteria. UI collapse in web frontends can be automatically determined as a complete mathematical algorithm by mathematically evaluating the DOM's bounding box (Bounding Client Rect) and computed style values.
4.1 Three Major Screen Width Matrix
Layout verification executes the exact same test suite across the following three major screen widths.
- Desktop (
1440px): Standard for Full HD and high-resolution laptops. Multi-column, fixed sidebar, large screen display. - Tablet (
768px): iPad and other tablets in portrait orientation, small devices. 2-column wrap, hamburger menu boundary. - Mobile (
390px): Standard smartphone width like iPhone. 1-column, accordion, text wrapping at extremely small widths.
4.2 Mathematical Judgment Algorithm for Geometric Collapse
Major layout collapses are defined by the following logical expressions.
① Horizontal Overflow (Unintended Horizontal Scroll)
This is a phenomenon where the screen sways left and right on a smartphone display.
If this holds true, elements are breaking out of the screen.
② Squished Column (Single Character Vertical Collapse / Character-by-Character Wrap)
Table cells (th, td) or narrow cards, where the width is extremely compressed, causing Japanese strings to wrap character by character and stretch vertically. Since Japanese has no word boundaries (spaces), when the width shrinks, it gets compressed indefinitely down to character width (12-16px).
Judgment conditions (if all are met, it's judged as single character vertical collapse):
- The element contains 3 or more characters of text.
- Effective width (extremely small width, not even enough for 2 characters horizontally).
- Effective height (3 or more characters wrapped vertically).
- Or, extreme aspect ratio anomaly ( and ).
③ Text Clipping / Overflow (Text Breaking Through)
This is a phenomenon where text overflows from button or heading boundaries and overlaps with subsequent elements.
4.3 Implementation of Geometric Layout Audit Script
Below is an audit module that scans the entire screen with Playwright and collectively evaluates the above algorithms.
// utils/geometric-layout-auditor.ts
import { Page, expect } from '@playwright/test';
export interface LayoutViolation {
type: 'HORIZONTAL_OVERFLOW' | 'SQUISHED_COLUMN' | 'TEXT_CLIPPING' | 'TABLE_WRAPPER_MISSING';
selector: string;
details: string;
}
export async function runGeometricLayoutAudit(page: Page): Promise<LayoutViolation[]> {
return await page.evaluate(() => {
const violations: LayoutViolation[] = [];
const innerWidth = window.innerWidth;
const documentScrollWidth = document.documentElement.scrollWidth;
// 1. Horizontal Overflow Audit
if (documentScrollWidth > innerWidth + 1) {
// Search for specific elements causing the overflow
const allElements = Array.from(document.querySelectorAll<HTMLElement>('*'));
const overflowingElements = allElements.filter((el) => {
const rect = el.getBoundingClientRect();
return rect.right > innerWidth + 2;
});
const sampleSelector = overflowingElements.slice(0, 3).map((el) => {
return `${el.tagName.toLowerCase()}${el.id ? '#' + el.id : ''}${el.className ? '.' + el.className.split(' ').join('.') : ''}`;
}).join(', ');
violations.push({
type: 'HORIZONTAL_OVERFLOW',
selector: 'document.documentElement',
details: `Content width (${documentScrollWidth}px) exceeds screen width (${innerWidth}px). Overflowing elements: [${sampleSelector}]`,
});
}
// 2. Squished Column (single character vertical collapse) Audit
const textNodes = Array.from(document.querySelectorAll<HTMLElement>('th, td, div, span, p'));
for (const el of textNodes) {
// Target only text-holding elements that do not contain block-level child elements
if (el.children.length === 0 && el.innerText && el.innerText.trim().length >= 3) {
const style = window.getComputedStyle(el);
const fontSize = parseFloat(style.fontSize) || 16;
const clientWidth = el.clientWidth;
const clientHeight = el.clientHeight;
const isSquishedWidth = clientWidth < fontSize * 2.2;
const isMultiLineVertical = clientHeight >= fontSize * 2.5;
const isExtremeAspect = clientHeight > clientWidth * 2 && clientWidth < 50;
if ((isSquishedWidth && isMultiLineVertical) || isExtremeAspect) {
const textPreview = el.innerText.slice(0, 15).replace(/\n/g, '');
violations.push({
type: 'SQUISHED_COLUMN',
selector: `${el.tagName.toLowerCase()}.${el.className.split(' ').join('.')}`,
details: `Text "${textPreview}" is squished vertically (width: ${clientWidth}px, height: ${clientHeight}px, font size: ${fontSize}px)`,
});
}
}
}
// 3. Table Horizontal Scroll Wrapper Audit
const tables = Array.from(document.querySelectorAll<HTMLTableElement>('table'));
for (const table of tables) {
const parent = table.parentElement;
if (parent) {
const parentStyle = window.getComputedStyle(parent);
const isScrollable =
parentStyle.overflowX === 'auto' || parentStyle.overflowX === 'scroll';
const isTableWide = table.scrollWidth > parent.clientWidth;
if (isTableWide && !isScrollable) {
violations.push({
type: 'TABLE_WRAPPER_MISSING',
selector: `table`,
details: `Table's natural width (${table.scrollWidth}px) exceeds parent element's width (${parent.clientWidth}px), but the parent element does not have overflow-x: auto set.`,
});
}
}
}
return violations;
});
}4.4 Execution of Three Major Screen Width Matrix Tests
// e2e/geometric-layout.spec.ts
import { test, expect } from '../fixtures/zero-tolerance.fixture';
import { runGeometricLayoutAudit } from '../utils/geometric-layout-auditor';
const VIEWPORTS = [
{ name: 'Desktop', width: 1440, height: 900 },
{ name: 'Tablet', width: 768, height: 1024 },
{ name: 'Mobile', width: 390, height: 844 },
];
const TARGET_ROUTES = ['/dashboard', '/projects', '/projects/new', '/settings'];
for (const vp of VIEWPORTS) {
test.describe(`Geometric Layout Audit - [${vp.name}: ${vp.width}px]`, () => {
test.use({ viewport: { width: vp.width, height: vp.height } });
for (const route of TARGET_ROUTES) {
test(`Verify 0px horizontal scroll and 0 single-character vertical misalignments on ${route}`, async ({ page, zeroToleranceTrap }) => {
await page.goto(route);
await page.waitForLoadState('networkidle');
// Save screenshot
await page.screenshot({
path: `test-results/screenshots/${vp.name}-${route.replace(/\//g, '_')}.png`,
fullPage: true,
});
// Execute geometric audit
const violations = await runGeometricLayoutAudit(page);
if (violations.length > 0) {
const report = violations
.map((v) => `[${v.type}] ${v.selector}: ${v.details}`)
.join('\n');
throw new Error(`Layout shift detected (${vp.name} / ${route}):\n${report}`);
}
expect(violations).toHaveLength(0);
});
}
});
}4.5 Hybrid Operation with Layout and Aesthetic Review Using AI Vision (Image Recognition)
Mathematical judgment logic (geometric audit) detects clear collapses like "overflow" and "extreme compression" 100%, but has limitations in judging subjective/design flaws such as "unnatural margin balance," "misaligned font and icon baselines," or "low contrast making it hard to read."
Therefore, we adopt a hybrid configuration where screenshots saved during test execution are fed into an AI Vision API (multimodal LLM) to conduct qualitative visual reviews in parallel.
Prompt structure for AI Vision:
- Present screen width (1440px / 768px / 390px).
- Evaluate based on the following four major perspectives, and return pass/fail status and coordinates of identified issues in JSON:
- Spacing and Rhythm (Are there unnatural compressions or elongations in Padding/Margin?)
- Placement and Alignment (Alignment of titles, icons, text, and buttons)
- Color scheme and contrast (Does it meet WCAG 2.1 AA readability standards?)
- Professional aesthetics (Does it avoid the crude feel of default styles?)
5. Integration into CI/CD Pipeline and Autonomous Remediation
These automated validations are placed in the CI/CD pipeline as"Fail-Closed (Never promote to production if it fails)"a gate.
5.1 CI/CD Execution Workflow
5.2 Detailed Evidence on Failure and Autonomous Remediation Loop
If a test fails, the following three major pieces of evidence are immediately output:
- Failure Screenshot: Viewport and full-page images at the moment the collapse occurred.
- DOM Snapshot: HTML structure and Computed Style values of the relevant element.
- Console/Network Logs: JavaScript error messages, stack traces, failed API endpoints, and status codes that occurred.
The autonomous remediation engine (AI agent, etc.) receives this objective evidence and writes correction code based on the following rules:
SQUISHED_COLUMNOn detection: To the table's parent container, add "overflow-x-auto" and to the table body, add "min-w-[700px]". To the relevant cell, specify "whitespace-nowrap" or "min-w-[...]".HORIZONTAL_OVERFLOWOn detection: Identify parent elements with fixed width ("w-[1200px]", etc.) and replace them with "max-w-full" or responsive classes ("w-full max-w-7xl").Failed Network Request (404/500)On detection: Fix backend API routing inconsistencies or missing DB migrations.F5 Reload Persistence FailureOn detection: Fix inconsistencies where the frontend only updates local state without issuing an API request, or where the backend returns a 200 response before committing.
6. Summary
"Visual testing" and "operational verification" performed by humans opening a browser are by no means artisanal or intuitive tasks; they are complex verification tasks with clear requirements and standards.
- CRUD Operations and True Persistence: By inserting a "forced F5 reload" immediately after each operation, completely eliminate simulated updates in UI memory and ensure round-trip consistency with the DB.
- Zero-Tolerance Error Monitoring: Establish a monitoring network that immediately FAILS if even a single console error, runtime exception, communication failure, or broken image is missed.
- Geometric Layout Audit: Mathematically detect horizontal scrolling, text overflow, and single-character vertical misalignment using mathematical judgment algorithms, and ensure aesthetic quality in cooperation with AI Vision.
By systematically automating these, it becomes possible to completely eliminate the reliance on individuals and oversights in acceptance testing, and to build a robust quality assurance system that can answer "YES" to the question "Is it in a perfect state?" based on objective evidence.


