You are here

protected function CheckoutTest::complete3ds in Commerce Stripe 8

Completes 3DS authentication using Stripe's modal.

Parameters

bool $pass: Whether to pass or fail the 3DS authentication.

bool $payment: Whether this is a payment or non-payment 3DS.

Throws

\Behat\Mink\Exception\ElementNotFoundException

4 calls to CheckoutTest::complete3ds()
CheckoutTest::test3dsAlwaysAuthenticate in tests/src/FunctionalJavascript/CheckoutTest.php
Tests customer, with regulations, 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.

File

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

Class

CheckoutTest
Tests checkout with Stripe.

Namespace

Drupal\Tests\commerce_stripe\FunctionalJavascript

Code

protected function complete3ds($pass, $payment = TRUE) {
  $text = 'This is a 3D Secure non-payment authentication test page.';
  if ($payment) {
    $text = '3D Secure Test Payment Page';
  }
  $this
    ->waitForStripe();
  $this
    ->switchToFrame('__privateStripeFrame');
  $this
    ->switchToFrame('challengeFrame');
  $this
    ->switchToFrame('acsFrame');
  $this
    ->assertWaitForText($text);
  $button = $pass ? 'Complete authentication' : 'Fail authentication';
  $this
    ->getSession()
    ->getPage()
    ->pressButton($button);
  $this
    ->getSession()
    ->switchToWindow();
}