Sets up repeatable automated tests for an IWSDK WebXR app: typecheck and build gates, asset checks, a headless smoke test that drives the IWER emulator through the `iwsdk` CLI (screenshot, console errors, entity and component checks, ECS pause/step/diff, entering XR), scripted interaction tests with emulated controllers, hands and Meta VR Glasses gaze + pinch, a test-hook component for arranging scenarios and fast-forwarding time, a TypeScript end-to-end suite under Vitest, bot players that finish the game with real emulated input, frame-stepped gameplay videos recorded in the emulator, scene-file validation, a production-build smoke test, the opt-in Playwright runner, unit tests for pure game logic, and a GitHub Actions job. Use when the user says "add tests", "regression test", "CI for my WebXR game", "test without a headset", "automate the emulator", "smoke test", "record a gameplay video", "make a trailer clip without a headset", "check it still works after my change", or before a release build. For a real headset use `iwsdk-native-xr-test`; for one-off debugging use `iwsdk-debug`.
Trending skills
7-day visitors to each skill page
Ships in IWSDK Core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Made by Navid Mirzaaghazadeh · part of iwsdk-webxr-skills · MIT
IWSDK has no test framework of its own for apps. What it has is better for XR: a CLI that drives the emulated headset and controllers and reads ECS state from the running app. Build tests on that, in layers, cheapest first.
| Layer | Proves | Tool | Runs in CI |
|---|---|---|---|
| 1. Static gates | It compiles, bundles, assets load | npm run typecheck, npm run build, check-gltf.mjs | yes |
| 2. Pure logic | Rules, scoring, state machines | a unit runner (ask before adding one) | yes |
| 3. Runtime smoke | It boots, renders, no console errors, enters XR | scripts/iwsdk-smoke.sh | yes (headless, SwiftShader) |
| 4. Interactions | Grab, ray click, UI buttons, locomotion change state | npx @iwsdk/cli xr … + ecs query | yes |
| 5. Headset | Feel, comfort, frame rate, real MR features | iwsdk-native-xr-test, iwsdk-quest-device-testing | no |
xr status → sessionActive: true)../node_modules/.bin/iwsdk or npx @iwsdk/cli), never an unscoped
package. Tests must leave buttons released, ECS resumed and the dev server stopped.Every command prints JSON. Success: stdout {"ok": true, "data": {...}}, exit 0. Failure:
stderr {"ok": false, "error": {"code", "message"}}, exit 1 (packages/cli/src/index.ts).
Runtime commands put the tool result at .data.result; --raw prints the bare result. Useful
paths (from the 1.0.1 source):
| Command | jq path |
|---|---|
dev status | .data.state.browserCommandReady, .data.runtimeUrls.local, .data.runtimeUrls.network[] |
xr status | .data.result.sessionActive, .sessionMode, .enabledFeatures, .visibilityState |
ecs find --input-json '{"namePattern":"^Robot$"}' | `.data.result.entities[] |
ecs query --input-json '{"entityIndex":7}' | `.data.result.components[] |
ecs diff --input-json '{"from":"a","to":"b"}' | .data.result.summary.{added,removed,changed}, .entities[] |
browser screenshot --output-file p.png / scene render-file … | .data.screenshotPath, metadata in .data.result |
Check any other shape with npx @iwsdk/cli <domain> <action> --help or
npx @iwsdk/cli mcp inspect --tool <mcp_name> instead of guessing.
npm run --if-present typecheck # type errors can stop systems initialising silently
npm run build
find public \( -name '*.glb' -o -name '*.gltf' \) -exec node <iwsdk-asset-pipeline>/scripts/check-gltf.mjs {} +
Validate authored scenes without the runtime app (needs the dev server for the editor renderer):
npx @iwsdk/cli scene render-file \
--input-json '{"path":"public/scenes/main.iwsdk.scene.json","viewId":"hero"}' \
--output-file artifacts/hero.png | jq -e '.data.result.valid == true'
Keep game rules (scoring, rounds, inventories, AI decisions) in plain TypeScript modules that
don't import @iwsdk/core, and let systems call them. Then any unit runner works. The scaffold
ships none; IWSDK's own packages use Vitest. Ask before npm i -D vitest. Creating a full
World in Node is not documented; don't build tests on it.
This scales to physics-like code: a character controller (state machine, jump windows, wall-run, slide) behind a small collision interface, backed by simple boxes in tests and three-mesh-bvh in the app, ran under Vitest in an IWSDK 1.0.1 prototype. Only one ECS system adapts it to the world.
scripts/iwsdk-smoke.sh (in this skill) starts dev up --ai-mode agent, waits for a first
frame and browserCommandReady, fails on console errors, optionally checks a named entity and
component, runs ECS pause → snapshot → step 30 frames → snapshot → diff, enters emulated XR,
captures screenshots, then exits XR and stops the server.
cp <this skill>/scripts/iwsdk-smoke.sh scripts/ && chmod +x scripts/iwsdk-smoke.sh
scripts/iwsdk-smoke.sh --entity '^Robot$' --component OneHandGrabbable --out artifacts/smoke
Options: --no-xr (browser-only apps), --allow-console-errors, --keep-running,
--timeout MS, IWSDK_CLI=<path> to point at another CLI. Exit 0 = pass, 1 = a check failed,
2 = setup error. Status: syntax- and shellcheck-clean and exercised against a stub CLI with the
documented JSON envelope; not yet run against a live 1.0.1 runtime here. If a jq path fails
on your version, print the JSON file it names and adjust.
Write each scenario as one shell block: arrange (reset state), act (emulated input), assert
(ECS state). Device names: headset, controller-right, controller-left, hand-right,
hand-left, gaze. Gamepad button indices for xr set-gamepad-state: 0 trigger, 1
squeeze, 2 thumbstick, 3 A/X, 4 B/Y, 5 thumbrest (iwsdk.dev/skill.md).
set -euo pipefail
cli() { npx @iwsdk/cli "$@"; }
cli xr enter --input-json '{}' >/dev/null
idx=$(cli ecs find --input-json '{"namePattern":"^StartButton$"}' | jq -r '.data.result.entities[0].entityIndex')
# Ray click on a UIKit or RayInteractable target: aim, then select
cli xr look-at --input-json '{"device":"controller-right","target":{"x":0,"y":1.5,"z":-2}}' >/dev/null
cli xr select --input-json '{"device":"controller-right","duration":0.2}' >/dev/null
cli ecs query --input-json "{\"entityIndex\":$idx}" | jq -e '.data.result.components[] | select(.componentId | contains("GameState"))'
# Proximity grab: move the controller to the object, hold squeeze (1), assert Grabbed, release
cli xr animate-to --input-json '{"device":"controller-right","position":{"x":0,"y":1.2,"z":-0.6},"duration":0.3}' >/dev/null
cli xr set-gamepad-state --input-json '{"device":"controller-right","buttons":[{"index":1,"value":1}]}' >/dev/null
# … query the object for Grabbed …
cli xr set-gamepad-state --input-json '{"device":"controller-right","buttons":[{"index":1,"value":0}]}' >/dev/null
Replace names, positions and component checks with your app's. Distance grab (DistanceGrabbable)
holds trigger (0) instead; proximity grab (OneHandGrabbable, TwoHandsGrabbable) holds
squeeze (1). The official iwsdk-grab and iwsdk-ray skills give the exact procedures. For
physics and timing, use the iwsdk-debug loop (ecs pause, snapshot, step --input-json '{"count":8,"delta":0.016}', diff) and assert on .data.result.entities.
Direct ecs set-component is fine to arrange a scenario, but it is not proof that the user's
input path works.
Gaze + pinch (Meta VR Glasses). Needs world.xr.features.gazeTracking and, for the
emulated gaze source, dev.emulator.device: "metaVRGlasses" (setup: iwsdk-vr-glasses).
Switch to hands, aim gaze, pinch with a hand, assert, then test the fallback:
cli xr set-input-mode --input-json '{"mode":"hand"}' >/dev/null
cli xr look-at --input-json '{"device":"gaze","target":{"x":0,"y":1.5,"z":-2}}' >/dev/null
cli xr select --input-json '{"device":"hand-right"}' >/dev/null # the pinch; gaze itself has no select
cli ecs query --input-json "{\"entityIndex\":$idx}" | jq -e '.data.result.components[] | select(.componentId | contains("GameState"))'
cli xr set-connected --input-json '{"device":"gaze","connected":false}' >/dev/null # hand rays must take over
Gaze is pose-only: look-at, set-transform (orientation only) and animate-to aim it; move
its origin by moving headset. It isn't accepted by the select or gamepad commands. For a
hold-move-release grab use xr set-select-value on the hand (IWSDK gaze docs).
CLI gotchas (1.0.1):
xr look-at needs target as an object, {"x":0,"y":1.5,"z":-2}. An array doesn't move
the controller and doesn't give a clear error.npx @iwsdk/cli call costs about 0.3 s (process start). Calling the project's binary,
./node_modules/.bin/iwsdk, directly took about 0.1 s per call (measured 2026-10-23), which
matters in suites that make thousands of calls. Either way a script that holds a stick and
presses a button "at the right moment" is only accurate to a few hundred ms. Start the player
close to the edge you test, or pause the ECS and step (§4a) for exact timing.xr enter again before
the next XR command.dev status shows browserIssue.cause: "connection_lost", and neither browser reload nor
runtime recover brings it back while the page keeps hanging. Fix the loop, then dev restart. A typical culprit: while (count < target) void addAsync() where count only
grows after an await.scene render-stats fails during an emulated XR session with Cannot read properties of undefined (reading 'x') (1.0.1; it works outside XR). Its bounds pass appears to trip over the
emulated controller models. For a draw-call budget, copy world.renderer.info.render.calls
and .triangles into a test component each frame and read them with ecs query.net::ERR_ABORTED errors. Filter those
before failing a test on console errors.timeScale = 0 hook still completes.Hovered on the
target entity before pinching. If it never comes, fail with the list of entities that do
have Hovered: that tells "aimed wrong" apart from "the press was lost". A test that alternates
pass/fail on the same press is worth reading as a game bug. In one 1.0.1 game it was the
button that removed itself while still pressed (see iwsdk-official/ERRATA.md).xr set-input-mode hand (or a manual
check in hand mode), the managed browser stays in hand mode for the next test and the next run,
and controller presses do nothing. Set the mode at the start of every suite and in every hand
test's cleanup.A test-hook component makes scenarios quick to arrange: one dev component with plain fields
(x, y, z, yawDeg, teleport, restart, setting, value, apply) and a system
that acts when a trigger flag turns true, then clears it. ecs set-component writes one field
per call, so write the data fields first and the trigger flag last. Register the component in
src/components.ts like any other.
Three more fields on the same component paid off in an IWSDK 1.0.1 game:
command string the system reads each frame and clears: reset, stars:20,
derail and so on. For reset, stop saving first, then clear storage and call
location.reload(). A pagehide save handler would otherwise write the old state back.timeScale number multiplied into the game's own delta: 8× turns minutes of play
into seconds. Keep input steering on real frame time so carrying still works at 0×.ecs query.Past a handful of scenarios, shell blocks get hard to maintain. A small TypeScript harness
under Vitest worked well (measured: 21 scenarios, about 6 minutes against a live 1.0.1
emulator). Use a separate config so npm test stays fast:
// vitest.e2e.config.ts
export default defineConfig({ test: { include: ['e2e/**/*.e2e.ts'], fileParallelism: false, testTimeout: 180_000, hookTimeout: 180_000 } });
// e2e/harness.ts: one CLI call, parsed
const BIN = fileURLToPath(new URL('../node_modules/.bin/iwsdk', import.meta.url));
export function cli(command: string, input?: unknown): any {
const args = command.split(' ');
if (input !== undefined) args.push('--input-json', JSON.stringify(input));
const out = execFileSync(BIN, args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }); // throws on exit 1
const json = JSON.parse(out);
return json.data?.result ?? json.data;
}
// …plus waitFor(what, check, timeoutMs) that treats a CLI error during a reload as "not yet".
Keep scenario helpers (where to stand, how to grab and aim, game-frame ↔ world transforms) in one module and import the game's pure modules into the tests. Expected positions then come from the same code the game uses, not from hand-copied numbers.
A bot player proves a game can be finished, not just that its parts work. Expose what a player would act on (the next hinted move, the goal) through the test-hook component, then loop: read it, perform it with real emulated input (grab, aim, release), and assert the end state. In one train-set game, the bot played a whole session to "complete" with tracked hands, and on the way it found a placement that left a goal unreachable, which no single-scenario test had caught.
The emulator can't record real-time video, but pausing the ECS and stepping a fixed delta gives a smooth, repeatable one. Each frame:
ecs query on the player entity;xr set-gamepad-state (a button press = down before the step, up after it);ecs step --input-json '{"count":1,"delta":0.0333333}';browser screenshot --output-file frames/0001.png.Then: ffmpeg -framerate 30 -i frames/%04d.png -c:v libx264 -pix_fmt yuv420p -crf 18 out.mp4.
delta passed to update() (movement, timers, animation),
not performance.now().For assertions the CLI can't express (DOM overlays, CDP metrics), IWSDK has an opt-in runner:
npx @iwsdk/cli dev up --allow-browser-automation
npx @iwsdk/cli browser run scripts/check-hud.mjs # export default async function ({ page, frame, cdp }) { … }
The module must live inside the workspace and return JSON up to 1 MiB. While enabled, any local process that can reach the loopback CDP endpoint has browser-level control of that session. Ask the user, review the script, and don't enable it in ordinary sessions.
Smoke-test the production build too. The emulator suites run against the dev server, so
also serve dist/ with vite preview and load it once in headless Chromium through Playwright
(a dependency of @iwsdk/cli). Fail on any console error or pageerror, and check that the
manifest URL returns 200. Playwright's chromium_headless_shell may not be downloaded, but the
IWSDK CLI's managed browser is: on macOS, launch with executablePath set to
~/Library/Caches/ms-playwright/chromium-<n>/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing
instead of downloading another browser (ask before npx playwright install).
A GitHub Actions job (Linux, no GPU, so the managed browser uses SwiftShader: fine for correctness, useless for performance): references/ci-github-actions.md.
Automated: iwsdk-native-xr-test (real Quest Browser session over adb reverse, same CLI
commands with a runtimeTarget). Manual checklist: iwsdk-quest-device-testing §6.
packages/cli/src/index.ts, cli-results.ts, commands/runtime.ts, commands/status.ts, runtime-state.ts, help.ts, packages/core/src/mcp/ecs-debug-tools.ts, scripts/test-servers.mjs, .github/workflows/native-scene-editor.ymlpackages/iwer/src/remote/types.ts (session status fields)npx @iwsdk/cli ecs step --help (1.0.1: count 1-120, fixed delta, requires ecs pause)xr look-at target shape, frame-stepped recording and the Vitest controller: an IWSDK 1.0.1 VR prototype, 2026-10-16/17docs/concepts/xr-input/gaze.md ("Drive tests from the CLI"), https://developers.meta.com/horizon/documentation/iwsdk/guides/02-testing-experience/ ("Automate gaze and pinch", 2026-09-04)render-stats and ERR_ABORTED behaviour, count races, the command/timeScale/mirrored-counter hooks, the Vitest suite, the bot player and the production smoke: an IWSDK 1.0.1 MR train-set game, 2026-10-23 (observed, not from IWSDK docs)Last verified: 2026-10-24
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/iwsdk-core:iwsdk-testingfrom IWSDK Core
npx claudepluginhub mirzaaghazadeh/iwsdk-webxr-skills --plugin iwsdk-core17 skills in this plugin
/horizon-launch-roadmapPlan and sequence the launch of an IWSDK / WebXR game or 2D web app on Meta Quest: choose between hosted web, the Browser new tab page and a Horizon Store PWA; pick 2D vs immersive; list the irreversible decisions (Android package id, signing key, origin and Digital Asset Links, Early Access, pre-order and Coming Soon windows, Data Use Checkup auto-approval, age group, web IAP limits, Meta VR Glasses input and targeting); map each phase to the skill that does the work; and build a dated timeline counting back from launch day, plus post-launch growth tools. Use when the user asks "how do I publish my WebXR game", "should I ship as a PWA or just a website", "what's the release process for a Quest web app", "plan my launch", "when should I submit", "can I do early access / pre-orders", "should I support Meta VR Glasses", or starts a new IWSDK project meant for the store./horizon-store-listing-assetsPrepare and validate the Meta Horizon Store listing for a WebXR / IWSDK PWA or a 2D PWA: art specs (covers, Hero, Mini Landscape, Logo, Icon, Spatialized tile, screenshots, trailer, 360 preview), asset VRCs, metadata limits, specs (play area, input, comfort, internet), age group and IARC, privacy policy and Data Use Checkup, pricing, price A/B tests, Try Before You Buy limits, web IAP limits (WebXR PWAs only, no subscriptions), sales, keys, Early Access, pre-orders, Store analytics, and what Meta VR Glasses change. Includes an image checker. Use when the user asks for "store assets for my web app", "cover art size", "screenshots of my WebXR game", "trailer requirements", "store description", "age rating / IARC", "privacy policy for my Quest PWA", "can my PWA sell items", "set the price", "A/B test my price", "free trial", "run a sale", "generate keys", or "early access". Replaces the asset table in Meta's hz-store-submit, which has wrong dimensions and limits./horizon-web-store-publishEnd-to-end release pipeline for shipping an IWSDK / WebXR game (or a 2D web app) on the Meta Horizon Store as a PWA/TWA: production build, HTTPS hosting that can serve /.well-known/assetlinks.json, web app manifest and icons, @meta-quest/bubblewrap-cli in immersive or 2D mode (scripted, non-TTY), version codes, signed-APK verification, sideload test, ovr-platform-util or metavr upload to ALPHA, device targeting (Future devices for Meta VR Glasses, quest3+ channel suffix), promotion between release channels, web-only updates versus APK rebuilds, and CI. Ships a deploy checker, a TWA APK verifier and a guarded upload wrapper. Use when the user says "publish my WebXR app to the Quest store", "package my IWSDK game as a PWA", "bubblewrap for Quest", "my TWA won't launch / shows a URL bar", "assetlinks", "upload my web app APK", "ship my PWA to Meta VR Glasses", "promote to beta / production", or "set up CI for my Quest PWA". Builds on and corrects Meta's hz-store-pwa skill./horizon-web-vrc-checklistPre-submission audit of a WebXR / IWSDK PWA (immersive) or a 2D PWA against Meta's current Virtual Reality Checks (VRCs) for the Horizon Store, by VRC ID, using the Store and Store (2D) columns of Meta's VRC table. For each VRC it gives the web-specific check (WebXR APIs, Bubblewrap manifest output, web permissions) and how to test it in the installed TWA on a Quest with metavr, adb, chrome://inspect and OVR Metrics Tool, then produces a PASS/FAIL/RISK evidence table. Use when the user asks "will my WebXR app pass review", "VRC checklist for a PWA", "which VRCs apply to a 2D web app", "focus awareness in WebXR", "pause when the Universal Menu opens", "frame rate requirement for WebXR", "entitlement check for a PWA", "is my PWA ready for Meta VR Glasses", or "why was my web app rejected (VRC...)". Takes precedence over the generic VRC notes in Meta's hz-store-submit, which are partly out of date./hz-immersive-designerGuides design of comfortable, intuitive VR/MR experiences for Meta VR and Horizon OS — comfort guidelines, interaction patterns, spatial layout, accessibility. Use during UX design review or when evaluating comfort and accessibility. Build paths: Meta Spatial SDK, Unity, Unreal, native OpenXR, and WebXR; for 2D panel apps use hz-panel-designer if available. Use hz-quest-verify-first if the build path is unclear./hz-perfetto-debugAnalyzes Meta VR and Horizon OS VR performance using Perfetto traces — frame timing, CPU/GPU bottlenecks, render pass analysis. Use when profiling frame drops, jank, or thermal issues on Meta VR devices. Build paths: all Meta VR app stacks; use hz-quest-verify-first if the build path is unclear.