# Testing library equivalent to three-musketeers

**URL:** <https://forum.babylonjs.com/t/testing-library-equivalent-to-three-musketeers/24976>\
**Category:** Questions\
**Created:** [November 3, 2021, 6:32am UTC](https://forum.babylonjs.com/t/testing-library-equivalent-to-three-musketeers/24976 "2021-11-03T06:32:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JPeer264](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jpeer264/32/14133_2.png) [@JPeer264](https://forum.babylonjs.com/u/JPeer264)\
**Post date:** [November 3, 2021, 6:32am UTC](https://forum.babylonjs.com/t/testing-library-equivalent-to-three-musketeers/24976/1 "2021-11-03T06:32:29Z")

</div>

Hey all.

I found a library [`three-musketeers`](https://github.com/webgl/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)

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [November 3, 2021, 6:43am UTC](https://forum.babylonjs.com/t/testing-library-equivalent-to-three-musketeers/24976/2 "2021-11-03T06:43:38Z")

</div>

You may have a look at Spector.js - [https://spector.babylonjs.com/](https://spector.babylonjs.com/)  
There is also Chrome extension - [Spector.js - Chrome Web Store](https://chrome.google.com/webstore/detail/spectorjs/denbgaamihkadbghdceggmchnflmhpmk?hl=en)

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.

---

<div class="post-metadata">

**Author:** ![JPeer264](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jpeer264/32/14133_2.png) [@JPeer264](https://forum.babylonjs.com/u/JPeer264)\
**Post date:** [November 3, 2021, 7:01am UTC](https://forum.babylonjs.com/t/testing-library-equivalent-to-three-musketeers/24976/3 "2021-11-03T07:01:20Z")

</div>

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`):

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

```

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 3, 2021, 3:10pm UTC](https://forum.babylonjs.com/t/testing-library-equivalent-to-three-musketeers/24976/4 "2021-11-03T15:10:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [November 4, 2021, 7:45pm UTC](https://forum.babylonjs.com/t/testing-library-equivalent-to-three-musketeers/24976/5 "2021-11-04T19:45:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JPeer264](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jpeer264/32/14133_2.png) [@JPeer264](https://forum.babylonjs.com/u/JPeer264)\
**Post date:** [November 20, 2021, 9:43am UTC](https://forum.babylonjs.com/t/testing-library-equivalent-to-three-musketeers/24976/6 "2021-11-20T09:43:39Z")

</div>

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.
