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.

webdriver.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const _1 = __importDefault(require("."));
  7. const constants_1 = require("../../constants");
  8. class WebDriverInterception extends _1.default {
  9. async init() {
  10. const { mockId } = await this.browser.mockRequest(this.url, this.filterOptions);
  11. this.mockId = mockId;
  12. }
  13. get calls() {
  14. return this.browser.call(async () => this.browser.getMockCalls(this.mockId));
  15. }
  16. clear() {
  17. return this.browser.call(async () => this.browser.clearMockCalls(this.mockId));
  18. }
  19. restore() {
  20. return this.browser.call(async () => this.browser.clearMockCalls(this.mockId, true));
  21. }
  22. respond(overwrite, params = {}) {
  23. return this.browser.call(async () => this.browser.respondMock(this.mockId, { overwrite, params, sticky: true }));
  24. }
  25. respondOnce(overwrite, params = {}) {
  26. return this.browser.call(async () => this.browser.respondMock(this.mockId, { overwrite, params }));
  27. }
  28. abort(errorReason, sticky = true) {
  29. if (typeof errorReason !== 'string' || !constants_1.ERROR_REASON.includes(errorReason)) {
  30. throw new Error(`Invalid value for errorReason, allowed are: ${constants_1.ERROR_REASON.join(', ')}`);
  31. }
  32. return this.browser.call(async () => this.browser.respondMock(this.mockId, { errorReason, sticky }));
  33. }
  34. abortOnce(errorReason) {
  35. return this.abort(errorReason, false);
  36. }
  37. }
  38. exports.default = WebDriverInterception;