You are here

public function GlossaryViewTest::testGlossaryDefault in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php \Drupal\Tests\views\FunctionalJavascript\GlossaryViewTest::testGlossaryDefault()
  2. 9 core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php \Drupal\Tests\views\FunctionalJavascript\GlossaryViewTest::testGlossaryDefault()

Tests the AJAX callbacks for the glossary view.

File

core/modules/views/tests/src/FunctionalJavascript/GlossaryViewTest.php, line 83

Class

GlossaryViewTest
Tests the basic AJAX functionality of the Glossary View.

Namespace

Drupal\Tests\views\FunctionalJavascript

Code

public function testGlossaryDefault() {

  // Visit the default Glossary page.
  $url = Url::fromRoute('view.test_glossary.page_1');
  $this
    ->drupalGet($url);
  $session = $this
    ->getSession();
  $web_assert = $this
    ->assertSession();
  $page = $session
    ->getPage();
  $rows = $page
    ->findAll('css', '.view-test-glossary tr');

  // We expect 2 rows plus the header row.
  $this
    ->assertCount(3, $rows);

  // Click on the P link, this should show 4 rows plus the header row.
  $page
    ->clickLink('P');
  $web_assert
    ->assertWaitOnAjaxRequest();
  $rows = $page
    ->findAll('css', '.view-test-glossary tr');
  $this
    ->assertCount(5, $rows);
}