You are here

class PanelsSubContext in Panopoly 7

Same name and namespace in other branches
  1. 8.2 modules/panopoly/panopoly_test/behat/steps/panopoly_test_panels.behat.inc \PanelsSubContext

Hierarchy

  • class \PanelsSubContext extends \Drupal\DrupalExtension\Context\RawDrupalContext implements \Drupal\DrupalExtension\Context\DrupalSubContextInterface

Expanded class hierarchy of PanelsSubContext

File

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

View source
class PanelsSubContext extends RawDrupalContext implements DrupalSubContextInterface {

  /**
   * Contains the DrupalDriverManager.
   *
   * @var \Drupal\DrupalDriverManager
   */
  private $drupal;

  /**
   * Initializes context.
   */
  public function __construct(DrupalDriverManager $drupal) {
    $this->drupal = $drupal;
  }

  /**
   * Wait until the Panels IPE is activated.
   *
   * @When I wait for the Panels IPE to activate
   */
  public function waitForIPEtoActivate() {
    $this
      ->getSession()
      ->wait(5000, 'jQuery(".panels-ipe-editing").length > 0');
  }

  /**
   * Wait until the Panels IPE is deactivated.
   *
   * @When I wait for the Panels IPE to deactivate
   */
  public function waitForIPEtoDeactivate() {
    $this
      ->getSession()
      ->wait(5000, 'jQuery(".panels-ipe-editing").length === 0');
  }

  /**
   * Enable the Panels IPE if it's available on the current page.
   *
   * @When I customize this page with the Panels IPE
   */
  public function customizeThisPageIPE() {
    $this
      ->getSession()
      ->getDriver()
      ->maximizeWindow();
    $this
      ->waitForIPEtoDeactivate();
    $this
      ->getSession()
      ->getPage()
      ->clickLink('Customize this page');
    $this
      ->waitForIPEtoActivate();
  }

  /**
   * Open 'Change layout' dialog if it's available on the current page.
   *
   * @When I change layout with the Panels IPE
   */
  public function changeLayoutIPE() {
    $this
      ->getSession()
      ->wait(5000, 'jQuery(".panels-choose-layout").length === 0');
    $this
      ->getSession()
      ->getPage()
      ->clickLink('Change layout');
    $this
      ->getSession()
      ->wait(5000, 'jQuery(".panels-choose-layout").length > 0');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PanelsSubContext::$drupal private property Contains the DrupalDriverManager.
PanelsSubContext::changeLayoutIPE public function Open 'Change layout' dialog if it's available on the current page.
PanelsSubContext::customizeThisPageIPE public function Enable the Panels IPE if it's available on the current page.
PanelsSubContext::waitForIPEtoActivate public function Wait until the Panels IPE is activated.
PanelsSubContext::waitForIPEtoDeactivate public function Wait until the Panels IPE is deactivated.
PanelsSubContext::__construct public function Initializes context.