Closed jsantell closed 5 years ago
I started the unit tests but haven't gotten around to fleshing them out. Simple unit tests covering the most obvious pieces would be a great start (with Jest + React test renderer). Redux was a nice-to-have to integrate for undo/redo and testability, but that's a ton of work. Would love help with tests!
Yes, please tests :) In a-frame
core the unit tests have served us well.
This issue is a bit general, but will add more tests when maintenance starts to hurt. We have some initial tests now though.
Right now, the tests are pretty light, which looks like it could've helped a handful of regressions or edge cases in newly implemented features, and can provide confidence on shipping changes. What are the future plans for this tool and how it relates to robustness? While the scenegraph seems a bit difficult to test (AFAICT), I think testing changing values in the tool and ensure it reflects in the DOM is a good chunk of functionality that would be covered, when it comes to different data types and components attached to an entity.
I think we could use something like electron-mocha, pretty much a modern replacement for the seldom-updated phantomjs solution, which injects code into an electron renderer process (chromium webpage, mostly) and runs tests. As the UI is in React, once a demo scene is loaded into the test, 1) we're selecting entities and ensuring the React components are rendering correctly, 2) firing changes in the React components and ensuring the DOM is updated, covering a lot of surface area.
electron-mocha runs headlessly and works well on Travis, not sure about WebGL status in that context, but even if not, we can still test the interactions between React app and DOM attributes (possibly by stubbing out some aframe rendering code if WebGL isn't available). If this is something useful moving forward, let me know and I'll dig more into it!