@Test
public void typesIfSuitableElementExists() {

    String cssSelector = ".something";
    String text = "text";
    String eventName = "TypeTextInElementFoundByCssSelector .something text";
    boolean expectsHttp = true;
    WebElement textBox = mock(WebElement.class);
    WebDriver driver = mock(WebDriver.class);
    when(driver.findElement(By.cssSelector(cssSelector))).thenReturn(textBox);
    SearchContextFunction contextProvider = webDriver1 -> driver;
    WebDriverAction action = new TypeTextInElementFoundByCssSelector(cssSelector, text, expectsHttp, contextProvider);
    action.execute(driver, mock(ReplayingState.class), mock(EventSynchronizer.class));
    verify(textBox).sendKeys(text);
    assertEquals(eventName, action.getName());
    assertEquals(expectsHttp, action.expectsHttpRequest());
}