title: Check if a dialog is displayed with Espresso
body: <p>I'm trying to write some tests with the new <a href="https://code.google.com/p/android-test-kit/" rel="noreferrer">android-test-kit (Espresso)</a>. But I can't find any information on <strong>how to</strong> check if a dialog is displayed and perform some actions on it (like clicking the positive and negative buttons, e.t.c.). Note that a dialog may be also displayed by a <code>WebView</code>, not by the application it self.</p>
  
  <p>Any help would be appreciated. I just need a link, or some example code for the basics:</p>
  
  <ol>
  <li>Check if a dialog appears</li>
  <li>Perform clicks on dialog buttons</li>
  <li>Interact with the dialog's inner view (if it's a custom view)</li>
  <li>Preform clicks outside the dialog, and check if it's displaying or not (for example if <code>setCancelable(false)</code> was called on the dialog builder and we want to check that)</li>
  </ol>
  
  <p>Thank you in advice!</p>