function FilterTest::waitForOnlyContentRows

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FilterTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FilterTest::waitForOnlyContentRows()
  2. 10 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FilterTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FilterTest::waitForOnlyContentRows()

Waits for only content rows to be visible.

Parameters

int $timeout: (Optional) Timeout in milliseconds, defaults to 10000.

Return value

bool TRUE if the required number was matched, FALSE otherwise.

1 call to FilterTest::waitForOnlyContentRows()
FilterTest::testAddingFilter in core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FilterTest.php
Tests adding a filter handler.

File

core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FilterTest.php, line 148

Class

FilterTest
Tests the add filter handler UI.

Namespace

Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler

Code

protected function waitForOnlyContentRows($timeout = 10000) {
    $page = $this->getSession()
        ->getPage();
    return $page->waitFor($timeout / 1000, function () use ($page) {
        $handler_rows = $page->findAll('css', 'tr.filterable-option');
        $handler_rows = $this->filterVisibleElements($handler_rows);
        foreach ($handler_rows as $handler_row) {
            // Test that all the visible rows are of the 'content' type.
            if (!str_contains($handler_row->getAttribute('class'), 'content')) {
                return FALSE;
            }
        }
        return TRUE;
    });
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.