QuickEditContext.behat.inc in Lightning Workflow 8.2
File
tests/contexts/QuickEditContext.behat.inc
View source
<?php
namespace Acquia\LightningExtension\Context;
use Behat\Mink\Exception\ExpectationException;
use Drupal\DrupalExtension\Context\DrupalSubContextBase;
class QuickEditContext extends DrupalSubContextBase {
public function assertEnabled() {
$session = $this
->getSession();
$victory = $session
->wait(10000, 'Drupal.quickedit.collections.entities.length > 0');
if (empty($victory)) {
throw new ExpectationException('Expected Quick Edit to be enabled, but it is not.', $session
->getDriver());
}
}
public function assertDisabled() {
$session = $this
->getSession();
$victory = $session
->wait(10000, 'Drupal.quickedit.collections.entities.length === 0');
if (empty($victory)) {
throw new ExpectationException('Expected Quick Edit to be disabled, but it is not.', $session
->getDriver());
}
}
public function assertBlock($plugin) {
$assert = $this
->assertSession();
$block = $assert
->elementExists('css', 'div[data-block-plugin-id="' . $plugin . '"]');
$links = $assert
->elementExists('css', 'ul.contextual-links', $block);
$assert
->elementExists('named', [
'link',
'Quick edit',
], $links);
}
}