You are here

public function TestSubContext::resizeWindow in Panopoly 8.2

Same name and namespace in other branches
  1. 7 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 248
Provide Behat step-definitions for generic Panopoly tests.

Class

TestSubContext
Behat sub-context for Panopoly.

Code

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