Skip to content

Latest commit

 

History

History

visual

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Visual tests

Visual regression tests for the moonbase_licensing activation UI. They render the ActivationComponent in every state to PNGs offscreen (no window, no network) and upload them to Argos for diffing against a baseline.

How it works

snapshot_main.cpp is a small JUCE console app that, for each state, constructs an ActivationComponent and uses two module seams to make the frame deterministic:

  • ActivationConfig::reduceMotion: transitions, the success pop and the glow jump straight to their final frame (also a real accessibility option). The spinner keeps turning under it, but a snapshot is taken before its first tick.
  • ActivationController::setPreviewState(screen, license, error) — forces any screen with a synthetic license, no network, no stored state.

It then captures juce::Component::createComponentSnapshot(...) at 2× and writes a PNG per state:

File State
01-welcome Not activated — online / offline
01b-welcome-error Activation request failed (error message)
01c-welcome-error-long The longest error copy the welcome view shows (two lines)
01d-welcome-error-rejected A rejected activation (fixed copy, never the SDK's reason)
01e-welcome-deactivated Locked: deactivated on this computer, here or in another instance
01f-welcome-license-expired Locked: a subscription or offline license reached its end date
01g-welcome-license-invalid Locked: Moonbase no longer accepts the license (the longest lock copy)
01h-welcome-license-unverified Locked: not checked online within the grace period
02-activating Browser activation in progress (spinner, copy-link fallback, device chip)
02b-activating-no-browser Browser activation whose browser couldn't be opened (copy the link instead)
03-success Just activated (license card)
04-offline-empty Offline flow, nothing chosen yet
05-offline-ready Offline flow with a response file selected
05b-offline-error Offline flow with an invalid response file (error)
06-trial Valid trial license (days-left, progress, features)
06b-trial-expired Trial that has ended (locked)
06c-trial-overflow Trial with a long feature list (scrollable field)
06f-not-covered-updates-ended Locked: a license whose updates ended before this version (Renew updates)
06g-not-covered-up-to-major Locked: a license for versions up to 2.x, judged on this computer (no upgrade link)
06h-not-covered-offline Locked: an offline license that doesn't cover this version (load an upgraded file)
07-details Valid perpetual license (details, seats, deactivate)
07b-details-subscription Subscription license with an expiry date
07c-details-error Details with a deactivate failure (error)
07d-details-update-available Details with a clickable "Update available" badge
08-details-offline Offline-activated (permanent) license
09-details-deactivating Deactivate in progress (inline spinner)
10-update-loading Update available, fetching release notes (skeleton)
11-update-ready Update available, notes loaded (download button)
12-update-downloading Update installer downloading (progress bar)
13-update-error Update details failed to load (error)
14-update-gated Update a trial can't download (Unlock CTA)
14b-update-not-covered Update the license doesn't cover (upgrade CTA, what it covers)
14c-update-not-allowed Update Moonbase keeps from a full license, e.g. one limited to a group of customers (no CTA)
15-theme-ember-welcome Welcome, "Ember" theme (warm near-black, amber, monospaced)
15b-theme-ember-welcome-error The longest welcome error copy in Ember's monospaced face, where it runs widest
15c-theme-ember-welcome-license-invalid The longest lock-reason copy in Ember's monospaced face
16-theme-ember-activating Browser activation with no browser, Ember (spinner arc + track, copy button)
17-theme-ember-trial Trial, Ember (pill, progress gradient, feature list)
17b-theme-ember-not-covered Upgrade needed, Ember (trial washes, both limits' copy)
18-theme-daylight-success Just activated, "Daylight" theme (light)
19-theme-daylight-details License details, Daylight (cards, seat pips)
20-theme-daylight-offline Offline flow, Daylight (drop zone, links)
21-theme-forest-expired Trial ended, "Understory" theme (deep green, danger tokens)
22-theme-forest-update Update ready, Understory (notes card + scrollbar)
23-details-add-ons License details with the "Add-ons" row (config.showAddOns)
23b-details-add-ons-error The same with a deactivate error, so the card has the least room
24-add-ons Add-ons screen: every row state (active, trial, try, deactivated, seats full, for sale, trial ended), scrolling
24-add-ons-short Add-ons screen with three that fit, no scrollbar (the docs' screenshot)
24-add-ons-trial-ran-out An add-on trial that ran out after the list loaded ("Trial ended", Buy)
24-add-ons-edges Bought during its trial (Activate), a single seat in use, a trial behind a newsletter sign-up, a long name
24-add-ons-trial-used-up A trial started and run out since an older list was loaded: not offered again
24b-add-ons-busy An add-on's trial starting (spinner), the other buttons waiting
24c-add-ons-no-seat An add-on with no free seat (error under the list)
24d-add-ons-loading Add-ons loading (skeleton rows)
24e-add-ons-failed Add-ons that couldn't be listed (error, "Try again")
24f-add-ons-empty A product with no add-ons to show
24g-theme-daylight-add-ons Add-ons screen, Daylight
24h-theme-ember-add-ons Add-ons screen, Ember's monospaced face

Add a state by adding a writeSnapshot(...) call.

Themes

15 onwards render the same UI through config.palette + config.fonts, the module's re-skin seam. They are the regression net for the colour tokens: a colour still hardcoded in ActivationComponent.cpp shows up here as stock blue-grey chrome, a cyan glow or a white wash on a panel that has none. The three themes (emberTheme(), daylightTheme(), forestTheme() in snapshot_main.cpp) are deliberately unalike, and between them the eight screens touch every token in ActivationPalette.

Ember also exercises the typeface seam. It routes all three font roles through fonts.makeFont to the platform's monospaced face rather than bundling a typeface, so the render stays reproducible on any machine.

Run locally

./scripts/visual-snapshots.sh            # build + render into ./ui-snapshots
./scripts/visual-snapshots.sh --upload   # …then upload to Argos (needs ARGOS_TOKEN)

On this repo's reference Mac the host toolchain needs an older SDK; pass it through:

MOONBASE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk \
  ./scripts/visual-snapshots.sh

CI / Argos

.github/workflows/visual.yml builds + renders on macOS (which also exercises the Apple crypto backend), stores the PNGs as a build artifact, and uploads to Argos when the ARGOS_TOKEN repository secret is set.

To enable Argos: create a project at argos-ci.com, connect this repository, and add its token as the ARGOS_TOKEN Actions secret. Argos records the first run as the baseline and flags pixel diffs on later runs for approval.