Merge branch 'MDL-67657-master' of git://github.com/andrewnicols/moodle
commit
9f075c35a7
|
@ -297,8 +297,7 @@ class behat_app extends behat_base {
|
|||
}, false, 60);
|
||||
|
||||
// Run the scripts to install Moodle 'pending' checks.
|
||||
$this->getSession()->executeScript(
|
||||
file_get_contents(__DIR__ . '/app_behat_runtime.js'));
|
||||
$this->execute_script(file_get_contents(__DIR__ . '/app_behat_runtime.js'));
|
||||
|
||||
// Wait until the site login field appears OR the main page.
|
||||
$situation = $this->spin(
|
||||
|
@ -373,8 +372,7 @@ class behat_app extends behat_base {
|
|||
*/
|
||||
public function i_press_the_standard_button_in_the_app(string $button) {
|
||||
$this->spin(function($context, $args) use ($button) {
|
||||
$result = $this->getSession()->evaluateScript('return window.behat.pressStandard("' .
|
||||
$button . '");');
|
||||
$result = $this->evaluate_script("return window.behat.pressStandard('{$button}');");
|
||||
if ($result !== 'OK') {
|
||||
throw new DriverException('Error pressing standard button - ' . $result);
|
||||
}
|
||||
|
@ -391,7 +389,7 @@ class behat_app extends behat_base {
|
|||
*/
|
||||
public function i_close_the_popup_in_the_app() {
|
||||
$this->spin(function($context, $args) {
|
||||
$result = $this->getSession()->evaluateScript('return window.behat.closePopup();');
|
||||
$result = $this->evaluate_script("return window.behat.closePopup();");
|
||||
if ($result !== 'OK') {
|
||||
throw new DriverException('Error closing popup - ' . $result);
|
||||
}
|
||||
|
@ -449,7 +447,7 @@ class behat_app extends behat_base {
|
|||
} else {
|
||||
$nearbit = '';
|
||||
}
|
||||
$result = $context->getSession()->evaluateScript('return window.behat.press("' .
|
||||
$result = $this->evaluate_script('return window.behat.press("' .
|
||||
addslashes_js($text) . '"' . $nearbit .');');
|
||||
if ($result !== 'OK') {
|
||||
throw new DriverException('Error pressing item - ' . $result);
|
||||
|
@ -472,7 +470,7 @@ class behat_app extends behat_base {
|
|||
*/
|
||||
public function i_set_the_field_in_the_app(string $field, string $value) {
|
||||
$this->spin(function($context, $args) use ($field, $value) {
|
||||
$result = $this->getSession()->evaluateScript('return window.behat.setField("' .
|
||||
$result = $this->evaluate_script('return window.behat.setField("' .
|
||||
addslashes_js($field) . '", "' . addslashes_js($value) . '");');
|
||||
if ($result !== 'OK') {
|
||||
throw new DriverException('Error setting field - ' . $result);
|
||||
|
@ -494,7 +492,7 @@ class behat_app extends behat_base {
|
|||
*/
|
||||
public function the_header_should_be_in_the_app(string $text) {
|
||||
$result = $this->spin(function($context, $args) {
|
||||
$result = $this->getSession()->evaluateScript('return window.behat.getHeader();');
|
||||
$result = $this->evaluate_script('return window.behat.getHeader();');
|
||||
if (substr($result, 0, 3) !== 'OK:') {
|
||||
throw new DriverException('Error getting header - ' . $result);
|
||||
}
|
||||
|
@ -536,7 +534,7 @@ class behat_app extends behat_base {
|
|||
if (count($names) !== 2) {
|
||||
throw new DriverException('Expected to see 2 tabs open, not ' . count($names));
|
||||
}
|
||||
$this->getSession()->getDriver()->executeScript('window.close()');
|
||||
$this->execute_script('window.close()');
|
||||
$this->getSession()->switchToWindow($names[0]);
|
||||
}
|
||||
|
||||
|
@ -548,6 +546,6 @@ class behat_app extends behat_base {
|
|||
* @throws DriverException If the navigator.online mode is not available
|
||||
*/
|
||||
public function i_switch_offline_mode(string $offline) {
|
||||
$this->getSession()->evaluateScript('appProvider.setForceOffline(' . $offline . ');');
|
||||
$this->execute_script('appProvider.setForceOffline(' . $offline . ');');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue