You are here

public function SearchPageTest::testSearchPageContent in Opigno Search 8

Same name and namespace in other branches
  1. 3.x tests/src/Functional/SearchPageTest.php \Drupal\Tests\opigno_learning_path\Functional\SearchPageTest::testSearchPageContent()

Tests search.

File

tests/src/Functional/SearchPageTest.php, line 107

Class

SearchPageTest
Tests for Search process.

Namespace

Drupal\Tests\opigno_learning_path\Functional

Code

public function testSearchPageContent() {
  $this
    ->SearchConfigs();
  $this
    ->IndexationContent();

  // Check if search works fine.
  $this
    ->drupalGet('/search', [
    'query' => [
      'keys' => $this->key,
    ],
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains($this->key);

  // Check if user-logged-in variable is fine.
  $this
    ->assertSession()
    ->elementExists('css', 'body.user-logged-in');

  // Check if highlight works fine.
  $this
    ->assertSession()
    ->elementsCount('css', '.field-content strong', 5);
}