You are here

public function PanelsSubContext::createNewContent in Panopoly 8.2

Creates a new widget in the Panels IPE.

@When I create new :widget content in the Panels IPE

File

modules/panopoly/panopoly_test/behat/steps/panopoly_test_panels.behat.inc, line 84
Provide Behat step-definitions for Panels.

Class

PanelsSubContext
Behat sub-context for Panels.

Code

public function createNewContent($widget) {
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->clickLink('Manage Content');
  $this
    ->checkVisible(".ipe-block-picker-list.active");
  $page
    ->clickLink('Create Content');
  $this
    ->checkVisible(".ipe-category-picker-top.active");
  if ($create_link = $page
    ->find('xpath', "//a[@data-block-type and div/h5/text() = '{$widget}']")) {
    $create_link
      ->click();
  }
  else {
    throw new \Exception("Unable to find widget called '{$widget}'");
  }
  $this
    ->checkVisible("form.block-content-form");
}