integration.js 2.8 KB

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