You are here

public function GeneralTest::testFormSubmitWays in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/behat/mink/driver-testsuite/tests/Form/GeneralTest.php \Behat\Mink\Tests\Driver\Form\GeneralTest::testFormSubmitWays()

@dataProvider formSubmitWaysDataProvider

File

vendor/behat/mink/driver-testsuite/tests/Form/GeneralTest.php, line 60

Class

GeneralTest

Namespace

Behat\Mink\Tests\Driver\Form

Code

public function testFormSubmitWays($submitVia) {
  $session = $this
    ->getSession();
  $session
    ->visit($this
    ->pathTo('/basic_form.html'));
  $page = $session
    ->getPage();
  $webAssert = $this
    ->getAssertSession();
  $firstname = $webAssert
    ->fieldExists('first_name');
  $firstname
    ->setValue('Konstantin');
  $page
    ->findButton($submitVia)
    ->click();
  if ($this
    ->safePageWait(5000, 'document.getElementById("first") !== null')) {
    $this
      ->assertEquals('Firstname: Konstantin', $webAssert
      ->elementExists('css', '#first')
      ->getText());
  }
  else {
    $this
      ->fail('Form was never submitted');
  }
}