integration.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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(async function () {
  20. await init();
  21. var info = engine.getGlInfo();
  22. console.log("Webgl Version: " + info.version);
  23. console.log("Webgl Vendor: " + info.vendor);
  24. console.log("Webgl Renderer: " + info.renderer);
  25. done();
  26. });
  27. });
  28. // Run tests
  29. for (let index = 0; index < config.tests.length; index++) {
  30. var test = config.tests[index];
  31. if (test.onlyVisual || test.excludeFromAutomaticTesting) {
  32. continue;
  33. }
  34. it(test.title, function (done) {
  35. this.timeout(180000);
  36. var deferredDone = function(err) {
  37. setTimeout(function() {
  38. done(err);
  39. }, 3000);
  40. }
  41. try {
  42. runTest(index, function(result, screenshot) {
  43. try {
  44. expect(result).to.be.true;
  45. deferredDone();
  46. }
  47. catch (e) {
  48. if (screenshot) {
  49. console.error(screenshot);
  50. }
  51. deferredDone(e);
  52. }
  53. });
  54. }
  55. catch (e) {
  56. deferredDone(e);
  57. }
  58. });
  59. };
  60. });
  61. window.__karma__.start();
  62. }
  63. }, false);
  64. xhr.send();