Giter Club home page Giter Club logo

Comments (16)

 avatar commented on June 14, 2024

The database is reseted before each scenario. You need to insert the service configuration after this line.

from qualityfaster.

gerwinbrunner avatar gerwinbrunner commented on June 14, 2024

Do you have a hint how? @sanjo

from qualityfaster.

gerwinbrunner avatar gerwinbrunner commented on June 14, 2024

I have a regular service configuration file like this:

ServiceConfiguration.configurations.remove({
  service: 'facebook',
});

ServiceConfiguration.configurations.insert({
  service: 'facebook',
  appId:   '1x060107363xxxx2',
  secret:  '6x5c67c5xxxxxxxxxcf5e0ab',
});

from qualityfaster.

gerwinbrunner avatar gerwinbrunner commented on June 14, 2024

How would I rerun that file for the tests?

from qualityfaster.

 avatar commented on June 14, 2024

Just expose this code as a function on the server side. The server.execute blocks runs on the server. With ES2015 modules it is:

export function configureServices() {
  ServiceConfiguration.configurations.remove({
    service: 'facebook',
  });

  ServiceConfiguration.configurations.insert({
    service: 'facebook',
    appId:   '1x060107363xxxx2',
    secret:  '6x5c67c5xxxxxxxxxcf5e0ab',
  });
}

Code that comes after https://github.com/xolvio/automated-testing-best-practices/blob/master/tests/step_definitions/critical/support/fixtures/common-fixtures.js#L6:

require('/imports/path/to/services_configurations.js').configureServices();

If you don't use ES2015 modules, you can expose the function on the global scope. global.configureServices = ....

from qualityfaster.

gerwinbrunner avatar gerwinbrunner commented on June 14, 2024

@sanjo I did try it that way, but now I get this error

    Before 
      Error: Error in server.executeReferenceError: _serviceConfigurations is not defined
      ReferenceError: _serviceConfigurations is not defined
        @ evalmachine.<anonymous>:3:11
        @ [object Object].xolvioBackdoor (packages/xolvio:backdoor/server.js:10:54)
        @ maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1704:12)
        @ packages/ddp-server/livedata_server.js:711:19
        @ [object Object]._.extend.withValue (packages/meteor.js:1100:17)
        @ packages/ddp-server/livedata_server.js:709:40
        @ [object Object]._.extend.withValue (packages/meteor.js:1100:17)
        @ packages/ddp-server/livedata_server.js:707:46
        @ tryCallTwo (/Users/ap/.meteor/packages/promise/.0.6.6.1cqifiz++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/lib/core.js:45:5)
        @ doResolve (/Users/ap/.meteor/packages/promise/.0.6.6.1cqifiz++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/lib/core.js:200:13)

