mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 14:03:52 +01:00
Merge branch 'MDL-82782-404' of https://github.com/andrewnicols/moodle into MOODLE_404_STABLE
This commit is contained in:
commit
833b48fc75
@ -744,9 +744,14 @@ trait behat_session_trait {
|
||||
*
|
||||
* @param string $windowsize size of window.
|
||||
* @param bool $viewport If true, changes viewport rather than window size
|
||||
* @param bool $scalesize Whether to scale the size by the WINDOWSCALE environment variable
|
||||
* @throws ExpectationException
|
||||
*/
|
||||
protected function resize_window($windowsize, $viewport = false) {
|
||||
protected function resize_window(
|
||||
string $windowsize,
|
||||
bool $viewport = false,
|
||||
bool $scalesize = true,
|
||||
): void {
|
||||
global $CFG;
|
||||
|
||||
// Non JS don't support resize window.
|
||||
@ -790,6 +795,16 @@ trait behat_session_trait {
|
||||
$height *= $CFG->behat_window_size_modifier;
|
||||
}
|
||||
|
||||
if ($scalesize) {
|
||||
// Scale the window size by the WINDOWSCALE environment variable.
|
||||
// This is intended to be used for Behat reruns to negate the impact of browser window size issues.
|
||||
// This allows a per-run, runtime configuration of the scaling, unlike behat_window_size_modifier which
|
||||
// typically applies to all runs.
|
||||
$scalefactor = getenv('WINDOWSCALE') ? floatval(getenv('WINDOWSCALE')) : 1;
|
||||
$width *= $scalefactor;
|
||||
$height *= $scalefactor;
|
||||
}
|
||||
|
||||
if ($viewport) {
|
||||
// When setting viewport size, we set it so that the document width will be exactly
|
||||
// as specified, assuming that there is a vertical scrollbar. (In cases where there is
|
||||
|
@ -1327,12 +1327,22 @@ EOF;
|
||||
* browser window has same viewport size even when you run Behat on multiple operating systems.
|
||||
*
|
||||
* @throws ExpectationException
|
||||
* @Then /^I change (window|viewport) size to "(mobile|tablet|small|medium|large|\d+x\d+)"$/
|
||||
* @Then /^I change the (window|viewport) size to "(mobile|tablet|small|medium|large|\d+x\d+)"$/
|
||||
* @Then /^I change (window|viewport) size to "(mobile|tablet|small|medium|large|\d+x\d+)"( without runtime scaling)?$/
|
||||
* @Then /^I change the (window|viewport) size to "(mobile|tablet|small|medium|large|\d+x\d+)"( without runtime scaling)?$/
|
||||
* @param string $windowviewport Whether this is a window or viewport size hcange
|
||||
* @param string $windowsize size of the window (mobile|tablet|small|medium|large|wxh).
|
||||
* @param null|string $scale whether to lock runtime scaling (string) or to allow it (null)
|
||||
*/
|
||||
public function i_change_window_size_to($windowviewport, $windowsize) {
|
||||
$this->resize_window($windowsize, $windowviewport === 'viewport');
|
||||
public function i_change_window_size_to(
|
||||
$windowviewport,
|
||||
$windowsize,
|
||||
?string $scale = null,
|
||||
): void {
|
||||
$this->resize_window(
|
||||
$windowsize,
|
||||
$windowviewport === 'viewport',
|
||||
$scale === null,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user