integration.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. window.__karma__.loaded = function () { };
  2. // Loading tests
  3. var xhr = new XMLHttpRequest();
  4. xhr.open("GET", "/tests/validation/config.json", true);
  5. xhr.addEventListener("load", function () {
  6. if (xhr.status === 200) {
  7. config = JSON.parse(xhr.responseText);
  8. describe("Validation Tests", function () {
  9. before(function (done) {
  10. window.disableWebGL2Support = (window.__karma__.config.args && window.__karma__.config.args.indexOf('--disableWebGL2Support') > -1) ?
  11. true :
  12. false;
  13. this.timeout(180000);
  14. require = null;
  15. BABYLONDEVTOOLS.Loader
  16. .require('/tests/validation/validation.js')
  17. .testMode()
  18. .useDist()
  19. .load(function () {
  20. var info = engine.getGlInfo();
  21. console.log("Webgl Version: " + info.version);
  22. console.log("Webgl Vendor: " + info.vendor);
  23. console.log("Webgl Renderer: " + info.renderer);
  24. done();
  25. });
  26. });
  27. // Run tests
  28. for (let index = 0; index < config.tests.length; index++) {
  29. var test = config.tests[index];
  30. if (test.onlyVisual || test.excludeFromAutomaticTesting) {
  31. continue;
  32. }
  33. it(test.title, function (done) {
  34. this.timeout(180000);
  35. var deferredDone = function(err) {
  36. setTimeout(function() {
  37. done(err);
  38. }, 3000);
  39. }
  40. try {
  41. runTest(index, function(result, screenshot) {
  42. try {
  43. expect(result).to.be.true;
  44. deferredDone();
  45. }
  46. catch (e) {
  47. if (screenshot) {
  48. console.error(screenshot);
  49. }
  50. deferredDone(e);
  51. }
  52. });
  53. }
  54. catch (e) {
  55. deferredDone(e);
  56. }
  57. });
  58. };
  59. });
  60. window.__karma__.start();
  61. }
  62. }, false);
  63. xhr.send();