You are here

public function IntegrationTest::testAddingServer in Search API 8

Tests that adding a server works.

File

modules/search_api_db/tests/src/FunctionalJavascript/IntegrationTest.php, line 32

Class

IntegrationTest
Tests that using the DB backend via the UI works as expected.

Namespace

Drupal\Tests\search_api_db\FunctionalJavascript

Code

public function testAddingServer() {
  $admin_user = $this
    ->drupalCreateUser([
    'administer search_api',
    'access content',
  ]);
  $this
    ->drupalLogin($admin_user);
  $this
    ->drupalGet('admin/config/search/search-api/add-server');
  $page = $this
    ->getSession()
    ->getPage();
  $assert_session = $this
    ->assertSession();
  $assert_session
    ->pageTextContains('Add search server');
  $page
    ->fillField('name', ' ~`Test Server');
  $machine_name = $assert_session
    ->waitForElementVisible('css', '[name="name"] + * .machine-name-value');
  $this
    ->assertNotEmpty($machine_name);
  $page
    ->findButton('Edit')
    ->press();
  $page
    ->fillField('id', '_test');
  $page
    ->pressButton('Save');
  $assert_session
    ->addressEquals('admin/config/search/search-api/server/_test');
}