0

I'm running a javascript test that checks some remote file details using the nodejs package ssh2.

My current code works Ok, and the tests completes in a matter of seconds;

var Client = require('ssh2').Client;
var conn = new Client();

conn.on('ready', function() {
    console.log('Client :: ready');
    conn.sftp(function(err, sftp) {
        if (err) throw err;
        sftp.readdir('parkersreviewcontent/', function(err, list) {
            if (err) throw err;

            .... run some assertion...

            conn.end();
        });
    });
})
    .connect({
        host: '******',
        port: **,
        user: '****',
        password: '****',
    });

The next step is for me to run this test as part of my nightwatchjs test suite, using a tag.

var Client = require('ssh2').Client;
var conn = new Client();

module.exports = {
  '@tags': ['bugs']
};

conn.on('ready', function() {
    console.log('Client :: ready');
    conn.sftp(function(err, sftp) {
        if (err) throw err;
        sftp.readdir('parkersreviewcontent/', function(err, list) {
            if (err) throw err;

            .... run some assertion...

            conn.end();
        });
    });
})
    .connect({
        host: '******',
        port: **,
        user: '****',
        password: '****',
    });

However, when I now run the test (with the tag added) via the tag it takes about 5 minutes to run (i.e. for the command prompt to be available again, the actual test again takes 1-2 seconds to perform).

Have I placed the tag command in the wrong place in the script?

Or, is there a command that I need to add that will 'close' the test once its run when using the tag?

Any help would be greatly appreciated. Thanks.

Darren Harley
  • 75
  • 1
  • 18
  • Except for the tagging, I am not able to understand how nightwatchjs is relevant here. you want this to be run along with your other UI tests? – Raju Jun 27 '21 at 08:30
  • Hi @Ragu Yes, I would like to run this as part of a Nightwatchjs test suite. I also run all tests with the 'bugs' tag as a separate build, and would like this test to be included in this 'bugs' test suite. Thanks. – Darren Harley Jun 28 '21 at 09:06

0 Answers0