@Test
    public void typeTextInInput_clickButton_SubmitsForm() {
        // Lazily launch the Activity with a custom start Intent per test
        mActivityRule.launchActivity(withWebFormIntent());

        // Selects the WebView in your layout. If you have multiple WebViews you can also use a
        // matcher to select a given WebView, onWebView(withId(R.id.web_view)).
        onWebView()
                // Find the input element by ID
                .withElement(findElement(Locator.ID, "text_input"))
                // Clear previous input
                .perform(clearElement())
                // Enter text into the input element
                .perform(DriverAtoms.webKeys(MACCHIATO))
                // Find the submit button
                .withElement(findElement(Locator.ID, "submitBtn"))
                // Simulate a click via javascript
                .perform(webClick())
                // Find the response element by ID
                .withElement(findElement(Locator.ID, "response"))
                // Verify that the response page contains the entered text
                .check(webMatches(getText(), containsString(MACCHIATO)));
    }
A JUnit {@link Rule @Rule} to launch your activity under test. This is a replacement
for {@link android.test.ActivityInstrumentationTestCase2}.
<p>
Rules are interceptors which are executed for each test method and will run before
any of your setup code in the {@link Before @Before} method.
<p>
{@link ActivityTestRule} will create and launch of the activity for you and also expose
the activity under test. To get a reference to the activity you can use
the {@link ActivityTestRule#getActivity()} method.
ui/espresso/WebBasicSample/app/src/androidTest/java/com/example/android/testing/espresso/web/BasicSample/WebViewActivityTest.java