function FilterTest::testAddingFilter
Same name and namespace in other branches
- 10 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FilterTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FilterTest::testAddingFilter()
- 11.x core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FilterTest.php \Drupal\Tests\views\FunctionalJavascript\Plugin\views\Handler\FilterTest::testAddingFilter()
Tests adding a filter handler.
File
-
core/
modules/ views/ tests/ src/ FunctionalJavascript/ Plugin/ views/ Handler/ FilterTest.php, line 59
Class
- FilterTest
- Tests the add filter handler UI.
Namespace
Drupal\Tests\views\FunctionalJavascript\Plugin\views\HandlerCode
public function testAddingFilter() {
$web_assert = $this->assertSession();
$url = '/admin/structure/views/view/content';
$this->drupalGet($url);
$page = $this->getSession()
->getPage();
// Open the 'Add filter dialog'.
$page->clickLink('views-add-filter');
// Test filtering by type.
$web_assert->waitForField('override[controls][group]');
$page->fillField('override[controls][group]', 'content');
$only_content_rows = $this->waitForOnlyContentRows();
$this->assertTrue($only_content_rows);
// Search for a specific title and test that this is now the only one shown.
$page->fillField('override[controls][options_search]', 'body (body)');
$filtering_done = $this->waitForVisibleElementCount(1, 'tr.filterable-option');
$this->assertTrue($filtering_done);
// Select the body field and apply the choice.
$page->checkField('name[node__body.body_value]');
$page->find('css', '.ui-dialog .ui-dialog-buttonpane')
->pressButton('Add and configure filter criteria');
$web_assert->waitForField('options[expose_button][checkbox][checkbox]');
// Expose the filter.
$page->findField('options[expose_button][checkbox][checkbox]')
->click();
$web_assert->waitForField('options[expose][label]');
$page->find('css', '.ui-dialog .ui-dialog-buttonpane')
->pressButton('Apply');
$web_assert->waitForText('Content: body (exposed)');
$web_assert->responseContains('Content: body (exposed)');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.