You are here

protected function PanelsIPETrait::getBlockForm in Lightning Layout 8

Opens the form to add a block to the Panels IPE layout.

Parameters

string $plugin_id: The block plugin ID.

string $category: The category of the block.

Return value

\Behat\Mink\Element\NodeElement The block form.

File

tests/src/Traits/PanelsIPETrait.php, line 26

Class

PanelsIPETrait

Namespace

Drupal\Tests\lightning_layout\Traits

Code

protected function getBlockForm($plugin_id, $category) {
  $assert = $this
    ->assertSession();
  $tab = $this
    ->getTab('Manage Content');
  $category = $assert
    ->elementExists('css', '.ipe-category[data-category="' . $category . '"]', $tab);
  if (!$category
    ->hasClass('active')) {
    $category
      ->click();
    $assert
      ->assertWaitOnAjaxRequest();
  }
  $assert
    ->elementExists('css', '.ipe-block-plugin a[data-plugin-id="' . $plugin_id . '"]', $tab)
    ->click();
  $block_form = $assert
    ->waitForElementVisible('css', '.panels-ipe-block-plugin-form');
  $this
    ->assertNotEmpty($block_form);
  return $block_form;
}