mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-73070 Behat: stop using no-longer-existant classes in behat_hooks
This commit is contained in:
parent
7013bda35b
commit
11f8a08a0e
@ -123,7 +123,7 @@ class behat_form_field implements behat_session_interface {
|
||||
try {
|
||||
$instance->field->keyPress($char, $modifier);
|
||||
$instance->field->keyUp($char, $modifier);
|
||||
} catch (WebDriver\Exception $e) {
|
||||
} catch (\Facebook\WebDriver\Exception\WebDriverException $e) {
|
||||
// If the JS handler attached to keydown or keypress destroys the element
|
||||
// the later events may trigger errors because form element no longer exist
|
||||
// or is not visible. Ignore such exceptions here.
|
||||
|
@ -27,12 +27,12 @@
|
||||
|
||||
require_once(__DIR__ . '/../../behat/behat_base.php');
|
||||
|
||||
use Behat\Gherkin\Node\TableNode as TableNode;
|
||||
use Behat\Mink\Exception\DriverException as DriverException;
|
||||
use Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException;
|
||||
use Behat\Mink\Exception\ExpectationException as ExpectationException;
|
||||
use WebDriver\Exception\NoSuchElement as NoSuchElement;
|
||||
use WebDriver\Exception\StaleElementReference as StaleElementReference;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use Behat\Mink\Exception\DriverException;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Behat\Mink\Exception\ExpectationException;
|
||||
use Facebook\WebDriver\Exception\NoSuchElementException;
|
||||
use Facebook\WebDriver\Exception\StaleElementReferenceException;
|
||||
|
||||
/**
|
||||
* Cross component steps definitions.
|
||||
@ -121,9 +121,9 @@ class behat_general extends behat_base {
|
||||
// Wrapped in try & catch in case the redirection has already been executed.
|
||||
try {
|
||||
$content = $metarefresh->getAttribute('content');
|
||||
} catch (NoSuchElement $e) {
|
||||
} catch (NoSuchElementException $e) {
|
||||
return true;
|
||||
} catch (StaleElementReference $e) {
|
||||
} catch (StaleElementReferenceException $e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -677,7 +677,7 @@ class behat_general extends behat_base {
|
||||
throw new ExpectationException('"' . $args['text'] . '" text was found in the page',
|
||||
$context->getSession());
|
||||
}
|
||||
} catch (WebDriver\Exception\NoSuchElement $e) {
|
||||
} catch (NoSuchElementException $e) {
|
||||
// Do nothing just return, as element is no more on page.
|
||||
return true;
|
||||
} catch (ElementNotFoundException $e) {
|
||||
|
@ -38,12 +38,10 @@ use Behat\Testwork\Hook\Scope\BeforeSuiteScope,
|
||||
Behat\Behat\Hook\Scope\BeforeStepScope,
|
||||
Behat\Behat\Hook\Scope\AfterStepScope,
|
||||
Behat\Mink\Exception\ExpectationException,
|
||||
Behat\Mink\Exception\DriverException as DriverException,
|
||||
WebDriver\Exception\NoSuchWindow as NoSuchWindow,
|
||||
WebDriver\Exception\UnexpectedAlertOpen as UnexpectedAlertOpen,
|
||||
WebDriver\Exception\UnknownError as UnknownError,
|
||||
WebDriver\Exception\CurlExec as CurlExec,
|
||||
WebDriver\Exception\NoAlertOpenError as NoAlertOpenError;
|
||||
Behat\Mink\Exception\DriverException,
|
||||
Facebook\WebDriver\Exception\UnexpectedAlertOpenException,
|
||||
Facebook\WebDriver\Exception\WebDriverCurlException,
|
||||
Facebook\WebDriver\Exception\UnknownErrorException;
|
||||
|
||||
/**
|
||||
* Hooks to the behat process.
|
||||
@ -82,7 +80,7 @@ class behat_hooks extends behat_base {
|
||||
* failure, but we can store them here to fail the step in i_look_for_exceptions()
|
||||
* which result will be parsed by the framework as the last step result.
|
||||
*
|
||||
* @var Null or the exception last step throw in the before or after hook.
|
||||
* @var ?Exception Null or the exception last step throw in the before or after hook.
|
||||
*/
|
||||
protected static $currentstepexception = null;
|
||||
|
||||
@ -348,17 +346,16 @@ The following debugging information is available:
|
||||
|
||||
EOF;
|
||||
|
||||
|
||||
try {
|
||||
$this->restart_session();
|
||||
} catch (CurlExec | DriverException $e) {
|
||||
// The CurlExec Exception is thrown by WebDriver.
|
||||
} catch (WebDriverCurlException | DriverException $e) {
|
||||
// Thrown by WebDriver.
|
||||
self::log_and_stop(
|
||||
$driverexceptionmsg . '. ' .
|
||||
$e->getMessage() . "\n\n" .
|
||||
format_backtrace($e->getTrace(), true)
|
||||
);
|
||||
} catch (UnknownError $e) {
|
||||
} catch (UnknownErrorException $e) {
|
||||
// Generic 'I have no idea' Selenium error. Custom exception to provide more feedback about possible solutions.
|
||||
self::log_and_stop(
|
||||
$e->getMessage() . "\n\n" .
|
||||
@ -646,7 +643,7 @@ EOF;
|
||||
try {
|
||||
$this->wait_for_pending_js();
|
||||
self::$currentstepexception = null;
|
||||
} catch (UnexpectedAlertOpen $e) {
|
||||
} catch (UnexpectedAlertOpenException $e) {
|
||||
self::$currentstepexception = $e;
|
||||
|
||||
// Accepting the alert so the framework can continue properly running
|
||||
|
Loading…
x
Reference in New Issue
Block a user