integration.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. // Reduces error ratio on Embedded Firefox for travis.
  20. if (info.vendor === "VMware, Inc.") {
  21. errorRatio = 5;
  22. }
  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();