Monday, 17 April 2017

nightwatch like web services in loopback framework

Hello I have created an api rest with node and loopback, and now I would like to run nightwatch as web service, Is it possible to do that? I'm testing with the node exec, but it seems to skip it.

'use strict';
module.exports = function(Person) {

Person.tester = function(cb) {
    var cp = require('child_process');
    var response="Hello Reponse";

    cp.exec('nightwatch ./tests/google -c ./nightwatch.conf.js', (error, stdout, stderr) => {
      if (error) {
        console.error('exec error:'+ error);
        return;
      }
      console.log('stdout:'+stdout);
      console.log('stderr:'+stderr);
    });

    console.log(response);
    cb(null, response);
  };

    Person.remoteMethod(
    'tester', {
      http: {
        path: '/tester',
        verb: 'get'
      },
      returns: {
        arg: 'status',
        type: 'string'
      }
    }
  );



};



via jcarlosweb

No comments:

Post a Comment