You are here

class Html5Test in Zircon Profile 8

Same name in this branch
  1. 8 vendor/masterminds/html5/test/HTML5/Html5Test.php \Masterminds\HTML5\Tests\Html5Test
  2. 8 vendor/behat/mink/driver-testsuite/tests/Form/Html5Test.php \Behat\Mink\Tests\Driver\Form\Html5Test
Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/driver-testsuite/tests/Form/Html5Test.php \Behat\Mink\Tests\Driver\Form\Html5Test

Hierarchy

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

Expanded class hierarchy of Html5Test

File

vendor/behat/mink/driver-testsuite/tests/Form/Html5Test.php, line 7

Namespace

Behat\Mink\Tests\Driver\Form
View source
class Html5Test extends TestCase {
  public function testHtml5FormInputAttribute() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/html5_form.html'));
    $page = $this
      ->getSession()
      ->getPage();
    $webAssert = $this
      ->getAssertSession();
    $firstName = $webAssert
      ->fieldExists('first_name');
    $lastName = $webAssert
      ->fieldExists('last_name');
    $this
      ->assertEquals('not set', $lastName
      ->getValue());
    $firstName
      ->setValue('John');
    $lastName
      ->setValue('Doe');
    $this
      ->assertEquals('Doe', $lastName
      ->getValue());
    $page
      ->pressButton('Submit in form');
    if ($this
      ->safePageWait(5000, 'document.getElementsByTagName("title") !== null')) {
      $out = <<<OUT
  'first_name' = 'John',
  'last_name' = 'Doe',
OUT;
      $this
        ->assertContains($out, $page
        ->getContent());
      $this
        ->assertNotContains('other_field', $page
        ->getContent());
    }
  }
  public function testHtml5FormRadioAttribute() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('html5_radio.html'));
    $page = $this
      ->getSession()
      ->getPage();
    $radio = $this
      ->findById('sex_f');
    $otherRadio = $this
      ->findById('sex_invalid');
    $this
      ->assertEquals('f', $radio
      ->getValue());
    $this
      ->assertEquals('invalid', $otherRadio
      ->getValue());
    $radio
      ->selectOption('m');
    $this
      ->assertEquals('m', $radio
      ->getValue());
    $this
      ->assertEquals('invalid', $otherRadio
      ->getValue());
    $page
      ->pressButton('Submit in form');
    $out = <<<OUT
  'sex' = 'm',
OUT;
    $this
      ->assertContains($out, $page
      ->getContent());
  }
  public function testHtml5FormButtonAttribute() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/html5_form.html'));
    $page = $this
      ->getSession()
      ->getPage();
    $webAssert = $this
      ->getAssertSession();
    $firstName = $webAssert
      ->fieldExists('first_name');
    $lastName = $webAssert
      ->fieldExists('last_name');
    $firstName
      ->setValue('John');
    $lastName
      ->setValue('Doe');
    $page
      ->pressButton('Submit outside form');
    if ($this
      ->safePageWait(5000, 'document.getElementsByTagName("title") !== null')) {
      $out = <<<OUT
  'first_name' = 'John',
  'last_name' = 'Doe',
  'submit_button' = 'test',
OUT;
      $this
        ->assertContains($out, $page
        ->getContent());
    }
  }
  public function testHtml5FormOutside() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('/html5_form.html'));
    $page = $this
      ->getSession()
      ->getPage();
    $page
      ->fillField('other_field', 'hello');
    $page
      ->pressButton('Submit separate form');
    if ($this
      ->safePageWait(5000, 'document.getElementsByTagName("title") !== null')) {
      $out = <<<OUT
  'other_field' = 'hello',
OUT;
      $this
        ->assertContains($out, $page
        ->getContent());
      $this
        ->assertNotContains('first_name', $page
        ->getContent());
    }
  }
  public function testHtml5Types() {
    $this
      ->getSession()
      ->visit($this
      ->pathTo('html5_types.html'));
    $page = $this
      ->getSession()
      ->getPage();
    $page
      ->fillField('url', 'http://mink.behat.org/');
    $page
      ->fillField('email', 'mink@example.org');
    $page
      ->fillField('number', '6');
    $page
      ->fillField('search', 'mink');
    $page
      ->fillField('date', '2014-05-19');
    $page
      ->fillField('color', '#ff00aa');
    $page
      ->pressButton('Submit');
    $out = <<<OUT
  'color' = '#ff00aa',
  'date' = '2014-05-19',
  'email' = 'mink@example.org',
  'number' = '6',
  'search' = 'mink',
  'submit_button' = 'Submit',
  'url' = 'http://mink.behat.org/',
OUT;
    $this
      ->assertContains($out, $page
      ->getContent());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Html5Test::testHtml5FormButtonAttribute public function
Html5Test::testHtml5FormInputAttribute public function
Html5Test::testHtml5FormOutside public function
Html5Test::testHtml5FormRadioAttribute public function
Html5Test::testHtml5Types 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