TimeoutTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Behat\Mink\Tests\Driver\Custom;
  3. use Behat\Mink\Tests\Driver\TestCase;
  4. class TimeoutTest extends TestCase
  5. {
  6. /**
  7. * @expectedException \Behat\Mink\Exception\DriverException
  8. */
  9. public function testInvalidTimeoutSettingThrowsException()
  10. {
  11. $this->getSession()->getDriver()->setTimeouts(array('invalid' => 0));
  12. }
  13. public function testShortTimeoutDoesNotWaitForElementToAppear()
  14. {
  15. $this->getSession()->getDriver()->setTimeouts(array('implicit' => 0));
  16. $this->getSession()->visit($this->pathTo('/js_test.html'));
  17. $this->findById('waitable')->click();
  18. $element = $this->getSession()->getPage()->find('css', '#waitable > div');
  19. $this->assertNull($element);
  20. }
  21. public function testLongTimeoutWaitsForElementToAppear()
  22. {
  23. $this->getSession()->getDriver()->setTimeouts(array('implicit' => 5000));
  24. $this->getSession()->visit($this->pathTo('/js_test.html'));
  25. $this->findById('waitable')->click();
  26. $element = $this->getSession()->getPage()->find('css', '#waitable > div');
  27. $this->assertNotNull($element);
  28. }
  29. }