title: Intern reporting and error handling
body: <p>I started reading about automated testing of web apps a couple of days ago, and after a lot of trial and error (and <a href="https://github.com/theintern/intern-tutorial" rel="nofollow">tutorial</a>) finally somehow managed to run couple of Intern functional tests both locally and on BrowserStack but one thing that I can't wrap my head around is the reporting. </p>
  
  <p>For example, i have a simple test that fills in some login page data, submits the form, and checks if everything is ok. </p>
  
  <p>The code might look something like this:</p>
  
  <pre><code>define(function (require) {
      var registerSuite = require('intern!object');
      var assert = require('intern/chai!assert');
      var fs = require('intern/dojo/node!fs');
  
      registerSuite({
          name: 'index',
  
          'Log in test': function () {
              var user = 'username';
              var pass = 'pAsssWord';
  
              return this.remote                
                  .get(require.toUrl('http://localhost/MyApp/'))
                  .setFindTimeout(20000)                              
  
                  //fill in username
                  .findDisplayedByCssSelector('#panelUsernamePassword .usernameField')                
                      .click()
                      .clearValue()
                      .type(user)
                      .end()
  
                  //fill in password
                  .findDisplayedByCssSelector('#panelUsernamePassword .passwordField')                
                      .click()
                      .clearValue()
                      .type(pass)
                      .end()
                  .takeScreenshot()
                  .then(function(data) {
                      fs.writeFileSync("after-data-filled.png", data, 'base64');
                  })  
                  //click login button
                  .findDisplayedByCssSelector('#panelUsernamePassword button')
                  .click()
                  .end()
                  .sleep(500)
                  .takeScreenshot()
                  .then(function(data) {
                      fs.writeFileSync("after-login-pressed.png", data, 'base64');
                  })
                  //click popup close button
                  .findDisplayedByCssSelector('div[id$="close-button"]')
                  .click()
                  .end()
                  .sleep(500)
                  .takeScreenshot()
                  .then(function(data) {
                      fs.writeFileSync("no-popup.png", data, 'base64');
                  })              
                  .end();
          }
      });
  });
  </code></pre>
  
  <p>After running <code>intern-runner config=tests/intern.js</code></p>
  
  <p>the test will pass, and I'll have in a console window something like </p>
  
  <pre><code>    Listening on 0.0.0.0:9000
      Tunnel started
      ‣ Created session chrome 39 on WINDOWS (c7873066-b185-4025-a93a-829ea0fdb364)
      ✓ chrome 39 on WINDOWS - index - Log in test (15.393s)
      No unit test coverage for chrome 39 on WINDOWS
      chrome 39 on WINDOWS: 0/1 tests failed
  </code></pre>
  
  <p>OK, if the test passes, I don't really need much info, all is well, but on the other hand if in the test i have something like:</p>
  
  <pre><code>.findDisplayedByCssSelector('#thisIsSomethingThatIsNotOnThePage')
  </code></pre>
  
  <p>Only info I get about the failure is:</p>
  
  <pre><code>NoSuchElement: An element could not be located on the page using the given search parameters.
  </code></pre>
  
  <p>Is there any way to know which element on the page is not found? Maybe I'm doing something wrong?</p>
  
  <p>Thank you</p>
  
  <p>EDIT:</p>
  
  <p>Full error summary:</p>
  
  <pre><code>× chrome 47 on WINDOWS - index - Log in test
  NoSuchElement: An element could not be located on the page using the given search parameters.
    at &lt;..\..\AppData\Roaming\npm\node_modules\intern\node_modules\leadfoot\lib\findDisplayed.js:37:21&gt;
    at &lt;..\..\AppData\Roaming\npm\node_modules\intern\node_modules\dojo\Promise.ts:393:15&gt;
    at run  &lt;..\..\AppData\Roaming\npm\node_modules\intern\node_modules\dojo\Promise.ts:237:7&gt;
    at &lt;..\..\AppData\Roaming\npm\node_modules\intern\node_modules\dojo\nextTick.ts:44:3&gt;
    at doNTCallback0  &lt;node.js:419:9&gt;
    at process._tickCallback  &lt;node.js:348:13&gt;
    at Command.findDisplayed  &lt;..\..\AppData\Roaming\npm\node_modules\intern\node_modules\leadfoot\Command.js:23:10&gt;
    at Command.prototype.(anonymous function) [as findDisplayedByCssSelector]  &lt;..\..\AppData\Roaming\npm\node_modules\intern\node_modules\leadfoot\lib\strategies.js:28:16&gt;
    at Test.registerSuite.Log in test [as test]  &lt;tests\functional\index.js:21:6&gt;
    at &lt;..\..\AppData\Roaming\npm\node_modules\intern\lib\Test.js:211:24&gt;
    at &lt;..\..\AppData\Roaming\npm\node_modules\intern\node_modules\dojo\Promise.ts:393:15&gt;
    at runCallbacks  &lt;..\..\AppData\Roaming\npm\node_modules\intern\node_modules\dojo\Promise.ts:11:11&gt;
    at &lt;..\..\AppData\Roaming\npm\node_modules\intern\node_modules\dojo\Promise.ts:317:4&gt;
    at run  &lt;..\..\AppData\Roaming\npm\node_modules\intern\node_modules\dojo\Promise.ts:237:7&gt;
    at &lt;..\..\AppData\Roaming\npm\node_modules\intern\node_modules\dojo\nextTick.ts:44:3&gt;
    at doNTCallback0  &lt;node.js:419:9&gt;
  </code></pre>