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.

index.js 776B

123456789101112131415161718192021222324252627282930313233
  1. function plugin (wdInstance, requests) {
  2. if (typeof wdInstance.addCommand !== "function") {
  3. throw new Error("You can't use WebdriverAjaxStub with this version of WebdriverIO");
  4. }
  5. function stub({template, data}, done) {
  6. window.XMLHttpRequest = function () {
  7. this.open = function (method, url) {
  8. this.method = method;
  9. this.url = url;
  10. };
  11. this.send = function () {
  12. this.status = 200;
  13. this.readyState = 4;
  14. const response = this.url.includes(".njk") ? template : data;
  15. this.response = response;
  16. this.responseText = response;
  17. this.onreadystatechange();
  18. };
  19. return this;
  20. };
  21. done();
  22. }
  23. wdInstance.addCommand("setupStub", function() {
  24. return wdInstance.executeAsync(stub, requests);
  25. });
  26. }
  27. module.exports.init = plugin;