You are here

class ErrorHandlingTest in Zircon Profile 8

Same name in this branch
  1. 8 vendor/behat/mink-browserkit-driver/tests/Custom/ErrorHandlingTest.php \Behat\Mink\Tests\Driver\Custom\ErrorHandlingTest
  2. 8 vendor/behat/mink/driver-testsuite/tests/Basic/ErrorHandlingTest.php \Behat\Mink\Tests\Driver\Basic\ErrorHandlingTest
Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/driver-testsuite/tests/Basic/ErrorHandlingTest.php \Behat\Mink\Tests\Driver\Basic\ErrorHandlingTest

@group slow

Hierarchy

  • class \Behat\Mink\Tests\Driver\TestCase extends \Behat\Mink\Tests\Driver\PHPUnit_Framework_TestCase

Expanded class hierarchy of ErrorHandlingTest

File

vendor/behat/mink/driver-testsuite/tests/Basic/ErrorHandlingTest.php, line 10

Namespace

Behat\Mink\Tests\Driver\Basic
View source
class ErrorHandlingTest extends TestCase {
  const NOT_FOUND_XPATH = '//html/./invalid';
  const NOT_FOUND_EXCEPTION = 'Exception';
  const INVALID_EXCEPTION = 'Exception';
  public function testVisitErrorPage() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/500.php'));
    $this
      ->assertContains('Sorry, a server error happened', $this
      ->getSession()
      ->getPage()
      ->getContent(), 'Drivers allow loading pages with a 500 status code');
  }
  public function testCheckInvalidElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $element = $this
      ->findById('user-name');
    $this
      ->setExpectedException(self::INVALID_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->check($element
      ->getXpath());
  }
  public function testCheckNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->check(self::NOT_FOUND_XPATH);
  }
  public function testUncheckInvalidElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $element = $this
      ->findById('user-name');
    $this
      ->setExpectedException(self::INVALID_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->uncheck($element
      ->getXpath());
  }
  public function testUncheckNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->uncheck(self::NOT_FOUND_XPATH);
  }
  public function testSelectOptionInvalidElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $element = $this
      ->findById('user-name');
    $this
      ->setExpectedException(self::INVALID_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->selectOption($element
      ->getXpath(), 'test');
  }
  public function testSelectOptionNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->selectOption(self::NOT_FOUND_XPATH, 'test');
  }
  public function testAttachFileInvalidElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $element = $this
      ->findById('user-name');
    $this
      ->setExpectedException(self::INVALID_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->attachFile($element
      ->getXpath(), __FILE__);
  }
  public function testAttachFileNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->attachFile(self::NOT_FOUND_XPATH, __FILE__);
  }
  public function testSubmitFormInvalidElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $element = $this
      ->findById('core');
    $this
      ->setExpectedException(self::INVALID_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->submitForm($element
      ->getXpath());
  }
  public function testSubmitFormNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->submitForm(self::NOT_FOUND_XPATH);
  }
  public function testGetTagNameNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->getTagName(self::NOT_FOUND_XPATH);
  }
  public function testGetTextNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->getText(self::NOT_FOUND_XPATH);
  }
  public function testGetHtmlNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->getHtml(self::NOT_FOUND_XPATH);
  }
  public function testGetOuterHtmlNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->getOuterHtml(self::NOT_FOUND_XPATH);
  }
  public function testGetValueNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->getValue(self::NOT_FOUND_XPATH);
  }
  public function testSetValueNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->setValue(self::NOT_FOUND_XPATH, 'test');
  }
  public function testIsSelectedNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->isSelected(self::NOT_FOUND_XPATH);
  }
  public function testIsCheckedNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->isChecked(self::NOT_FOUND_XPATH);
  }
  public function testIsVisibleNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->isVisible(self::NOT_FOUND_XPATH);
  }
  public function testClickNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->click(self::NOT_FOUND_XPATH);
  }
  public function testDoubleClickNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->doubleClick(self::NOT_FOUND_XPATH);
  }
  public function testRightClickNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->rightClick(self::NOT_FOUND_XPATH);
  }
  public function testGetAttributeNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->getAttribute(self::NOT_FOUND_XPATH, 'id');
  }
  public function testMouseOverNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->mouseOver(self::NOT_FOUND_XPATH);
  }
  public function testFocusNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->focus(self::NOT_FOUND_XPATH);
  }
  public function testBlurNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->blur(self::NOT_FOUND_XPATH);
  }
  public function testKeyPressNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->keyPress(self::NOT_FOUND_XPATH, 'a');
  }
  public function testKeyDownNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->keyDown(self::NOT_FOUND_XPATH, 'a');
  }
  public function testKeyUpNotFoundElement() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/index.html'));
    $this
      ->setExpectedException(self::NOT_FOUND_EXCEPTION);
    $this
      ->getSession()
      ->getDriver()
      ->keyUp(self::NOT_FOUND_XPATH, 'a');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ErrorHandlingTest::INVALID_EXCEPTION constant
