You are here

public function DisplayTest::testAddDisplay in Drupal 9

Same name in this branch
  1. 9 core/modules/views_ui/tests/src/Functional/DisplayTest.php \Drupal\Tests\views_ui\Functional\DisplayTest::testAddDisplay()
  2. 9 core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php \Drupal\Tests\views_ui\FunctionalJavascript\DisplayTest::testAddDisplay()
Same name and namespace in other branches
  1. 8 core/modules/views_ui/tests/src/Functional/DisplayTest.php \Drupal\Tests\views_ui\Functional\DisplayTest::testAddDisplay()

Tests adding a display.

File

core/modules/views_ui/tests/src/Functional/DisplayTest.php, line 37

Class

DisplayTest
Tests the display UI.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function testAddDisplay() {
  $view = $this
    ->randomView();
  $this
    ->assertSession()
    ->elementNotExists('xpath', '//li[@data-drupal-selector="edit-displays-top-tabs-block-1"]');
  $this
    ->assertSession()
    ->elementNotExists('xpath', '//li[@data-drupal-selector="edit-displays-top-tabs-block-2"]');
  $this
    ->assertSession()
    ->pageTextMatchesCount(0, '/Block name:/');
  $this
    ->submitForm([], 'Add Block');
  $this
    ->assertSession()
    ->elementTextContains('xpath', '//li[@data-drupal-selector="edit-displays-top-tabs-block-1"]', 'Block*');
  $this
    ->assertSession()
    ->elementNotExists('xpath', '//li[@data-drupal-selector="edit-displays-top-tabs-block-2"]');
  $this
    ->assertSession()
    ->pageTextMatchesCount(1, '/Block name:/');
}