IntegrationTest.php in Search API 8
File
modules/search_api_db/tests/src/FunctionalJavascript/IntegrationTest.php
View source
<?php
namespace Drupal\Tests\search_api_db\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
class IntegrationTest extends WebDriverTestBase {
public static $modules = [
'search_api',
'search_api_db',
];
protected $defaultTheme = 'stark';
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');
}
}