integration.js 2.6 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. this.timeout(180000);
  11. require = null;
  12. BABYLONDEVTOOLS.Loader
  13. .require('/tests/validation/validation.js')
  14. .testMode()
  15. .useDist()
  16. .load(function () {
  17. var info = engine.getGlInfo();
  18. console.log("Webgl Version: " + info.version);
  19. console.log("Webgl Vendor: " + info.vendor);
  20. // Reduces error ratio on Embedded Firefox for travis.
  21. if (info.vendor === "VMware, Inc.") {
  22. errorRatio = 5;
  23. }
  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();