integration.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. // Run tests
  10. for (let index = 0; index < config.tests.length; index++) {
  11. var test = config.tests[index];
  12. if (test.onlyVisual || test.excludeFromAutomaticTesting) {
  13. continue;
  14. }
  15. it(test.title, function (done) {
  16. this.timeout(60000);
  17. var deferredDone = function (err) {
  18. setTimeout(function () {
  19. done(err);
  20. }, 3000);
  21. }
  22. try {
  23. runTest(index, function (result, screenshot) {
  24. try {
  25. expect(result).to.be.true;
  26. deferredDone();
  27. }
  28. catch (e) {
  29. if (screenshot) {
  30. console.error(screenshot);
  31. }
  32. deferredDone(e);
  33. }
  34. });
  35. }
  36. catch (e) {
  37. deferredDone(e);
  38. }
  39. });
  40. };
  41. });
  42. window.__karma__.start();
  43. }
  44. }, false);
  45. xhr.send();