From a7e1833cf3f110845da92180f0e8fbb9fbf430ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Sat, 15 Apr 2017 14:53:28 +0200 Subject: [PATCH] Add the timeout in NoSuchElementException messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- build/acceptance/features/core/Actor.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build/acceptance/features/core/Actor.php b/build/acceptance/features/core/Actor.php index 2445a09bff..ac08822fff 100644 --- a/build/acceptance/features/core/Actor.php +++ b/build/acceptance/features/core/Actor.php @@ -139,7 +139,11 @@ class Actor { return $element !== null; }; if (!Utils::waitFor($findCallback, $timeout, $timeoutStep)) { - throw new NoSuchElementException($elementLocator->getDescription() . " could not be found"); + $message = $elementLocator->getDescription() . " could not be found"; + if ($timeout > 0) { + $message = $message . " after $timeout seconds"; + } + throw new NoSuchElementException($message); } return $element; @@ -177,6 +181,9 @@ class Actor { // exception in the chain. $message = $exception->getMessage() . "\n" . $elementLocator->getDescription() . " could not be found"; + if ($timeout > 0) { + $message = $message . " after $timeout seconds"; + } throw new NoSuchElementException($message, $exception); } }