You are here

public function Html5Test::testHtml5FormInputAttribute in Zircon Profile 8

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::testHtml5FormInputAttribute()

File

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

Class

Html5Test

Namespace

Behat\Mink\Tests\Driver\Form

Code

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());
  }
}