Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

global-setup.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Magic Mirror Global Setup Test Suite
  3. *
  4. * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
  5. * MIT Licensed.
  6. */
  7. const Application = require("spectron").Application;
  8. const assert = require("assert");
  9. const path = require("path");
  10. const EventEmitter = require("events");
  11. exports.getElectronPath = function () {
  12. let electronPath = path.join(__dirname, "..", "..", "node_modules", ".bin", "electron");
  13. if (process.platform === "win32") {
  14. electronPath += ".cmd";
  15. }
  16. return electronPath;
  17. };
  18. // Set timeout - if this is run as CI Job, increase timeout
  19. exports.setupTimeout = function (test) {
  20. if (process.env.CI) {
  21. jest.setTimeout(30000);
  22. } else {
  23. jest.setTimeout(10000);
  24. }
  25. };
  26. exports.startApplication = function (options) {
  27. const emitter = new EventEmitter();
  28. emitter.setMaxListeners(100);
  29. options.path = exports.getElectronPath();
  30. if (process.env.CI) {
  31. options.startTimeout = 30000;
  32. }
  33. const app = new Application(options);
  34. return app.start().then(function () {
  35. assert.strictEqual(app.isRunning(), true);
  36. return app;
  37. });
  38. };
  39. exports.stopApplication = function (app) {
  40. if (!app || !app.isRunning()) {
  41. return;
  42. }
  43. return app.stop().then(function () {
  44. assert.strictEqual(app.isRunning(), false);
  45. });
  46. };