You are here

protected function LingotekTargetActionsTest::waitForVisibleElementCount in Lingotek Translation 3.6.x

Same name and namespace in other branches
  1. 4.0.x tests/src/FunctionalJavascript/LingotekTargetActionsTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekTargetActionsTest::waitForVisibleElementCount()
  2. 3.7.x tests/src/FunctionalJavascript/LingotekTargetActionsTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekTargetActionsTest::waitForVisibleElementCount()
  3. 3.8.x tests/src/FunctionalJavascript/LingotekTargetActionsTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekTargetActionsTest::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.

2 calls to LingotekTargetActionsTest::waitForVisibleElementCount()
LingotekTargetActionsTest::testDropdownTargetStatus in tests/src/FunctionalJavascript/LingotekTargetActionsTest.php
Tests that the supported locales are rendered.
LingotekTargetActionsTest::testDropdownTargetStatuses in tests/src/FunctionalJavascript/LingotekTargetActionsTest.php
Tests that the supported locales are rendered.

File

tests/src/FunctionalJavascript/LingotekTargetActionsTest.php, line 154

Class

LingotekTargetActionsTest
@group lingotek

Namespace

Drupal\Tests\lingotek\FunctionalJavascript

Code

protected function waitForVisibleElementCount($count, $locator, $timeout = 10000) {
  $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;
  });
}