You are here

protected function AutosaveFormTestBase::waitForElementToDisappear in Autosave Form 8

Waits for the specified selector and to disappear.

Parameters

string $selector: The selector engine name. See ElementInterface::findAll() for the supported selectors.

string|array $locator: The selector locator.

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

Return value

bool TRUE, if the element has disappeared, FALSE otherwise.

1 call to AutosaveFormTestBase::waitForElementToDisappear()
AutosaveFormTestBase::waitForAutosaveResumeButtonToDisappear in tests/src/FunctionalJavascript/AutosaveFormTestBase.php
Waits for the autosave restore button to disappear.

File

tests/src/FunctionalJavascript/AutosaveFormTestBase.php, line 220

Class

AutosaveFormTestBase
Basic functionality for autosave form tests.

Namespace

Drupal\Tests\autosave_form\FunctionalJavascript

Code

protected function waitForElementToDisappear($selector, $locator, $timeout = 10000) {
  $page = $this
    ->getSession()
    ->getPage();
  $result = $page
    ->waitFor($timeout / 1000, function () use ($page, $selector, $locator) {
    $element = $page
      ->find($selector, $locator);
    if (empty($element)) {
      return TRUE;
    }
    return FALSE;
  });
  return $result;
}