integration.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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(180000);
  31. var deferredDone = function() {
  32. setTimeout(function() {
  33. done();
  34. }, 3000);
  35. }
  36. try {
  37. runTest(index, function(result, screenshot) {
  38. try {
  39. expect(result).to.be.true;
  40. deferredDone();
  41. }
  42. catch (e) {
  43. if (screenshot) {
  44. console.error(screenshot);
  45. }
  46. deferredDone(e);
  47. }
  48. });
  49. }
  50. catch (e) {
  51. deferredDone(e);
  52. }
  53. });
  54. };
  55. });
  56. window.__karma__.start();
  57. }
  58. }, false);
  59. xhr.send();