You are here

protected function CommandsTest::assertWaitPageContains in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php \Drupal\FunctionalJavascriptTests\Ajax\CommandsTest::assertWaitPageContains()
  2. 9 core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php \Drupal\FunctionalJavascriptTests\Ajax\CommandsTest::assertWaitPageContains()

Asserts that page contains a text after waiting.

@internal

Parameters

string $text: A needle text.

1 call to CommandsTest::assertWaitPageContains()
CommandsTest::testAjaxCommands in core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php
Tests the various Ajax Commands.

File

core/tests/Drupal/FunctionalJavascriptTests/Ajax/CommandsTest.php, line 151

Class

CommandsTest
Performs tests on AJAX framework commands.

Namespace

Drupal\FunctionalJavascriptTests\Ajax

Code

protected function assertWaitPageContains(string $text) : void {
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->waitFor(10, function () use ($page, $text) {
    return stripos($page
      ->getContent(), $text) !== FALSE;
  });
  $this
    ->assertStringContainsString($text, $page
    ->getContent());
}