You are here

protected function AjaxTest::checkServerBackendAjax in Search API 8

Tests AJAX display of backend config forms when a new backend is selected.

1 call to AjaxTest::checkServerBackendAjax()
AjaxTest::testAjax in tests/src/FunctionalJavascript/AjaxTest.php
Tests AJAX functionality in the Search API module.

File

tests/src/FunctionalJavascript/AjaxTest.php, line 88

Class

AjaxTest
Tests AJAX functionality in the Search API module.

Namespace

Drupal\Tests\search_api\FunctionalJavascript

Code

protected function checkServerBackendAjax() {
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalGet('admin/config/search/search-api/add-server');
  $assert_session
    ->pageTextContains('Database');
  $assert_session
    ->pageTextContains('Test backend');
  $backend_config = '[data-drupal-selector="edit-backend-config"]';
  $assert_session
    ->elementNotExists('css', "{$backend_config} input");
  $assert_session
    ->elementNotExists('css', "{$backend_config} select");
  $assert_session
    ->elementNotExists('css', "{$backend_config} button");
  $this
    ->click('input.form-radio[name="backend"][value="search_api_db"]');
  $element = $assert_session
    ->waitForElement('css', "{$backend_config} input");
  $this
    ->assertNotEmpty($element);
  $assert_session
    ->elementExists('css', "{$backend_config} select[name=\"backend_config[min_chars]\"]");
}