UI

UI Sweep

Most UI bugs aren't logic bugs: a panel that covers a button, a German label that doesn't fit, a corner of the HUD past the edge of an ultrawide screen. Nobody writes a test for those, so they ship. The UI sweep checks every widget on screen for them, at the sizes and in the languages you ship, without a test for each.

What It Checks

CoveredA button or other control a player can't fully reach: Specter hit tests a grid of points across it, as a click would, and names what's on top. A badge on one corner isn't reported.
Overlapping controlsTwo controls on top of each other.
Text cut offText that needs more room than it has (a longer translation, a bigger font), or that a clipping panel above it cuts off. Text in a scroll box can scroll, so it only counts when it's too wide.
Off screenAnything drawn past the edge of the game's view.
Outside the safe areaWith safeArea (0.9 is the usual 90% title safe area): anything drawn outside it. Full-screen backgrounds don't count.
Too small to clickA control smaller than 24 px at 1080p (scaled with the view's height), or minTargetSize.

A failure names each problem, the widget and the Widget Blueprint it's in:

Expected no UI problems, but the audit found 3:
  - Covered: Tab_Cast in WBP_Toolbar: 3 of 9 points on it reach SelectedItemBarBorder instead
  - Text cut off: ShotTitle in WBP_ShotListItem: "Explosión en el salón" needs 312 x 24, has 240 x 24
  - Off screen: DetonatorPanel in WBP_HUD: 38 px past the right edge of the view

Checking a Screen

expect(world).toHaveNoUIIssues() audits whatever is on screen, anywhere in a test. world.auditUI()returns the problems instead, each with where it is in the game's view.

// The screen as it is now
await expect(world).toHaveNoUIIssues();

// Or read the problems yourself
const { findings } = await world.auditUI({ safeArea: 0.9 });
for (const finding of findings) {
  console.log(finding.kind, finding.widget, finding.in, finding.message);
}

Every Screen Every Test Shows

Turn on uiAuditand Specter audits each screen your tests open, as they open it: once the set of Widget Blueprints on screen has held still for a moment, it's checked, and a screen with problems is photographed. The test gets an UI audit report attached, with each problem outlined on its screenshot, and a warning. Add fail: true to fail the test instead. Your existing suite becomes a UI audit with no new test code.

// playwright.config.ts: audit every screen every test shows
export default defineConfig({
  use: {
    uiAudit: true,
    // or: uiAudit: { safeArea: 0.9, ignore: ['WBP_Vignette'], fail: true },
  },
});

Sizes and Languages

world.uiSweep()repeats the audit at each view size and in each language, opening each screen you list (or checking the current one), and attaches one report for the lot. It puts the size and language back when it's done, and fails when it finds problems (failOnIssues: false to just report them).

test('UI sweep', async ({ world }) => {
  await world.uiSweep({
    sizes: ['1920x1080', '2560x1080', '1280x800', '3840x2160'],
    cultures: ['en', 'de', 'ja'],
    screens: [
      { name: 'Shot list', open: w => w.getByWidget('ShotListButton').click(), close: w => w.keyboard.press('Escape') },
      { name: 'Pause menu', open: w => w.keyboard.press('Escape'), close: w => w.keyboard.press('Escape') },
    ],
    ignore: ['WBP_Background', /Vignette/],
  });
});
  • Sizes need the game in its own window: standalone, or Play-In-Editor in a New Editor Window(Editor Preferences › Level Editor › Play). Inside the editor's level viewport the size belongs to the editor, and the sweep says so. A size bigger than your display comes out smaller; the report notes the size it got. Each size also gets UMG's DPI scale for that size, shown in the report.
  • Languages are your game's cultures, as 'de' or 'ja-JP'. Text from string tables and localized assets updates on screen. A culture the game has no translation for is noted in the report; the text stays in the source language.
  • The pieces are there on their own too: world.setViewportSize(w, h), world.getViewportInfo() and world.setCulture('de').

Single Checks

For one widget: toFitText() (the text in it isn't cut off) and toBeOnScreen({ safeArea }). Both retry like any matcher, so they wait out an animation. For one widget against another, there's toOverlap().

// A title that has to fit in German as well as English
await world.setCulture('de');
await expect(world.getByWidget('ShotListTitle')).toFitText();

// Inside the 90% title-safe area
await expect(world.getByWidget('WBP_Detonator')).toBeOnScreen({ safeArea: 0.9 });

What's Meant to Be That Way

ignoreleaves out what's fine: a string is a widget, its class, the Widget Blueprint it's in or its screen (exactly, ignoring case); a pattern is tested against “screen in widget (class)”. Typical entries are full-screen effects, a debug overlay, or a control that's small on purpose.

Limits

  • It checks UMG widgets. A HUD drawn on the canvas (AHUD, debug text) isn't checked.
  • Missing glyphs (a font without the characters a language needs) aren't detected yet.
  • Contrast isn't checked.
  • The audit sees the screen as laid out at that moment: give animations a moment (settleMs in a sweep).