class Html5Test in Zircon Profile 8
Same name in this branch
- 8 vendor/masterminds/html5/test/HTML5/Html5Test.php \Masterminds\HTML5\Tests\Html5Test
- 8 vendor/behat/mink/driver-testsuite/tests/Form/Html5Test.php \Behat\Mink\Tests\Driver\Form\Html5Test
Same name and namespace in other branches
- 8.0 vendor/behat/mink/driver-testsuite/tests/Form/Html5Test.php \Behat\Mink\Tests\Driver\Form\Html5Test
Hierarchy
Expanded class hierarchy of Html5Test
File
- vendor/
behat/ mink/ driver-testsuite/ tests/ Form/ Html5Test.php, line 7
Namespace
Behat\Mink\Tests\Driver\FormView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Html5Test:: |
public | function | ||
Html5Test:: |
public | function | ||
Html5Test:: |
public | function | ||
Html5Test:: |
public | function | ||
Html5Test:: |
public | function | ||
TestCase:: |
private static | property | ||
TestCase:: |
private static | property | Mink session manager. | |
TestCase:: |
protected | function | ||
TestCase:: |
protected | function | Creates a new driver instance. | |
TestCase:: |
protected | function | ||
TestCase:: |
protected | function | Returns assert session. | |
TestCase:: |
private static | function | ||
TestCase:: |
protected | function | Returns session. | |
TestCase:: |
protected | function | Map remote file path. | |
TestCase:: |
protected | function | ||
TestCase:: |
protected | function | ||
TestCase:: |
protected | function | Waits for a condition to be true, considering than it is successful for drivers not supporting wait(). | |
TestCase:: |
public static | function | Initializes the test case. | |
TestCase:: |
protected | function |