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