You are here

protected function EntityReferenceAutocompleteWidgetTest::doAutocomplete in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php \Drupal\FunctionalJavascriptTests\EntityReference\EntityReferenceAutocompleteWidgetTest::doAutocomplete()

Executes an autocomplete on a given field and waits for it to finish.

Parameters

string $field_name: The field name.

1 call to EntityReferenceAutocompleteWidgetTest::doAutocomplete()
EntityReferenceAutocompleteWidgetTest::testEntityReferenceAutocompleteWidget in core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php
Tests that the default autocomplete widget return the correct results.

File

core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php, line 159

Class

EntityReferenceAutocompleteWidgetTest
Tests the output of entity reference autocomplete widgets.

Namespace

Drupal\FunctionalJavascriptTests\EntityReference

Code

protected function doAutocomplete($field_name) {
  $autocomplete_field = $this
    ->getSession()
    ->getPage()
    ->findField($field_name . '[0][target_id]');
  $autocomplete_field
    ->setValue('Test');
  $this
    ->getSession()
    ->getDriver()
    ->keyDown($autocomplete_field
    ->getXpath(), ' ');
  $this
    ->assertSession()
    ->waitOnAutocomplete();
}