function FilterTest::waitForVisibleElementCount

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::waitForVisibleElementCount()
  2. 10 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FilterTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FilterTest::waitForVisibleElementCount()

Waits for the specified number of items to be visible.

Parameters

int $count: The number of found elements to wait for.

string|array $locator: The selector locator.

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::waitForVisibleElementCount()
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 126

Class

FilterTest
Tests the add filter handler UI.

Namespace

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

Code

protected function waitForVisibleElementCount($count, $locator, $timeout = 10000) : bool {
  $page = $this->getSession()
    ->getPage();
  return $page->waitFor($timeout / 1000, function () use ($count, $page, $locator) {
    $elements = $page->findAll('css', $locator);
    $visible_elements = $this->filterVisibleElements($elements);
    if (count($visible_elements) === $count) {
      return TRUE;
    }
    return FALSE;
  });
}

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