From 52573518bd808e73384cbcd6e0f0c606f9249292 Mon Sep 17 00:00:00 2001 From: Serge Latyntcev Date: Thu, 20 Dec 2018 09:37:13 +1300 Subject: [PATCH 1/3] ADD / After each step we wait for the server to handle all requests --- src/Context/SilverStripeContext.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Context/SilverStripeContext.php b/src/Context/SilverStripeContext.php index 21bf0ee..e666f54 100644 --- a/src/Context/SilverStripeContext.php +++ b/src/Context/SilverStripeContext.php @@ -2,6 +2,7 @@ namespace SilverStripe\BehatExtension\Context; +use Behat\Behat\Hook\Scope\AfterStepScope; use Behat\Behat\Hook\Scope\BeforeScenarioScope; use Behat\Mink\Element\NodeElement; use Behat\Mink\Exception\ElementNotFoundException; @@ -276,6 +277,27 @@ abstract class SilverStripeContext extends MinkContext implements SilverStripeAw } } + /** + * @AfterStep + * + * Wait for all requests to be handled after each step + * + * @param AfterStepScope $event + */ + public function waitResponsesAfterStep(AfterStepScope $event) + { + $success = $this->testSessionEnvironment->waitForPendingRequests(); + if (!$success) { + echo ( + 'Warning! The timeout for waiting a response from the server has expired...'.PHP_EOL. + 'I keep going on, but this test behaviour may be inconsistent.'.PHP_EOL.PHP_EOL. + 'Your action required!'.PHP_EOL.PHP_EOL. + 'You may want to investigate why the server is responding that slowly.'.PHP_EOL. + 'Otherwise, you may need to increase the timeout.' + ); + } + } + /** * Returns a parameter map of state to set within the test session. * Takes TESTSESSION_PARAMS environment variable into account for run-specific configurations. From 74d8f3514ebffa8d0585618940b1261788004768 Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Wed, 9 Jan 2019 11:38:21 +1300 Subject: [PATCH 2/3] MINOR Increment testsession requirement for 4.1 release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7451eee..cc8a65b 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "behat/mink-extension": "^2.1", "silverstripe/mink-facebook-web-driver": "^1", "symfony/dom-crawler": "^3", - "silverstripe/testsession": "^2.1", + "silverstripe/testsession": "^2.2", "silverstripe/framework": "^4", "symfony/finder": "^3.2" }, From 6ffbd879dc7edc4cf0ec4d48204a863991927fd5 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 22 Mar 2019 10:00:05 +1300 Subject: [PATCH 3/3] Update typo in docblock --- src/Context/SilverStripeContext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Context/SilverStripeContext.php b/src/Context/SilverStripeContext.php index e666f54..5a8ecfc 100644 --- a/src/Context/SilverStripeContext.php +++ b/src/Context/SilverStripeContext.php @@ -460,7 +460,7 @@ abstract class SilverStripeContext extends MinkContext implements SilverStripeAw } /** - * Overwritten to click the first *visable* link the DOM. + * Overwritten to click the first *visible* link the DOM. * * @param string $link * @throws ElementNotFoundException