Skip to content

JSDOM Headless Testing - #399

Merged
whuang37 merged 8 commits into
google:mainfrom
whuang37:testing-base
Jun 22, 2026
Merged

JSDOM Headless Testing#399
whuang37 merged 8 commits into
google:mainfrom
whuang37:testing-base

Conversation

@whuang37

Copy link
Copy Markdown
Collaborator

New addon to allow for more functional tests in addons/testing. Includes

  • New TestRunner.ts which instantiates all the mock systems needed to startup a test JSDOM run.
  • Mock renderers instantiated on setup to override XRBlocks browser dependencies
  • embodied-actions as the endpoint to run action tests
  • Documentation on loading to make it a bit smoother for agents to run tests
  • addons/testing/examples.test.ts shows how tests can be used and extend beyond just logic tests right now.

@whuang37 whuang37 changed the title JSDOM Headless Base JSDOM Headless Testing Jun 20, 2026
@whuang37
whuang37 requested review from dli7319 and ruofeidu June 20, 2026 20:24
Comment thread src/addons/testing/example.test.ts Outdated
button.onTriggered = () => {
game.spawnItem();
};
button.position.set(0, 1.2, -1.2); // Positioned in front of camera

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is xb.user.height defaults to 1.5 if I remembered.

try avoid magic numbers for 1.2 and -1.2

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just an arbitrary test scene but i moved it to core.user.height just to avoid a magic number

Comment thread src/addons/testing/example.test.ts Outdated
const scores = this.recognizer.recognize(context);
const pinch = scores['pinch'];
if (pinch) {
this.pinchDetected = pinch.confidence > 0.6;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain magic number 0.6

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored to test the gesture event detection of the scene over the confidence levels of the recognizer

Comment thread skills/xb-testing/SKILL.md
@whuang37
whuang37 merged commit fcb802f into google:main Jun 22, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants