MOBILE-4270 behat: Fix default window size
Tests were already running with these dimensions, but we hadn't noticed because unless the tests are run in headless mode, the minimum width is 500px.main
parent
b3b269c8d7
commit
dbd96d7181
|
@ -45,7 +45,6 @@ class behat_app extends behat_app_helper {
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $featurepath = '';
|
protected $featurepath = '';
|
||||||
protected $windowsize = '360x720';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @BeforeScenario
|
* @BeforeScenario
|
||||||
|
|
|
@ -201,7 +201,7 @@ class behat_app_helper extends behat_base {
|
||||||
$restart = true;
|
$restart = true;
|
||||||
|
|
||||||
// Reset its size.
|
// Reset its size.
|
||||||
$this->resize_window($this->windowsize, true);
|
$this->resize_app_window();
|
||||||
|
|
||||||
// Visit the Ionic URL.
|
// Visit the Ionic URL.
|
||||||
$this->getSession()->visit($this->get_app_url());
|
$this->getSession()->visit($this->get_app_url());
|
||||||
|
@ -596,4 +596,18 @@ EOF;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resize window to have app dimensions.
|
||||||
|
*/
|
||||||
|
protected function resize_app_window() {
|
||||||
|
$width = 500;
|
||||||
|
$height = 720;
|
||||||
|
$offset = $this->evaluate_script("{
|
||||||
|
x: window.outerWidth - document.body.offsetWidth,
|
||||||
|
y: window.outerHeight - window.innerHeight,
|
||||||
|
}");
|
||||||
|
|
||||||
|
$this->getSession()->getDriver()->resizeWindow($width + $offset['x'], $height + $offset['y']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue