Testing library equivalent to three-musketeers

Hey all.

I found a library three-musketeers, a e2e testing library for three.js, and wanted to find something similar in Babylonjs. I was looking a lot to find something similar, but couldn’t find anything similar.

Alternitavely, it would be nice if there is a way to get the engine/scene from the global scope (it seems that BABYLON.Engine.LastCreatedScene doesn’t return the same scene as I created)

You may have a look at Spector.js - https://spector.babylonjs.com/
There is also Chrome extension - Spector.js - Chrome Web Store

Spector is a tool aim to WebGl developers willing to know what happens on their context. It enables capturing all the available information from a frame. You will be empowered to look at your entire commands list with their associated visual states and context information.

You will be able to Explore and Troubleshoot your WebGL and WebGL2 scenes easily. This is compatible with any WebGL capable browser and all the web based 3d engines as well as vanilla scripts.

2 Likes

Thanks for the quick reply. Spector looks nice indeed and already had a look on it. It seems to do a pretty good job in debugging in a non automated fashion. Saying that I cannot run e2e tests with e.g. puppeteer/selenium/etc. (at least not on a leven where it makes sense).

The goal is to have one automated test to achieve something like following (copied from the docs of three-musketeers):

$$$
  .find('Cube_1')
  .click(); 

We do not have a direct library for this but you can definitely rely on the Babylon provided functions to achieve the same.

scene.getMeshBy… or getMaterialBy and such will help you finding any element from your scene.

You can also simulate clicks and pointer actions and so on.

1 Like

Maybe checking in how Babylon itself does testing might help? Babylon.js/tests/validation at master · BabylonJS/Babylon.js (github.com) :smiley:

1 Like

Awesome thanks for all your responses.

Brilliant idea @carolhmj . I think I was not looking into this folder as I did not connect “validation” with e2e testing.

@sebavan yes that was the idea, I was just not sure how to get the right “scene” from the global scope, but I think I just need to check out the link @carolhmj has added.

1 Like