You are here

public function ModerationContext::assertRestoreFromAutosave in Lightning Workflow 8.3

Restores autosaved work.

@Then I should be able to restore my work

Throws

\Behat\Mink\Exception\ElementNotFoundException If the "Resume editing" button does not appear.

File

tests/contexts/ModerationContext.behat.inc, line 131

Class

ModerationContext
Contains miscellaneous step definitions for testing moderation UIs.

Namespace

Acquia\LightningExtension\Context

Code

public function assertRestoreFromAutosave() {
  $session = $this
    ->getSession();

  /** @var \Behat\Mink\Element\NodeElement $button */
  $button = $session
    ->getPage()
    ->waitFor(10, function (DocumentElement $page) {
    return $page
      ->findButton('Resume editing');
  });
  if ($button) {
    $button
      ->press();
  }
  else {
    throw new ElementNotFoundException($session
      ->getDriver(), 'button', 'named', 'Resume editing');
  }
}