You are here

protected function CheckoutTest::fillCreditCardData in Commerce Stripe 8

Fills the credit card form inputs.

Parameters

string $card_number: The card number.

string $card_exp: The card expiration.

string $card_cvv: The card CVV.

Throws

\Behat\Mink\Exception\ElementNotFoundException

\Behat\Mink\Exception\ResponseTextException

\WebDriver\Exception

6 calls to CheckoutTest::fillCreditCardData()
CheckoutTest::test3dsAlwaysAuthenticate in tests/src/FunctionalJavascript/CheckoutTest.php
Tests customer, with regulations, can checkout.
CheckoutTest::testCheckoutAndPayment in tests/src/FunctionalJavascript/CheckoutTest.php
Tests an anonymous customer can checkout.
CheckoutTest::testCheckoutAndPayPayment3ds in tests/src/FunctionalJavascript/CheckoutTest.php
Tests customer, with regulations, can checkout.
CheckoutTest::testCheckoutWithExistingPaymentMethod in tests/src/FunctionalJavascript/CheckoutTest.php
Tests checkout with a previously created payment method.
CheckoutTest::testCheckoutWithExistingPaymentMethodOffSession in tests/src/FunctionalJavascript/CheckoutTest.php
Tests checkout with a previously created payment method.

... See full list

File

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

Class

CheckoutTest
Tests checkout with Stripe.

Namespace

Drupal\Tests\commerce_stripe\FunctionalJavascript

Code

protected function fillCreditCardData($card_number, $card_exp, $card_cvv) {
  $this
    ->switchToElementFrame('card-number-element');
  $element = $this
    ->getSession()
    ->getPage()
    ->findField('cardnumber');
  $this
    ->fieldTypeInput($element, $card_number);
  $this
    ->getSession()
    ->switchToIFrame();
  $this
    ->assertSession()
    ->pageTextNotContains('Your card number is invalid.');
  $this
    ->switchToElementFrame('expiration-element');
  $element = $this
    ->getSession()
    ->getPage()
    ->findField('exp-date');
  $this
    ->fieldTypeInput($element, $card_exp);
  $this
    ->getSession()
    ->switchToIFrame();
  $this
    ->switchToElementFrame('security-code-element');
  $this
    ->getSession()
    ->getPage()
    ->fillField('cvc', $card_cvv);
  $this
    ->getSession()
    ->switchToIFrame();
}