You are here

protected function CheckoutTest::fieldTypeInput in Commerce Stripe 8

Fills an inputs values by simulated typing.

Parameters

\Behat\Mink\Element\NodeElement $element: The element.

string $value: The value.

Throws

\WebDriver\Exception

1 call to CheckoutTest::fieldTypeInput()
CheckoutTest::fillCreditCardData in tests/src/FunctionalJavascript/CheckoutTest.php
Fills the credit card form inputs.

File

tests/src/FunctionalJavascript/CheckoutTest.php, line 481

Class

CheckoutTest
Tests checkout with Stripe.

Namespace

Drupal\Tests\commerce_stripe\FunctionalJavascript

Code

protected function fieldTypeInput(NodeElement $element, $value) {
  $driver = $this
    ->getSession()
    ->getDriver();
  $element
    ->click();
  if ($driver instanceof Selenium2Driver) {
    $wd_element = $driver
      ->getWebDriverSession()
      ->element('xpath', $element
      ->getXpath());
    foreach (str_split($value) as $char) {
      $wd_element
        ->postValue([
        'value' => [
          $char,
        ],
      ]);
      usleep(100);
    }
  }
  $element
    ->blur();
}