title: Unable to use ForEach loop to iterate array values under a test case using Nightwatch
body: <pre><code>const namesArray = [&quot;Red&quot;, &quot;Blue&quot;, &quot;Orange&quot;]
  module.exports = {
  
      'Delete all the items' (browser){
          namesArray.forEach(myFunction);
          console.log(&quot;entered&quot;)  // doesn't print to the console.
  
          function myFunction(value){
              browser
                  .useXpath().click(`//span[text() = &quot;${value}&quot;]`)
                  //rest of the code
          }
      }
  }
  </code></pre>
  <p>I'm using Nightwatch to automate UI.</p>
  <p>First query: I want to loop the array values within a test case. The problem is when I'm doing like this, nothing gets executed under this test case and the next test case starts executing. When I'm looping the array out of the test case then it works fine.</p>
  <p>Second query: console.log(&quot;Any text&quot;) also doesn't execute if I write it in a test case.
  Why both of them works fine out of the test case and not under it?</p>
  <p>NOTE: this is just a sample code.</p>