You are here

public function WebformCivicrmTestBase::addFieldValue in Webform CiviCRM Integration 8.5

Copy of TraversableElement::fillField, but it replaces the existing value on the element rather than appending to it.

Fills in field (input, textarea, select) with specified locator.

Parameters

string $locator input id, name or label:

string $value value:

Throws

ElementNotFoundException

See also

NodeElement::setValue

5 calls to WebformCivicrmTestBase::addFieldValue()
ContactSubmissionTest::testSelectContactElement in tests/src/FunctionalJavascript/ContactSubmissionTest.php
Test select contact widget for existingcontact element.
ContactSubmissionTest::testStaticAndAutocompleteOnContactElement in tests/src/FunctionalJavascript/ContactSubmissionTest.php
Test contact submission using static and autocomplete widget.
ContactSubmissionTest::testSubmitWebform in tests/src/FunctionalJavascript/ContactSubmissionTest.php
Test submitting a contact.
ContributionDummyTest::testSubmitContribution in tests/src/FunctionalJavascript/ContributionDummyTest.php
MultiCustomFieldsSubmissionTest::submitWebform in tests/src/FunctionalJavascript/MultiCustomFieldsSubmissionTest.php
Submit the webform with specified params.

File

tests/src/FunctionalJavascript/WebformCivicrmTestBase.php, line 164

Class

WebformCivicrmTestBase

Namespace

Drupal\Tests\webform_civicrm\FunctionalJavascript

Code

public function addFieldValue($locator, $value) {
  $field = $this
    ->getSession()
    ->getPage()
    ->findField($locator);
  if (null === $field) {
    throw new ElementNotFoundException($this
      ->getDriver(), 'form field', 'id|name|label|value|placeholder', $locator);
  }
  $field
    ->doubleClick();
  $field
    ->setValue($value);
}