You are here

protected function PanelsIPETestTrait::getOnScreenBlockIDs in Panels 8.4

Same name and namespace in other branches
  1. 8.3 panels_ipe/tests/src/FunctionalJavascript/PanelsIPETestTrait.php \Drupal\Tests\panels_ipe\FunctionalJavascript\PanelsIPETestTrait::getOnScreenBlockIDs()

Grabs the current Block IDs from the page.

This is required as Block IDs are randomly generated when blocks are placed, so you can't predict their IDs beforehand.

Return value

array An array of Block IDs.

1 call to PanelsIPETestTrait::getOnScreenBlockIDs()
PanelsIPETestTrait::addBlock in panels_ipe/tests/src/FunctionalJavascript/PanelsIPETestTrait.php
Adds a Block (Plugin) to the page.

File

panels_ipe/tests/src/FunctionalJavascript/PanelsIPETestTrait.php, line 238

Class

PanelsIPETestTrait
Trait which can be used to test Panels IPE components.

Namespace

Drupal\Tests\panels_ipe\FunctionalJavascript

Code

protected function getOnScreenBlockIDs() {
  $block_ids = [];
  $session = $this
    ->getSession();
  $blocks = $session
    ->getPage()
    ->findAll('css', '[data-block-id]');
  if (count($blocks)) {

    /** @var \Behat\Mink\Element\NodeElement $block */
    foreach ($blocks as $block) {
      $block_ids[] = $block
        ->getAttribute('data-block-id');
    }
  }
  return $block_ids;
}