From 97bedb94af6d1981a618a4fa0024edbdf93e1a7b Mon Sep 17 00:00:00 2001 From: Daniel Calviño Sánchez Date: Wed, 3 May 2017 12:34:04 +0200 Subject: Fix exponential increase of timeout when finding ancestor elements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The timeout passed to the "find" method was multiplied by the "findTimeoutMultiplier" attribute. However, as "find" used "findAncestor" and "findAncestor", in turn, used "find" itself the timeout was increased exponentially for ancestor elements. Now "find" was split in "find" and "findInternal"; the first method is the public one and modifies the given parameters as needed and then calls the second method, private, that performs the find itself. Signed-off-by: Daniel Calviño Sánchez --- tests/acceptance/features/core/Actor.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests/acceptance/features/core') diff --git a/tests/acceptance/features/core/Actor.php b/tests/acceptance/features/core/Actor.php index 0c23b5f7a40..3a57b7e6054 100644 --- a/tests/acceptance/features/core/Actor.php +++ b/tests/acceptance/features/core/Actor.php @@ -165,6 +165,18 @@ class Actor { public function find($elementLocator, $timeout = 0, $timeoutStep = 0.5) { $timeout = $timeout * $this->findTimeoutMultiplier; + return $this->findInternal($elementLocator, $timeout, $timeoutStep); + } + + /** + * Finds an element in the Mink Session of this Actor. + * + * The timeout is not affected by the multiplier set using + * setFindTimeoutMultiplier(). + * + * @see find($elementLocator, $timeout, $timeoutStep) + */ + private function findInternal($elementLocator, $timeout, $timeoutStep) { $element = null; $selector = $elementLocator->getSelector(); $locator = $elementLocator->getLocator(); @@ -211,7 +223,7 @@ class Actor { $ancestorElement = $elementLocator->getAncestor(); if ($ancestorElement instanceof Locator) { try { - $ancestorElement = $this->find($ancestorElement, $timeout, $timeoutStep); + $ancestorElement = $this->findInternal($ancestorElement, $timeout, $timeoutStep); } catch (NoSuchElementException $exception) { // Little hack to show the stack of ancestor elements that could // not be found, as Behat only shows the message of the last -- cgit v1.2.3 y'>addAllToGroupBy Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
blob: 81106e78a80848ad0ff2747f30697caac7d6abc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15