3 namespace Drupal\Tests\views_ui\FunctionalJavascript;
5 use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
8 * Tests the View UI filter criteria group dialog.
12 class FilterCriteriaTest extends WebDriverTestBase {
17 public static $modules = ['node', 'views', 'views_ui'];
22 public function setUp() {
25 $admin_user = $this->drupalCreateUser([
26 'administer site configuration',
29 'access content overview',
32 // Disable automatic live preview to make the sequence of calls clearer.
33 \Drupal::configFactory()->getEditable('views.settings')->set('ui.always_live_preview', FALSE)->save();
34 $this->drupalLogin($admin_user);
38 * Tests dialog for filter criteria.
40 public function testFilterCriteriaDialog() {
41 $this->drupalGet('admin/structure/views/view/content_recent');
42 $assert_session = $this->assertSession();
43 $page = $this->getSession()->getPage();
45 // Use the 'And/Or Rearrange' link for fields to open a dialog.
46 $dropbutton = $page->find('css', '.views-ui-display-tab-bucket.filter .dropbutton-toggle button');
48 $add_link = $page->findById('views-rearrange-filter');
49 $this->assertTrue($add_link->isVisible(), 'And/Or Rearrange button found.');
51 $assert_session->assertWaitOnAjaxRequest();
53 // Add a new filter group.
54 $create_new_filter_group = $page->findById('views-add-group-link');
55 $this->assertTrue($create_new_filter_group->isVisible(), 'Add group link found.');
56 $create_new_filter_group->click();
57 $assert_session->assertWaitOnAjaxRequest();
59 // Assert the existence of the new filter group by checking the remove group
61 $remove_link = $page->findLink('Remove group');
62 $this->assertTrue($remove_link->isVisible(), 'New group found.');
64 // Remove the group again and assert the group is not present anymore.
65 $remove_link->click();
66 $assert_session->assertWaitOnAjaxRequest();
67 $remove_link = $page->findLink('Remove group');
68 $this->assertEmpty($remove_link, 'Remove button not available');
70 // Checks that the admin summary is not double escaped.
71 $this->drupalGet('admin/structure/views/view/who_s_online');
72 $page = $this->getSession()->getPage();
73 $this->assertNotNull($page->findLink('User: Last access (>= -15 minutes)'));