integration.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. window.__karma__.loaded = function () { };
  2. window.validation = true;
  3. window.onload = function () {
  4. // Loading tests
  5. var xhr = new XMLHttpRequest();
  6. xhr.open("GET", "/tests/validation/config.json", true);
  7. xhr.addEventListener("load", function () {
  8. if (xhr.status === 200) {
  9. config = JSON.parse(xhr.responseText);
  10. describe("Validation Tests", function () {
  11. // Run tests
  12. for (let index = 0; index < config.tests.length; index++) {
  13. var test = config.tests[index];
  14. if (test.onlyVisual || test.excludeFromAutomaticTesting) {
  15. continue;
  16. }
  17. it(test.title, function (done) {
  18. this.timeout(60000);
  19. var deferredDone = function (err) {
  20. setTimeout(function () {
  21. done(err);
  22. }, 1000);
  23. }
  24. try {
  25. runTest(index, function (result, screenshot) {
  26. try {
  27. expect(result).to.be.true;
  28. deferredDone();
  29. }
  30. catch (e) {
  31. if (screenshot) {
  32. console.error(screenshot);
  33. }
  34. deferredDone(e);
  35. }
  36. });
  37. }
  38. catch (e) {
  39. deferredDone(e);
  40. }
  41. });
  42. };
  43. });
  44. window.__karma__.start();
  45. }
  46. }, false);
  47. xhr.send();
  48. }