ErrorHandlingTest::NOT_FOUND_EXCEPTION constant
ErrorHandlingTest::NOT_FOUND_XPATH constant
ErrorHandlingTest::testAttachFileInvalidElement public function
ErrorHandlingTest::testAttachFileNotFoundElement public function
ErrorHandlingTest::testBlurNotFoundElement public function
ErrorHandlingTest::testCheckInvalidElement public function
ErrorHandlingTest::testCheckNotFoundElement public function
ErrorHandlingTest::testClickNotFoundElement public function
ErrorHandlingTest::testDoubleClickNotFoundElement public function
ErrorHandlingTest::testFocusNotFoundElement public function
ErrorHandlingTest::testGetAttributeNotFoundElement public function
ErrorHandlingTest::testGetHtmlNotFoundElement public function
ErrorHandlingTest::testGetOuterHtmlNotFoundElement public function
ErrorHandlingTest::testGetTagNameNotFoundElement public function
ErrorHandlingTest::testGetTextNotFoundElement public function
ErrorHandlingTest::testGetValueNotFoundElement public function
ErrorHandlingTest::testIsCheckedNotFoundElement public function
ErrorHandlingTest::testIsSelectedNotFoundElement public function
ErrorHandlingTest::testIsVisibleNotFoundElement public function
ErrorHandlingTest::testKeyDownNotFoundElement public function
ErrorHandlingTest::testKeyPressNotFoundElement public function
ErrorHandlingTest::testKeyUpNotFoundElement public function
ErrorHandlingTest::testMouseOverNotFoundElement public function
ErrorHandlingTest::testRightClickNotFoundElement public function
ErrorHandlingTest::testSelectOptionInvalidElement public function
ErrorHandlingTest::testSelectOptionNotFoundElement public function
ErrorHandlingTest::testSetValueNotFoundElement public function
ErrorHandlingTest::testSubmitFormInvalidElement public function
ErrorHandlingTest::testSubmitFormNotFoundElement public function
ErrorHandlingTest::testUncheckInvalidElement public function
ErrorHandlingTest::testUncheckNotFoundElement public function
ErrorHandlingTest::testVisitErrorPage public function
TestCase::$config private static property
TestCase::$mink private static property Mink session manager.
TestCase::checkRequirements protected function
TestCase::createDriver protected function Creates a new driver instance.
TestCase::findById protected function
TestCase::getAssertSession protected function Returns assert session.
TestCase::getConfig private static function
TestCase::getSession protected function Returns session.
TestCase::mapRemoteFilePath protected function Map remote file path.
TestCase::onNotSuccessfulTest protected function
TestCase::pathTo protected function
TestCase::safePageWait protected function Waits for a condition to be true, considering than it is successful for drivers not supporting wait().
TestCase::setUpBeforeClass public static function Initializes the test case.
TestCase::tearDown protected function