title: testing form validation with HTML5 validation API and pseudo-selector with nightwatch API
body: <p>I have a typical login form with email and password and submit button. Password and email fields are required, i.e. the required attribute on the form is set. This is such that when the user clicks submit and for instance the email field is empty, the error 'Please fill in the field' pops up. That works fine in manual testing. </p>
  
  <p>The issue is that I want to automate that check with nightwatch, and I thought of the following :</p>
  
  <ul>
  <li><p>using <code>:invalid</code> pseudo-selector : <code>.assert.cssClassPresent('.c-textfield__input--password', ':invalid')</code>. However, this fails as it only finds <code>.c-textfield__input--password</code> as a class defined on the input element.</p></li>
  <li><p>access the <code>validity</code> property (<code>.assert.attributeEquals('.c-textfield__input--email', 'validity', 'somevalue)</code>). But that fails too.</p></li>
  </ul>
  
  <p><code>
  Testing if attribute validity of &lt;.c-textfield__input--email&gt; equals "somevalue". Element does not have a validity attribute.  - expected "somevalue" but got: "null"
  </code> </p>
  
  <p>Does anybody know how to automate the form validation testing? </p>