protected function MigrateUiParagraphsTestBase::assertPageTitle

Pass if the page HTML title is the given string.

Parameters

string $expected_title: The string the page title should be.

Throws

\Behat\Mink\Exception\ExpectationException Thrown when element doesn't exist, or the title is a different one.

File

paragraphs/tests/src/Functional/Migrate/MigrateUiParagraphsTestBase.php, line 497

Class

MigrateUiParagraphsTestBase
Provides a base class for testing Paragraphs migration via the UI.

Namespace

Drupal\Tests\paragraphs\Functional\Migrate

Code

protected function assertPageTitle($expected_title) {
  $page_title_element = $this
    ->getSession()
    ->getPage()
    ->find('css', 'h1.page-title');
  if (!$page_title_element) {
    throw new ExpectationException('No page title element found on the page', $this
      ->getSession()
      ->getDriver());
  }
  $actual_title = $page_title_element
    ->getText();
  $this
    ->assertSame($expected_title, $actual_title, 'The page title is not the same as expected.');
}