public function ModerationContext::awaitAutosave in Lightning Workflow 8.3
Autosaves the current form.
@When I wait for my work to be autosaved
Throws
\Behat\Mink\Exception\ExpectationException If the autosave notification does not appear or disappear as expected.
File
- tests/contexts/ ModerationContext.behat.inc, line 102 
Class
- ModerationContext
- Contains miscellaneous step definitions for testing moderation UIs.
Namespace
Acquia\LightningExtension\ContextCode
public function awaitAutosave() {
  $driver = $this
    ->getSession()
    ->getDriver();
  $element = $this
    ->assertSession()
    ->elementExists('css', '#autosave-notification');
  $is_visible = $element
    ->waitFor(20, function (NodeElement $element) {
    return $element
      ->isVisible();
  });
  if ($is_visible == FALSE) {
    throw new ExpectationException('Expected autosave notification to appear, but it did not.', $driver);
  }
  $is_hidden = $element
    ->waitFor(10, function (NodeElement $element) {
    return $element
      ->isVisible() === FALSE;
  });
  if ($is_hidden == FALSE) {
    throw new ExpectationException('Expected autosave notification to disappear after saving, but it did not.', $driver);
  }
}