integration.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. this.timeout(180000);
  11. require = null;
  12. BABYLONDEVTOOLS.Loader
  13. .require('/tests/validation/validation.js')
  14. .useDist()
  15. .load(function () {
  16. var info = engine.getGlInfo();
  17. console.log("Webgl Version: " + info.version);
  18. console.log("Webgl Vendor: " + info.vendor);
  19. console.log("Webgl Renderer: " + info.renderer);
  20. done();
  21. });
  22. });
  23. // Run tests
  24. for (let index = 0; index < config.tests.length; index++) {
  25. var test = config.tests[index];
  26. if (test.onlyVisual || test.excludeFromAutomaticTesting) {
  27. continue;
  28. }
  29. it(test.title, function (done) {
  30. this.timeout(240000);
  31. this.retries(3);
  32. try {
  33. runTest(index, function(result, screenshot) {
  34. try {
  35. expect(result).to.be.true;
  36. done();
  37. }
  38. catch (e) {
  39. if (screenshot) {
  40. console.error(screenshot);
  41. }
  42. done(e);
  43. }
  44. });
  45. }
  46. catch (e) {
  47. done(e);
  48. }
  49. });
  50. };
  51. });
  52. window.__karma__.start();
  53. }
  54. }, false);
  55. xhr.send();