Search code examples
javascriptfor-loopbrowser-automationdalekjsend-to-end

DalekJS - ForLoop inside a test


I'm just experimenting with DalekJS, and I'm trying to get a Forloop to run... but the terminal gives me a... ERROR: Error: socket hang up... I just want to know the proper syntax for loops in DalekJS... any example would be awesome.

module.exports = {
   'lets test some functions': function (test) {
    test.open('https://instagram.com')

        for(var i=0; i<5; i++){
        .wait(5000)
        }
   }
};

whenever I run this test the terminal returns an Error... example ERROR: Error: socket hang up


Solution

  • I had this problem - worked for me when I added "test" to actions inside and after the loop; i.e., test.wait() and test.done()