public function AdminToolbarSearchTest::testSearchFunctionality in Admin Toolbar Search 8
Tests search functionality.
File
- tests/
src/ FunctionalJavascript/ AdminToolbarSearchTest.php, line 45
Class
- AdminToolbarSearchTest
- Test the functionality of admin toolbar search.
Namespace
Drupal\Tests\admin_toolbar_search\FunctionalJavascriptCode
public function testSearchFunctionality() {
$search_tab = '#toolbar-item-administration-search';
$search_tray = '#toolbar-item-administration-search-tray';
$search_input = '#admin-toolbar-search-input';
$this
->drupalLogin($this->adminUser);
$this
->assertSession()
->responseContains('admin.toolbar_search.css');
$this
->assertSession()
->responseContains('admin_toolbar_search.js');
$this
->assertSession()
->elementExists('css', $search_tab)
->click();
$this
->assertSession()
->waitForElementVisible('css', $search_tray);
$this
->assertSession()
->elementExists('css', $search_input)
->setValue('basic');
$autocomplete_suggestions = $this
->assertSession()
->waitForElementVisible('css', 'ul.ui-autocomplete');
$suggestion = 'Configuration > System > Basic site settings <span class="admin-toolbar-search-url">/subdirectory/admin/config/system/site-information</span>';
$this
->assertSession()
->elementContains('css', 'ul.ui-autocomplete', $suggestion);
}