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.

protocol-stub.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const utils_1 = require("@wdio/utils");
  4. const WARN_ON_COMMANDS = ['addCommand', 'overwriteCommand'];
  5. class ProtocolStub {
  6. static async newSession(options = {}) {
  7. const capabilities = emulateSessionCapabilities((options.capabilities || {}));
  8. const browser = addCommands({
  9. capabilities,
  10. ...utils_1.capabilitiesEnvironmentDetector(capabilities, options._automationProtocol || 'webdriver')
  11. });
  12. return browser;
  13. }
  14. static reloadSession() {
  15. throw new Error('Protocol Stub: Make sure to start webdriver or devtools session before reloading it.');
  16. }
  17. static attachToSession(options, modifier) {
  18. if (options || !modifier) {
  19. return ProtocolStub.newSession(options);
  20. }
  21. return addCommands(modifier({
  22. commandList: []
  23. }));
  24. }
  25. }
  26. exports.default = ProtocolStub;
  27. function addCommands(browser) {
  28. WARN_ON_COMMANDS.forEach((commandName) => {
  29. browser[commandName] = commandNotAvailable(commandName);
  30. });
  31. return browser;
  32. }
  33. function emulateSessionCapabilities(caps) {
  34. const capabilities = {};
  35. Object.entries(caps).forEach(([key, value]) => {
  36. const newKey = key.replace('appium:', '');
  37. capabilities[newKey] = value;
  38. });
  39. if (caps.browserName && caps.browserName.toLowerCase() === 'chrome') {
  40. capabilities.chrome = true;
  41. }
  42. return capabilities;
  43. }
  44. function commandNotAvailable(commandName) {
  45. return () => { throw new Error(`Unable to use '${commandName}' before browser session is started.`); };
  46. }