I am using async/await on forEach, but in some cases, when there is an issue inside loop, Nightwatch shows the error in the next scenario/step (there is something that is running as asynchronous and I need it step by step).
            Asked
            
        
        
            Active
            
        
            Viewed 562 times
        
    0
            
            
        - 
                    forEach and async don't mix up well together, please read: https://stackoverflow.com/a/37576787/823732 – MMalke Mar 28 '21 at 14:24
1 Answers
0
            Nightwatch use the function perform() to make asynchonous commands synchronous
browser.perform(done=> {
   Promise.all(#####ALL_YOUR_PROMISES_TO_RESOLVE#####).then(done).catch(done);
})
or you could also do something like
    myArray.forEach(one => {
       browser.perform(done=> {
          STUFFS_TO_DO;
          done();
       })
    })
 
    
    
        RmXbdX
        
- 51
- 2
