You are here

public function TestSubContext::resizeWindow in Panopoly 7

Same name and namespace in other branches
  1. 8.2 modules/panopoly/panopoly_test/behat/steps/panopoly_test.behat.inc \TestSubContext::resizeWindow()

Resize the window before first Javascript scenarios.

@BeforeScenario @javascript

File

modules/panopoly/panopoly_test/behat/steps/panopoly_test.behat.inc, line 243
Provide Behat step-definitions for generic Panopoly tests.

Class

TestSubContext

Code

public function resizeWindow($event) {
  if (!$this->window_resized) {
    $session = $this
      ->getSession();
    if (!$session
      ->isStarted()) {
      $session
        ->start();
    }
    $dimensions = getenv('PANOPOLY_BEHAT_WINDOW_SIZE');
    if (!empty($dimensions)) {
      list($width, $height) = explode('x', $dimensions);
      $session
        ->resizeWindow((int) $width, (int) $height, 'current');
    }
    else {
      $session
        ->getDriver()
        ->maximizeWindow();
    }
    $this->window_resized = TRUE;
  }
}