mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
ADD / After each step we wait for the server to handle all requests
This commit is contained in:
parent
a7c076fee0
commit
52573518bd
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\BehatExtension\Context;
|
namespace SilverStripe\BehatExtension\Context;
|
||||||
|
|
||||||
|
use Behat\Behat\Hook\Scope\AfterStepScope;
|
||||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||||
use Behat\Mink\Element\NodeElement;
|
use Behat\Mink\Element\NodeElement;
|
||||||
use Behat\Mink\Exception\ElementNotFoundException;
|
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.
|
* Returns a parameter map of state to set within the test session.
|
||||||
* Takes TESTSESSION_PARAMS environment variable into account for run-specific configurations.
|
* Takes TESTSESSION_PARAMS environment variable into account for run-specific configurations.
|
||||||
|
Loading…
Reference in New Issue
Block a user