You are here

public function ConfigSelectorTest::testContentViewSearchApi in Thunder 8.5

Same name and namespace in other branches
  1. 6.2.x tests/src/FunctionalJavascript/Integration/ConfigSelectorTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ConfigSelectorTest::testContentViewSearchApi()
  2. 6.0.x tests/src/FunctionalJavascript/Integration/ConfigSelectorTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ConfigSelectorTest::testContentViewSearchApi()
  3. 6.1.x tests/src/FunctionalJavascript/Integration/ConfigSelectorTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ConfigSelectorTest::testContentViewSearchApi()

Tests content view with and without search_api.

File

tests/src/FunctionalJavascript/Integration/ConfigSelectorTest.php, line 27

Class

ConfigSelectorTest
Tests integration with the config_selector.

Namespace

Drupal\Tests\thunder\FunctionalJavascript\Integration

Code

public function testContentViewSearchApi() {
  $assert_session = $this
    ->assertSession();

  // Content lock fields are there by default.
  $this
    ->drupalGet('admin/content');
  $assert_session
    ->elementExists('xpath', '//*[@id="view-title-table-column"]/a');
  $assert_session
    ->elementExists('css', '#block-thunder-admin-content > div > div.view-content');

  // Install search_api.
  $module_installer = \Drupal::service('module_installer');
  $module_installer
    ->install([
    'thunder_search',
  ]);

  // Now we have a search_api based view.
  $this
    ->drupalGet('admin/config/search/search-api/index/content');
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Index now');
  $assert_session
    ->waitForId('edit-index-now');
  $this
    ->drupalGet('admin/content');
  $assert_session
    ->elementExists('xpath', '//*[@id="view-title-table-column"]/a');
  $assert_session
    ->elementExists('css', '#block-thunder-admin-content > div > div.view-content-search-api');

  // Uninstall search_api.
  $module_installer
    ->uninstall([
    'search_api',
  ]);
  drupal_flush_all_caches();

  // The normal view is back.
  $this
    ->drupalGet('admin/content');
  $assert_session
    ->elementExists('xpath', '//*[@id="view-title-table-column"]/a');
  $assert_session
    ->elementExists('css', '#block-thunder-admin-content > div > div.view-content');
}