So I think there is something meteor serviceConfigurations related missing... :(

from qualityfaster.

gerwinbrunner avatar gerwinbrunner commented on June 14, 2024

@sanjo any ideas on how to solve this?

from qualityfaster.

 avatar commented on June 14, 2024

Post the server.execute code block please.

from qualityfaster.

gerwinbrunner avatar gerwinbrunner commented on June 14, 2024

this is the server block:

    server.execute(function () {
      Package['xolvio:cleaner'].resetDatabase();
      configureServices();
    });

from qualityfaster.

 avatar commented on June 14, 2024

Do you have any idea, in which code the _serviceConfigurations reference is that is mentioned in the error?

from qualityfaster.

gerwinbrunner avatar gerwinbrunner commented on June 14, 2024

Oh that's interesting. The variable exists only in the generated source code:

var require = meteorInstall({"imports":{"infrastructure":{"server":{"serviceConfigurations.js":function(require,exports){

/////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                     //
// imports/infrastructure/server/serviceConfigurations.js                                              //
//                                                                                                     //
/////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                       //
exports.__esModule = true;                                                                             //
exports.configureServices = configureServices;                                                         //
function configureServices() {                                                                         // 1
                                                                                                       //
  console.log("ServiceConfiguration loading");                                                         // 3
                                                                                                       //
  ServiceConfiguration.configurations.remove({                                                         // 5
    service: 'facebook'                                                                                // 6
  });                                                                                                  //
                                                                                                       //
  ServiceConfiguration.configurations.insert({                                                         // 9
    service: 'facebook',                                                                               // 10
    appId: 'xxxx',                                                                         // 11
    secret: 'xxxx'                                                         // 12
  });                                                                                                  //
}                                                                                                      //
/////////////////////////////////////////////////////////////////////////////////////////////////////////

}}}},"entry":{"server":{"module-loader.js":function(require){

/////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                     //
// entry/server/module-loader.js                                                                       //
//                                                                                                     //
/////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                       //
// Force meteor to load modules at build time, so they can be required in Chimp's server.execute       //
// if (false) {                                                                                        //
//   require('./imports/validation');                                                                  //
//   require('./imports/models/account-holder');                                                       //
//   require('./imports/domain/services/bank-service');                                                //
//   require('./imports/domain/services/bank-service/server');                                         //
//   require('./imports/application/services/account-service');                                        //
//   require('./imports/application/services/account-service/server');                                 //
//   require('./imports/application/services/bank-service/server');                                    //
// }                                                                                                   //
/////////////////////////////////////////////////////////////////////////////////////////////////////////

},"main.js":["../../imports/infrastructure/server/serviceConfigurations",function(require){

/////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                     //
// entry/server/main.js                                                                                //
//                                                                                                     //
/////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                       //
var _serviceConfigurations = require('../../imports/infrastructure/server/serviceConfigurations');     // 7
                                                                                                       //
(0, _serviceConfigurations.configureServices)(); // import '../../imports/infrastructure/collections';
// import '../../imports/infrastructure/server/publications';                                          //
// import '../../imports/application/services/bank-service/server/bank-service-api';                   //
                                                                                                       //
//import '../../imports/infrastructure/server/serviceConfigurations';                                  //
/////////////////////////////////////////////////////////////////////////////////////////////////////////

}]}}},{"extensions":[".js",".json",".jsx"]});
require("./entry/server/module-loader.js");
require("./entry/server/main.js");
//# sourceMappingURL=app.js.map

Here is how the original main.js looks like:

// import '../../imports/infrastructure/collections';
// import '../../imports/infrastructure/server/publications';
// import '../../imports/application/services/bank-service/server/bank-service-api';

//import '../../imports/infrastructure/server/serviceConfigurations';

import { configureServices } from '../../imports/infrastructure/server/serviceConfigurations';


configureServices();

from qualityfaster.

 avatar commented on June 14, 2024

Try this:

server.execute(function () {
  Package['xolvio:cleaner'].resetDatabase();
  const { configureServices } = require('/imports/infrastructure/server/serviceConfigurations');
  configureServices();
});

In server.execute you always need to use require instead of import. And you need to specify an absolute path. The root of the path is your app root. Like in the code above.

from qualityfaster.

gerwinbrunner avatar gerwinbrunner commented on June 14, 2024

hmmm... did it. Now I get this error:

      Error: Error in server.executeReferenceError: require is not defined
      ReferenceError: require is not defined
        @ evalmachine.<anonymous>:5:22
        @ [object Object].xolvioBackdoor (packages/xolvio:backdoor/server.js:10:54)
        @ maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1704:12)
        @ packages/ddp-server/livedata_server.js:711:19
        @ [object Object]._.extend.withValue (packages/meteor.js:1100:17)
        @ packages/ddp-server/livedata_server.js:709:40
        @ [object Object]._.extend.withValue (packages/meteor.js:1100:17)
        @ packages/ddp-server/livedata_server.js:707:46
        @ tryCallTwo (/Users/ap/.meteor/packages/promise/.0.6.6.1cqifiz++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/lib/core.js:45:5)

from qualityfaster.

gerwinbrunner avatar gerwinbrunner commented on June 14, 2024

that's the file:

fixtures.common = {
  reset: function () {
    // make sure the DDP connection is not logged in before clearing the database
    server.call('logout');
    server.execute(function () {
      Package['xolvio:cleaner'].resetDatabase({});
      const { configureServices } = require('/imports/infrastructure/server/serviceConfigurations');
    });
  }
};

from qualityfaster.

 avatar commented on June 14, 2024

Install xolvio:[email protected]

Gerwin Brunner [email protected] schrieb am Do., 21. Apr. 2016,
20:24:

that's the file:

fixtures.common = {
reset: function () {
// make sure the DDP connection is not logged in before clearing the database
server.call('logout');
server.execute(function () {
Package['xolvio:cleaner'].resetDatabase({});
//Package['xolvio:cleaner'].resetDatabase({excludedCollections: ['meteor_accounts_loginServiceConfiguration']});
//const { configureServices } = require('/imports/infrastructure/server/serviceConfigurations');
const { configureServices } = require('/imports/infrastructure/server/serviceConfigurations');
});
}
};


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#37 (comment)

from qualityfaster.

gerwinbrunner avatar gerwinbrunner commented on June 14, 2024

that did the trick!
Thanks!

from qualityfaster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.