You are here

public function CheckoutTest::assertWaitForText in Commerce Stripe 8

Asserts text will become visible on the page.

Parameters

string $text: The text.

int $wait: The wait time, in seconds.

Return value

bool Returns TRUE if operation succeeds.

Throws

\Exception

7 calls to CheckoutTest::assertWaitForText()
CheckoutTest::complete3ds in tests/src/FunctionalJavascript/CheckoutTest.php
Completes 3DS authentication using Stripe's modal.
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.

... See full list

File

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

Class

CheckoutTest
Tests checkout with Stripe.

Namespace

Drupal\Tests\commerce_stripe\FunctionalJavascript

Code

public function assertWaitForText($text, $wait = 20) {
  $last_exception = NULL;
  $stopTime = time() + $wait;
  while (time() < $stopTime) {
    try {
      $this
        ->assertSession()
        ->pageTextContains($text);
      return TRUE;
    } catch (\Exception $e) {

      // If the text has not been found, keep waiting.
      $last_exception = $e;
    }
    usleep(250000);
  }
  $this
    ->createScreenshot('../challenge_frame_wtf.png');
  throw $last_exception;
}