You are here

protected function WebformCivicrmTestBase::fillContactAutocomplete in Webform CiviCRM Integration 8.5

Fill Contact Autocomplete widget.

Parameters

string $id:

string $value:

4 calls to WebformCivicrmTestBase::fillContactAutocomplete()
CaseSubmissionTest::submitCaseAndVerifyResult in tests/src/FunctionalJavascript/CaseSubmissionTest.php
Submit Case and verify the result.
ContactSubmissionTest::testStaticAndAutocompleteOnContactElement in tests/src/FunctionalJavascript/ContactSubmissionTest.php
Test contact submission using static and autocomplete widget.
ExistingContactElementTest::testRenderingOfExistingContactElement in tests/src/FunctionalJavascript/ExistingContactElementTest.php
Verify if existing contact element is loaded as expected.
MultiCustomFieldsSubmissionTest::submitWebform in tests/src/FunctionalJavascript/MultiCustomFieldsSubmissionTest.php
Submit the webform with specified params.

File

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

Class

WebformCivicrmTestBase

Namespace

Drupal\Tests\webform_civicrm\FunctionalJavascript

Code

protected function fillContactAutocomplete($id, $value) {
  $page = $this
    ->getSession()
    ->getPage();
  $driver = $this
    ->getSession()
    ->getDriver()
    ->getWebDriverSession();
  $elementXpath = $page
    ->findField($id)
    ->getXpath();
  $this
    ->assertSession()
    ->elementExists('css', "#" . $id)
    ->click();
  $driver
    ->element('xpath', $elementXpath)
    ->postValue([
    'value' => [
      $value,
    ],
  ]);
  $this
    ->assertSession()
    ->waitForElementVisible('xpath', '//li[contains(@class, "token-input-dropdown")][1]');
  $this
    ->createScreenshot($this->htmlOutputDirectory . '/autocomplete.png');
  $page
    ->find('xpath', '//li[contains(@class, "token-input-dropdown")][1]')
    ->click();
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
}