How to use the chimp.sync function in chimp

To help you get started, we’ve selected a few chimp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TheBrainFamily / chimpy / dist / lib / chimp-helper.js View on Github external
setupGlobals: function setupGlobals() {
    global.wrapAsync = wrapAsync;
    global.wrapAsyncObject = wrapAsyncObject;

    // give users access the request module
    global.request = request;
    _.extend(global, wrapAsyncObject(global, ['request'], {
      syncByDefault: booleanHelper.isTruthy(process.env['chimp.sync'])
    }));

    // Give the user access to Promise functions. E.g. Promise.all.
    global.Promise = Promise;

    if (booleanHelper.isTruthy(process.env['chimp.ddp'])) {
      global.ddp = new DDP().connect();
    }
  },
github TheBrainFamily / chimpy / src / lib / chimp-helper.js View on Github external
setupGlobals: function () {
    global.wrapAsync = wrapAsync;
    global.wrapAsyncObject = wrapAsyncObject;

    // give users access the request module
    global.request = request;
    _.extend(global, wrapAsyncObject(global, ['request'], {
      syncByDefault: booleanHelper.isTruthy(process.env['chimp.sync'])
    }));

    // Give the user access to Promise functions. E.g. Promise.all.
    global.Promise = Promise;

    if (booleanHelper.isTruthy(process.env['chimp.ddp0'])) {
      // add .instances[] property onto the DDP object. this way
      // global.server is usable, but so is server.instances[0] as an alias for when using multiple ddp servers
      global.ddp = new DDP(process.env['chimp.ddp0']).connect();
      // add on instances t
      global.ddp.instances = [];
      for(let key in process.env) {
        if(key.indexOf('chimp.ddp') !== -1 ) {
          var index = key.match(/chimp.ddp(.*)/)[1];
          if (index) {
            global.ddp.instances.push(new DDP(process.env['chimp.ddp' + index]).connect());
github TheBrainFamily / chimpy / dist / lib / chimp-helper.js View on Github external
var webdriverioConfigOptions = JSON.parse(process.env['chimp.webdriverio']);
      var webdriverioOptions = (0, _deepExtend2.default)(webdriverioConfigOptions, {
        desiredCapabilities: {
          browserName: (0, _environmentVariableParsers.parseNullableString)(process.env['chimp.browser']),
          platform: (0, _environmentVariableParsers.parseNullableString)(process.env['chimp.platform']),
          name: (0, _environmentVariableParsers.parseNullableString)(process.env['chimp.name']),
          version: (0, _environmentVariableParsers.parseNullableString)(process.env['chimp.version']),
          deviceName: (0, _environmentVariableParsers.parseNullableString)(process.env['chimp.deviceName'])
        },
        user: (0, _environmentVariableParsers.parseNullableString)(process.env['chimp.user'] || process.env.SAUCE_USERNAME),
        key: (0, _environmentVariableParsers.parseNullableString)(process.env['chimp.key'] || process.env.SAUCE_ACCESS_KEY),
        host: (0, _environmentVariableParsers.parseNullableString)(process.env['chimp.host']),
        port: (0, _environmentVariableParsers.parseNullableInteger)(process.env['chimp.port']),
        logLevel: booleanHelper.isTruthy(process.env['chimp.debug']) ? 'verbose' : webdriverioConfigOptions.logLevel,
        sync: (0, _environmentVariableParsers.parseBoolean)(process.env['chimp.sync'])
      });

      global.sessionManager = new SessionFactory((0, _assign2.default)(_.pick(webdriverioOptions, 'host', 'port', 'user', 'key'), {
        browser: webdriverioOptions.desiredCapabilities.browserName,
        deviceName: webdriverioOptions.desiredCapabilities.deviceName
      }));

      if (booleanHelper.isTruthy(process.env['chimp.watch'])) {
        webdriverioOptions.desiredCapabilities.applicationCacheEnabled = false;
      }

      log.debug('[chimp][helper] webdriverioOptions are ', (0, _stringify2.default)(webdriverioOptions));
      var remoteSession = void 0;
      if ((0, _environmentVariableParsers.parseNullableInteger)(process.env['CUCUMBER_BROWSERS'])) {
        var options = _.clone(webdriverioOptions);
        options.multiBrowser = true;
github TheBrainFamily / chimpy / src / lib / ddp.js View on Github external
DDP.prototype.connect = function () {
  var options = this._getOptions();
  log.debug('[chimp][ddp] Connecting to DDP server', options);
  return wrapAsyncObject(
    new DDPClient(options),
    ['connect', 'call', 'apply', 'callWithRandomSeed', 'subscribe'],
    {syncByDefault: booleanHelper.isTruthy(process.env['chimp.sync'])}
  );
};
github TheBrainFamily / chimpy / src / lib / chimp-helper.js View on Github external
webdriverioConfigOptions,
        {
          desiredCapabilities: {
            browserName: parseNullableString(process.env['chimp.browser']),
            platform: parseNullableString(process.env['chimp.platform']),
            name: parseNullableString(process.env['chimp.name']),
            version: parseNullableString(process.env['chimp.browserVersion']),
            deviceName: parseNullableString(process.env['chimp.deviceName']),
          },
          user: parseNullableString(process.env['chimp.user'] || process.env.SAUCE_USERNAME),
          key: parseNullableString(process.env['chimp.key'] || process.env.SAUCE_ACCESS_KEY),
          host: parseNullableString(process.env['chimp.host']),
          port: parseNullableInteger(process.env['chimp.port']),
          logLevel: booleanHelper.isTruthy(process.env['chimp.debug']) ?
            'verbose' : webdriverioConfigOptions.logLevel,
          sync: parseBoolean(process.env['chimp.sync']),
        }
      );

      global.sessionManager = new SessionFactory(Object.assign(
        _.pick(webdriverioOptions, 'host', 'port', 'user', 'key'),
        {
          browser: webdriverioOptions.desiredCapabilities.browserName,
          deviceName: webdriverioOptions.desiredCapabilities.deviceName,
        }
      ));

      if (booleanHelper.isTruthy(process.env['chimp.watch'])) {
        webdriverioOptions.desiredCapabilities.applicationCacheEnabled = false;
      }

      log.debug('[chimp][helper] webdriverioOptions are ', JSON.stringify(webdriverioOptions));